Receiving webhooks in realtime
Get webhooks updated live through a WebSocket
Admin permissions required
For the WebSocket interface to work, your app must have the
admin
permission enabled on its page. This will probably change in the future and we'll have a separate permission for it.
As of June 4th, 2016, you can now receive Clear webhooks through WebSocket!
If you have an application with the admin permission, connect to events.clear.codeday.org
and authenticate by sending a message like this:
{
"type": "authenticate",
"token": "APP_TOKEN",
"secret": "APP_SECRET"
}
If the above information is correct, the server will respond with a message like this:
{
"success": true,
"authenticated": true,
"app": {
"public": "APP_TOKEN",
"private": "APP_SECRET",
"name": "Your cool app",
"description": "App description",
"permission_admin": true,
"permission_internal": true
}
}
You will now start receiving every webhook available through the socket in events that look like this:
{
"type": "registration.register", // Webhook name in all lowercase
"data": { } // Webhook-specific data
}
Please also remember to send the ping
message every 20-30 seconds or else the server might kick you off:
{
"type": "ping"
}
Updated over 7 years ago