This page describes what webhooks are and how you can use them to integrate Semantik with other applications and export your data.
What is a Webhook?
Webhooks are one of the ways applications can communicate with each other. They are a useful, resource-light way to implement event reactions, which means a specific action will be triggered when an event occurs.
Webhooks include JSON payloads—your data—which is sent to a unique URL. The URL acts like a phone number for the originating application (App A) to call the target application (App B). That means when an event occurs in App A, it will send that data to App B's unique URL.
For example, say you run an online business and want to create an invoice each time a customer completes an order. To break it down:
The trigger: A customer purchases something on your online store.
The action: An invoice is created in your invoice app for the order.
Before the webhook can run, you need to tell the originating app—your online store—the webhook URL of the app where you want the data to be sent—the invoice app. Webhook URLs are generated by the app where the data is going to, not coming from.
To do so, you would need to make an invoice template in your invoice app, and copy its webhook URL—something like invoiceapp.com/data/123.
Then you can go into the originating app—your online store—and add the webhook URL to its webhook settings. If your online store pings that URL, the invoice app will notice that someone is trying to send it data.
Now whenever your online store receives an order, it will encode all the necessary data (your payload) and ping the webhook URL, sending the order details to your invoice app to create a new invoice.
Webhooks vs APIs
Webhooks and APIs are similar in that they are both methods for applications to communicate. The key difference between the two is APIs communicate by repeatedly polling for information, while webhooks automatically activate when something happens.
Polling is like you refreshing your email inbox every 10 seconds to see if you have new mail, where webhooks are like your email client sending you a notification when you have new mail. This is why webhooks are sometimes called "Reverse APIs" or "Push APIs". They send the payload as soon as it's available.
This is also why webhooks are less resource-intensive than APIs—all your application needs to do is monitor its own URL.
How You Can Use Webhooks with Semantik
You can use webhooks with Semantik to automate common workflow tasks, such as exporting your invoice data, or sending a notification when an invoice is finished processing.
To use a webhook, you need to register a URL with Semantik Invoice under Settings > Import. Whenever there's something new, the webhook will send it to your URL.
For help creating webhooks or using a third-party application, refer to Integrating with Semantik.