Introduction
Webhooks allow you to listen to certain events on Toornament.
When one of those events happen, an HTTP POST request is sent to your configured webhook URL.
Concept
A webhook is linked to an application. You can find the list of your webhooks on the Applications page.
Example of a webhook
{
"name": "My webhook",
"url": "http://toornament.com/webhook",
"enabled": true
}
Example of a subscription
{
"event_name": "registration.info_updated",
"scope": "tournament",
"scope_id": "842693950880972836"
}
First you need to define a webhook (see webhook endpoint).
Each webhook subscription (see subscription endpoint)
has specific scope
and scope_id
parameters used to limit the entity events the webhook listens to.
Scopes
The Webhook API currently support the following webhook scope:
Listens to a specific tournament. The scope_id
is the tournament_id
.
Listens to a specific project. The scope_id
is the ID of the project.
Listens to a specific platform. The scope_id
is the ID of the platform.
Event Names
Registration
Scope: tournament, project, platform
Triggers when a registration is created.
registration.info_updated
Triggers when information of a registration is updated.
Triggers when a registration status becomes accepted.
Triggers when a registration status becomes refused.
Triggers when a registration status becomes pending.
Triggers when a registration status becomes cancelled.
registration.payment_pending
Triggers when a registration have a payment in pending.
registration.payment_skipped
Triggers when a registration payment has been skipped.
registration.payment_completed
Triggers when a registration payment has been completed.
registration.payment_refunded
Triggers when a registration payment has been refunded.
registration.payment_failed
Triggers when a registration payment have failed.
Triggers when a registration is deleted.
Participant
Scope: tournament, project, platform
Triggers when a participant is created.
Triggers when information of a participant is updated.
Triggers when a participant is checked in.
Triggers when a participant is checked out.
Triggers when a participant is deleted.
Tournament
Scope: tournament, project, platform
Triggers when a new tournament has been created.
tournament.registration_opened
Triggers when a tournament registration process starts.
tournament.registration_closed
Triggers when a tournament registration process ends.
tournament.check_in_opened
Triggers when a tournament check-in process starts.
tournament.check_in_closed
Triggers when a tournament check-in process ends.
Triggers when a tournament information has been updated.
tournament.custom_fields_updated
Triggers when a tournament custom fields has been updated.
tournament.sponsors_updated
Triggers when a tournament sponsors has been updated.
tournament.standing_updated
Triggers when a tournament standing has been updated.
Triggers when a tournament has been deleted.
Stage
Scope: tournament, project, platform
Triggers when a new stage has been created.
Triggers when a stage information has been updated.
Triggers when a stage structure has been updated.
Triggers when a stage status has changed.
Triggers when a stage has been deleted.
User
Scope: platform
Triggers when a user is created.
Triggers when information of a user is updated.
Triggers when a user changes their email address.
Triggers when a user is deleted.
Team
Scope: platform
Triggers when a team is created.
Triggers when a team lineup has been changed.
Triggers when a team is disbanded.
Payload
The following information is passed along in the raw body of the post request of the webhook (json encoded):
Example{
"name": "registration.created",
"object_id": "375143143408309123",
"object_type": "registration",
"scope": "tournament",
"scope_id": "842693950880972837",
"triggered_at": "2015-12-31T00:00:00+00:00"
}
Entity type concerned by the event.
Entity id concerned by the event.
Scope concerned by the event.
Scope id concerned by the event.
Timestamp of the event trigger in seconds.
Format: RFC 3339 (combined date, time and utc offset)
Available Object Types
You can retrieve the registration on the organizer registration endpoint. The object_id
is the registration_id
.
https://api.toornament.com/organizer/v2/registrations/{object_id}
You can retrieve the participant on the organizer participant endpoint. The object_id
is the participant_id
.
https://api.toornament.com/organizer/v2/participants/{object_id}
You can retrieve the tournament on the organizer tournament endpoint with scope
to tournament
. The object_id
is the same as the scope_id
.
https://api.toornament.com/organizer/v2/tournaments/{scope_id}
Security
Webhook URL legitimation
To ensure your webhook URL is a legit URL, a HTTP HEAD request will be sent with the X-Webhook-Secret
header.
To validate your webhook, the response to this request must return a 200 HTTP Response with the same X-Webhook-Secret
header.
Save the X-Webhook-Secret
header as you will need it for payload validation.
Payload Validation
In each HTTP POST webhook, a X-Webhook-Signature
header is added to the request to ensure that payload has not been altered.
To validate the body content you need to concatenate the body response with the X-Webhook-Secret
header and hash the result with sha256
.
The result string must be the same as the X-Webhook-Signature
.
Retry policy
If the Toornament servers can not contact the webhook URL, the servers will try to send the data again during the next 24 hours.
So we can not ensure the event payloads will be delivered in the correct order.
To prevent any error, we recommend you retrieve the entity concerned by the event to make sure you have its latest state.