About Webhooks
A few ways you can incorporate webhooks are:
-
Create email notifications when an event occurs, such as if a duplicate refund was processed to the same customer, when your inventory limit for an item is running low, or if a customer disputes a charge.
-
If a customer cancels a payment, you can use a webhook with your email marketing software so that a user gets an email for verification of the cancellation.
-
Webhooks can be used to sync data in other applications as well, if a user changes their email address, you can make sure the change is reflected in your CRM as well.
Event details are sent in JSON format with Tilled sending a POST request to your notification URL. Tilled expects that the server that responds to a webhook will return a 2xx response code and HTTPS is required.
For example, let's say you want Tilled to automatically email customers for failed payments or a canceled payment; here's how a webhook works:
- A customer subscribing to your service gets charged, and the payment fails.
- A webhook with Tilled is set up in real-time to send you updates on failed payments.
- Tilled sends you a failed payment notification via HTTP.
- You'll receive an HTTP request, identify it, and contact the customer via your application.
What are Webhooks
Tilled can send real-time notifications to your app via a webhook. Tilled sends these notifications to your app as a JSON payload via HTTPS. These notifications can then be used to trigger actions in your backend systems.
Webhooks refer to a combination of elements that collectively create a notification and reaction system within a more extensive integration.
Webhooks are similar to a phone number that Tilled dials to tell you of activity in your account. A new customer might be created, or funds could be deposited into your bank account. The webhook endpoint is the person who answers the phone and takes action based on the data it gets.
The webhook endpoint is simply more code on your server, which could be written in Ruby, PHP, Node.js, or any other language. A URL (e.g., https://example.com/webhooks) is associated with the webhook endpoint. Event objects are Tilled notifications.
This Event object holds all relevant information about what just happened, such as the type of event and the data associated with it. The event details are used by the webhook endpoint to perform any necessary actions, such as indicating that an order should be fulfilled.
When to Use Webhooks
Many events within a Tilled account have synchronous results–immediate and direct–to an executed request. For example, a successful request to create a customer immediately returns a Customer object. Such requests don’t require webhooks, as the key information is already available.
Other events that occur within a Tilled account are asynchronous: happening at a later time and not directly in response to your code execution. Most commonly these involve:
- A pending ACH debit charge succeeded (e.g. charge, succeeded or payment_intent.succeeded)
- Notifications of payouts
- Connected account status changes (useful during onboarding)
With these and similar APIs, Tilled needs to notify your integration about changes to the status of an object so your integration can take subsequent steps.
The specific actions your webhook endpoint may take differs based on the event. Some examples include:
- Updating a customer’s membership record in your database when a payment succeeds
- Logging an accounting entry when a transfer is paid
- Indicating that an order can be fulfilled (i.e., boxed and shipped) Webhooks can also be used to provide state and API responses to services or systems that use Tilled data for things like replication, analytics, or alerting.