API and automations
With the Traverse API and webhooks you can set up automations. It allows you to hook up Traverse to any other tool you’re using, from Typeform to collect emails, to Notion or Google docs to keep student information.
You don’t need programming knowledge to use the API and webhooks. We’ll provide the info here on how to connect them with Zapier, so you can connect with anything supported by Zapier (flows for other tools like Integromat are similar).
API endpoints
The API endpoints allow you to performs actions like adding or removing students, or getting student email and study info.
Authentication with API key
To use the API, you’ll first need to get the API key from your account. You can find your API key in the account settings dialog. It needs to be set in the
api-key
header for every request (more info later on how to do that).Available endpoints
Let’s take a look at the endpoints available (more are being added):
add_students
remove_students
Add students to course
POST https://traverse.link/api/add_students
Request body:
{ emails: [ARRAY_OF_EMAILS], courses: [ARRAY_OF_COURSE_URLS] // a course URL looks like "/CREATORUSERNAME/COURSETITLE", duplicate: [BOOLEAN] // allow user to duplicate your course (default: false), edit: [BOOLEAN] // allow user to edit your course (default: false) }
Give all email addresses access to the courses specified. If the student already has a Traverse.link account, they will be enrolled automatically. If they don't have an account yet, they will be enrolled as soon as they sign up. No emails are sent to the students, you need to notify them yourself!
N.B. a course URL looks like
/CREATORUSERNAME/COURSETITLE
(you can grab the part after traverse.link
from the location bar of your browser when viewing your course), for example "/dominiczijlstra/Chinese for beginners"
Example in JavaScript
fetch(`https://traverse.link/api/add_students`, { method: "POST", headers: { Accept: "application/json", "Content-Type": "application/json", "api-key": apiKey }, body: JSON.stringify({ emails: ["dominiczijlstra+test170@gmail.com"], courses: ["/dominiczijlstra/Chinese%20for%20beginners"] }) })
Example in Zapier
To use this as your Zapier action, choose
Webhooks by Zapier
and then Custom request
. Then configure the fields as below (but use your own API key!):Example response
{"emails":["dominiczijlstra+test170@gmail.com"],"courses":["/dominiczijlstra/Chinese%20for%20beginners"],"added":true}
Remove students from course
POST https://traverse.link/api/remove_students
Request body:
{ emails: [ARRAY_OF_EMAILS], courses: [ARRAY_OF_COURSE_URLS] // a course URL looks like "/CREATORUSERNAME/COURSETITLE" }
Revoke access to the courses specified for all email addresses specified.
N.B. a course URL looks like
/CREATORUSERNAME/COURSETITLE
and should be URL encoded (you can grab this from the location bar of your browser when viewing your course), for example "/dominiczijlstra/Chinese%20for%20beginners"
Example in JavaScript
fetch(`https://traverse.link/api/remove_students`, { method: "POST", headers: { Accept: "application/json", "Content-Type": "application/json", "api-key": apiKey }, body: JSON.stringify({ emails: ["dominiczijlstra+test170@gmail.com"], courses: ["/dominiczijlstra/Chinese%20for%20beginners"] }) })
Example in Zapier
To use this as your Zapier action, choose
Webhooks by Zapier
and then Custom request
. Then configure the fields as below (but use your own API key!), and replace add_students
with remove_students
Example response
{"emails":["dominiczijlstra+test170@gmail.com"],"courses":["/dominiczijlstra/Chinese%20for%20beginners"],"removed":true}
Webhooks (Triggers)
Webhooks are in Beta. Do not rely on this feature for business-critical purposes.
You can specify URL's that will be notified when certain events happen in your account settings. A POST request with the relevant data will be sent here when an event happens.
In Zapier, this means you can use an event as a Trigger for an action in another app.
Specify the URL’s to notify in the
API
tab of your account settings.Example event
{ "type": "student_enrolled", "paid": false, "course": "test", "creator": "dominiczijlstra", "studentUsername": "hi", "studentEmail": "dominiczijlstra+test@gmail.com" }
Example to use as Zapier trigger
Use a catch hook
And copy the resulting URL to your endpoints