What is a webhook

Webhooks are used to push real-time data to you about changes(updates) to certain API requests. All webhooks use HTTPS and deliver a JSON payload that can be used by your application. You can use webhook feeds to do things like:

  • Create alerts in your messaging or incident tools based on event types
  • Store all payload events in your own database for custom reporting/retention
  • Update the status of an async request in your application.

Steps to receive webhooks on JigsawStack

  • Create a webhook endpoint to receive requests on your server. E.g https://your-domain.com/api/webhook
  • Attach your webhook endpoint to the body parameters of an API that supports webhooks. See example below:
const endpoint = "https://api.jigsawstack.com/v1/ai/transcribe";
const options = {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": "<your-api-key>", // Replace with your actual API key.
  },
  body: JSON.stringify({
    url: "https://rogilvkqloanxtvjfrkm.supabase.co/storage/v1/object/public/demo/Video%201737458382653833217.mp4?t=2024-03-22T09%3A50%3A49.894Z",
    webhook_url: "https://your-domain.com/api/webhook", // Replace with your actual webhook URL.
  }),
};
const result = await fetch(endpoint, options);
const data = await result.json();

Sample Webhook Result

{
  "success": false,
  "status": "success",
  "id": "35643965633a84534a396dcc11252cd1",
  "text": "Hey guys, I'm pretty excited to talk about a new API that we're going to be releasing in Jigsaw Stack. It's our AI Scrape API, which can basically scrape any website by just prompting and giving you back structured data consistently, no matter the site."
  "chunks":[
    {
     "timestamp": [
        0.96,
        7.2
      ],
      "text": " Hey guys, I'm pretty excited to talk about a new API that we're going to be releasing in Jigsaw"
    },
    ...
  ]
}

Logs API

To enable webhook for the Logs API, follow the steps below:

  • Under the Settings tab, select Webhook
  • Enable the type of logs to receive i.e Success logs or Error logs
  • Add webhook URL in the endpoint field.
  • Click Create button to save.

Hurray! You can now receive log events.

To secure your webhook, follow this guide Secure Webhook