docs: Webhooks

Programmable webhooks

SYNQ webhooks are more fancy than your ordinary webhook, they are programmable!

Webhooks allow you to send information over HTTP when certain events happen for a video object.

You can give us a JavaScript function that will run on certain events, we then pass the video object as json to your function and you can act on it by making HTTP POST requests to any service, allowing for great flexibility in integrating SYNQ with other services without a middle-man.

Event handlers

There are three event handlers you can add your code, they are added on a pr. project basis.

  • on_video_create(video) is executed whenever a video object is created.
  • on_video_update(oldVideo, newVideo) is executed whenever anything inside a video object changes.
  • on_video_delete(video) is executed whenever a video object is deleted

To add your code to any of these events, go to www.synq.fm/dashboard click the project you want to add the event listener to. Write your code directly into the code boxes there and remember to flip the active switch.

Each event can only take a single top level function with the correct function name and signature as listed above.

Examples:

Create:

This will be run whenever a video is uploaded to our service, and might be a good place to run your code if you want to do something that is not dependent on a video being transcoded or processed.

Update:

The update event is where most webhooks should probably be run. Check for some value to become available in the video object, then notify another service by making a http request.

The external service could then change the video object and trigger a new run of this function allowing for complex and flexible workflows.

Note: Any change to the video object will trigger a call to this function. This means you have to check for transitions between old and new video object. If you just check for the existence of a field any later change to the video object will evaluate to true.

Delete:

The delete event is in development.

API reference

API Reference

Get in-depth information about SYNQs API and SDKs. Authentication functions, parameters, response formats, and error codes - find it all here.

Open API reference
SYNQ on GitHub

SDKs on GitHub

Easily use SYNQs API in the programming language of your choice. Download and install helpers for Objective-C, Java, JavaScript, Python and more.

Go to GitHub