- For: treasurers, and leaders who pay for things
- You get: a button on your phone that photographs a receipt, finds the transaction it belongs to and attaches the photo to it
- Time: about twenty minutes the first time
- Scopes:
accounting:read,accounting.people:readandaccounting:write
POST /transactions/{transactionId}/attachments.
1. Try the request
The list the button shows is the last fortnight’s spending. Paste this into a terminal to see the demo group’s:id, a date, an amount in pounds and, with accounting.people:read, a description and counterparty. The button shows those, so you can tell the camp gas from the hall cleaning.
The upload itself is one request with the photo in a part named file:
201 with the attachment. A photo of up to 10 MB is fine; a PDF, a JPEG or PNG photo, or a saved email (.eml, .msg) all work. Each one is virus scanned before it is stored.
2. Make a key
In Scoutworks, go to Settings → Integrations → API keys and create a key called “Receipts” withaccounting:read, accounting.people:read and accounting:write. Copy it: it is shown once. The key only ever changes the books as the admin who created it, and Scoutworks marks each receipt with the key’s name.
- iPhone Shortcut
- Power Automate (Android and Microsoft 365)
3. Build the Shortcut
Open Shortcuts, tap +, and add these actions in order. Search for each by name.1
Take Photo
Leave Show Camera Preview on.
2
Resize Image
Width 2000, height auto. A receipt stays readable and the upload stays small.
3
Convert Image
To JPEG.
4
Adjust Date and Format Date
Add Adjust Date: subtract 14 days from Current Date. Then Format Date with a custom format of
yyyy-MM-dd.5
Get Contents of URL (the list)
URL:
https://api.scoutworks.app/api/v1/transactions?type=expense&limit=50&from= followed by the Formatted Date variable. Under Headers, add Authorization with the value Bearer and your key.6
Get Dictionary Value
Get the value for
data in Contents of URL.7
Repeat with Each
For each item in Dictionary Value: add a Text action with the item’s
date, £, its amount and its description. Then Set Dictionary Value on a dictionary variable called Payments: key Text, value the item’s id. (Start with an empty Dictionary action named Payments before the repeat.)8
Choose from List
From the keys of Payments, with the prompt “Which payment is this receipt for?”. Then Get Dictionary Value for Chosen Item in Payments, and Set Variable
TransactionId to it.9
Get Contents of URL (the upload)
URL: type
https://api.scoutworks.app/api/v1/transactions/PASTE_TRANSACTION_ID/attachments, then replace PASTE_TRANSACTION_ID with the TransactionId variable. Method POST. Headers: Authorization as before. Request Body: Form. Add one field of type File, key file, value Converted Image.10
Show Notification
“Receipt attached”. If the upload answered an error, the notification shows its message instead.
Try it on one receipt
Before you hand the button to the whole team, check one receipt lands where you expect.1
Attach one
Photograph a receipt for a payment you can find easily, and run the button once.
2
Check it in Scoutworks
Open that transaction in Finance → Transactions. The photo is under its attachments, readable, and on the right line. If it is on the wrong one, remove it there and run the button again.
Safe to press twice
Sending the same photo to the same transaction again answers200 with the attachment it already has: nothing is stored twice. A receipt changes nothing about the money, so a line from the bank, GoCardless or a closed year takes one too.
If something goes wrong
413 file_too_large: the photo is over 10 MB. Keep the Resize Image step, or take the photo at a lower resolution.415 unsupported_file_type: the file is not a photo, a PDF or a saved email.422 file_infected: the virus scan found something in the file, and nothing was stored. Do not send it again.404 not_found: the transaction is not in your group, or was deleted.429 rate_limited: the key has uploaded more than 50 MB in a minute. Wait a minute. See Rate limits.403 insufficient_scope: the key cannot write. Addaccounting:write, or use your own key in place of the sandbox key.