Skip to main content
  • For: section leaders, with a group admin to create the key
  • You get: a term’s programme from a spreadsheet, as draft events to check and publish
  • Time: about fifteen minutes
  • Scopes: events:read and events:write
Many sections plan a term in a spreadsheet: a date and an activity per week. This recipe adds each row to Scoutworks as a draft event. Leaders check the drafts and publish them in Scoutworks, which is when families hear about them. It takes about fifteen minutes. It is for a section leader working with a group admin, who creates the key.

1. Create a key

A group admin opens Settings → Integrations → API keys and creates a key called Programme planner, with the scopes events:read and events:write. Drafts the key adds show that admin as their creator. The API can only add drafts and change what a draft says. It never publishes, cancels or prices an event, and it never emails families.

2. Lay out the sheet

Make a tab called Programme with these columns: Format column A as a date and columns B and C as times, for example 18:30. Leave column F empty: the script fills it in. Put the section’s id in cell H1: find it with GET /sections, or ask the group admin.

3. Add the script

Choose Extensions → Apps Script, paste the script below, and choose Save. Add the key in Project Settings → Script Properties as SCOUTWORKS_API_KEY. Reload the sheet.
Code.gs

4. Try one row, then the rest

Fill in one row and choose Scoutworks → Add new rows as drafts. Open Events in Scoutworks: the meeting is there as a draft. Check the date and time. If it is wrong, delete it there, correct the row, clear column F and run it again: a corrected row is sent as a new request. Sent unchanged within 24 hours, it would answer with the draft you deleted. When it is right, fill in the rest of the term and run it again. Rows that already have an id are skipped.

5. Change a draft from the sheet

To move a meeting after you added it, change the event with PATCH /events/{eventId}, using the id in column F. Send only what changed, for example {"location": "Hayes Common"}. Read the event first and send its ETag as If-Match, so you never overwrite a change a leader made in Scoutworks: see Writing data. The API answers 409 source_locked if you send a status: publishing and cancelling stay in Scoutworks, because both tell families.

If something goes wrong

  • 400 invalid_request: for example an end before the start, or a section id that is not your group’s. The message says which.
  • 403 insufficient_scope: the key needs events:read and events:write.
  • 402 subscription_required: the group’s subscription has lapsed.
See Errors for every code.