Using Webhooks
A webhook (also called a web callback or HTTP push) is a way for the Eventbrite API to provide integrated applications with information. Webhooks delivers information to your applications in real-time, meaning you get an immediate notification.
Currently, the webhooks provided by Eventbrite track six objects: Event, Order, Attendee, Organizer, Ticket Class and Venue. You should use these webhooks to ensure that your application remains compliant and compatible with Eventbrite. Make sure to follow the Eventbrite Engineering Blog to receive updates about our webhook implementation.
To implement webhooks, you need to:
Make sure you have the necessary prerequisites.
Create a webhook.
Test the webhook.
Note: If your website receives webhooks, ensure that the webhooks are sent to a ‘private, unpublished’ URL. Otherwise, your website may be impacted by bogus messages and responses, such as a ‘410 Gone’ response. This 410 response automatically unsubscribes from the endpoint which sent the response.
Webhooks for the Event object
The following Event actions have webhooks:
- Publish
- Unpublish
- Create
- Update
Webhooks for the Order Object
The following Order actions have webhooks:
- Place
- Update
- Refund
Webhooks for the Attendee Object
The following Attendee actions have webhooks:
- Update
- Check_in
- Check_out
Webhooks for the Organizer Object
The following Organizer actions have webhooks:
- Update
Webhooks for the Ticket Class Object
The following Ticket Class actions have webhooks:
- Create
- Delete
- Update
Webhooks for the Venue Object
The following Venue actions have webhooks:
- Update
The Composition of Webhooks
Webhooks are constructed as an HTTP request with the following composition:
- Sent via the POST method
- Application/JSON mime type defined in the headers
- Valid JSON payload (i.e. the part of transmitted data that is the actual intended message).
Attribute | Description |
---|---|
api_url | Object whose creation or update triggered the webhook |
config.endpoint_url | Target URL specified when the webhook was created. |
Example webhook JSON payload:
{
"api_url": "https://www.eventbriteapi.com/v3/orders/1234567890/",
"config": {
"endpoint_url": "https://myawesomeapp.com/webhook"
}
}
Prerequisites to Using Webhooks
In order to use webhooks, you need the following:
- At least one Event.
- An Eventbrite API User Key.
- A registered integrated application
- A public, online website that can receive webhooks. This can be built in Django, Flask, Rails, Node.js, PHP or any tool for the creation of web pages.
Creating a Webhook
To create a webhook:
Go to the Webhooks Add
Choose an Event.
Enter the URL
http://httpbin.org/post
, then select the object for which you want to create a webhook.Click Add Webhook.
You are directed to the newly created webhook detail page.
Testing a Webhook
You should test that your webhook is correctly implemented. To do so:
- On the webhook detail page, click Test. A test delivery request is generated.
The small, green ‘200 OK’ button corresponds to the HTTP status definition for a standard successful HTTP request. Any webhook delivery request that returns a number beginning with 2 (two) is considered a success.
- Click ‘200 OK’. It expands, displaying the following information:
The Request Headers and Request Payload are what the Eventbrite webhooks system sent to the endpoint URL (i.e. your website). The Request Payload is valid JSON, which you can parse and use.
Conversely, the Response Headers and Response Body comprise the data sent back by the your receiving app. The delivery response is stored for 15 days.
Failed Webhooks
On occasion, a webhook delivery request returns a number that isn’t in the 2xx pattern, possibly because the target app responded with an error code, had too many redirects, or suffered from latency issues. When this occurs, the webhook system displays the request with a small red button with the appropriate error-level HTTP status code and message.
When a non-2xx patterned response occurs, the Eventbrite webhook system continues to resend the request every ten minutes, until the system either receives a success, or ten additional attempts are made. This is done to provide you with the opportunity to correct any problems with your app integration.
You can also manually resend a failed webhook delivery request. To do so:
Go to the webhook dashboard.
Click the red failure button. The button expands to display a a green ‘resend hook’ button.
Click the green ‘resend hook’ button.
Deleting Webhooks
You can delete a webhook. Please be aware that this is a permanent action that both deletes the actual webhook and all of it's delivery request and delivery response history.
To delete a webhook:
Go to the webhook dashboard.
Click the big blue ‘Delete’ button.
Confirm that you want to delete the webhook, by clicking on the prompt.