- Keep your app synced when a customer’s profile is updated.
- Trigger notifications to keep customers engaged.
Examples of when your app might use webhooks
- Notify customers about profile updates: Send alerts when something in a customer’s profile changes.
- Forward notifications: Keep customers informed by sending messages triggered by their actions in Gameball.
- Update loyalty points: Adjust a customer’s points balance when their profile is updated.
APIs for continuous polling vs. Webhooks for events data
Let’s look at how they differ, using thecustomer.notification.push webhook topic as an example:
- Polling APIs: Your app constantly asks Gameball, “Did anything happen yet?” This can lead to unnecessary API calls, increased server load, and delayed updates.
- Webhooks: Gameball tells your app, “Here’s the latest event!” This approach is faster, more efficient, and delivers data as soon as the event occurs.
customer.notification.push, your app receives event data instantly, without the hassle of repetitive API requests.
How it works
- Your app subscribes to the
customer.notification.pushtopic and listens for new notification push events. - Your app specifies a
POSTendpoint to receive webhooks for thecustomer.notification.pushtopic. This endpoint is where the app listens for webhooks. - Suppose now that a notification is pushed from Gameball system.
- This triggers a webhook to be published to the
customer.notification.pushtopic. - Gameball sends that webhook, which includes headers and an order payload, to the specified subscription endpoint.
Key terminology
Topic
Webhooks are grouped into topics, and your app subscribes to one or more of these topics to receive specific event updates.What It Does
A webhook topic determines the type of event messages your app will receive. For instance, subscribing to thecustomer.profile.updated topic lets your app get notified whenever a customer’s profile is updated.
Why It Matters
The topic name clearly identifies the kind of event, helping your app stay focused on relevant updates.Headers
Each webhook includes headers and a payload. The headers provide important metadata about the webhook.X-GB-SignatureA security signature used to verify that the webhook is authentic and originates from Gameball.
X-GB-Webhook-VersionIndicates the version of the webhook being used.
Webhooks Retry Policy
The retry schedule is as follows:- 1st Retry: After 5 minutes
- 2nd Retry: After 20 minutes
- 3rd Retry: After 60 minutes
If all retries fail, the webhook request will be discarded.