1. Add the script
1
Create a project
Go to script.google.com and choose New project. Call it Scoutworks calendar.
2
Paste the script
Delete what is there and paste the script below. Choose Save.
Code.gs
2. Add your key
In the script editor, choose Project Settings (the cog), then Script Properties → Add script property. Property:SCOUTWORKS_API_KEY. Value: the sandbox key to try it, or your own key. Choose Save script properties.
3. Publish it as a web app
1
Start a deployment
Choose Deploy → New deployment. Next to Select type, choose the cog, then Web app.
2
Set who can use it
- Execute as: Me
- Who has access: Anyone
3
Copy the address
Copy the Web app URL. It ends in
/exec. Open it in your browser to check it: you get a short text file that starts with BEGIN:VCALENDAR.?section= and a word from the section’s name to the end of the address. For example, …/exec?section=cubs gives only the Cubs’ events, plus the events for the whole group. Choose a word that only one section’s name has: scout also finds “Explorer Scouts”.
4. Subscribe to it
Calendar apps check a subscribed feed on their own timetable, often every few hours. Google Calendar can take up to a day. You cannot make it faster.
5. Switch to your group
In the script, changeapi-demo.scoutworks.app to api.scoutworks.app. In Script Properties, replace the sandbox key with your own. Your key needs the events:read scope. Give it no other scope.
After you change the script, choose Deploy → Manage deployments → Edit (the pencil). Set Version to New version and choose Deploy. The address stays the same. If you create a new deployment instead, you get a new address, and your subscribers do not see the change.
Notes
- The feed holds events from 30 days ago to one year ahead. Change the
30and365indoGetto change this. - The script keeps each feed for one hour, so a change in Scoutworks reaches the feed within an hour. This also stops repeated requests from using up your API limit.
- Only published events are in the feed. Drafts and leaders-only events never are.
- Each event keeps its Scoutworks ID in the calendar, so a moved event moves in the calendar. It does not appear twice.