Predict.io supports delivering event notifications to your own servers as webhooks. Webhooks allow you to know that an event has happened and gives you the opportunity to perform some additional processing within your own API.
Some examples of why you may want to receive webhooks would be to:
- Generate a notification sent to your app (we utilize this in our example projects)
- Capture a credit card payment at the end of a trip
- Send a location & journey based, time limited offer to a customer
- Validate a ticket or pass upon arrival at a destination
By not only relying on your mobile app to handle these events you can leverage the power within your existing API to perform any of these types of activities, and with the control being placed on the server side, you don't need to update your apps and can create additional use cases and enhanced customer engagement solely from the server side application.
Additionally, even less sensitive information has to reside on the customer's device allowing for a more tailored customer experience whilst utilizing the security of your backend API.
Diagram explaining how webhooks can be used.
- You call setCustomParameter() to set any custom data you want to receive, along with the event itself, on your API.
- This may be data for push notification IDs, customer IDs, CSRF-esque tokens, etc.
- To receive the webhook you must set the receiving URL with the setWebhookURL() in the SDK
- The predict.io SDK sends the event to the predict.io API and processes the request.
- A webhook is generated and sent to the URL you set within setWebhookURL()
- Here you can perform your custom business logic to determine what to do with the event
- Optionally generate a notification from your API to your app
Learn more about it on our GitHub documentation: