Set up a webhook to an event

Optimize your processes by subscribing to events in this end-to-end guide

Read this topic, and you’ll learn how to use webhooks to subscribe to events. While setting up webhooks is the same for every type of event, you’ll specifically learn how to set up a document completion webhook in this guide. Thus, this webhook alerts you when a document has finished rendering – an everyday use case for many organizations.

At the end of this guide, you should have a functioning webhook that notifies you whenever you’ve generated a document.

Note: You will need your API testing tool or code environment handy as you need to generate a sample document to test this webhook. We recommend Insomnia or Postman.

Prerequisites:

  • You are able to generate PDF documents through the Inkit Render API
  • You have a mock request tool like Postman or Insomnia available
  • Your API key has the appropriate permissions (Renders.create)
  • Your user sign in has the appropriate permissions (Webhooks.create)
  • (Optional): Your API key has access to the private folder to which you are rendering your sample document

Read more about:

Getting ready to create a document complete webhook

Before you create your webhook, you should have all the necessary data to test it. To help you, we’ve created this small overview. Please take a look at it.

  1. Make sure you have an HTML document at hand so that you can generate a PDF. You will test your webhook with this document

  2. Ensure your API key has the appropriate permissions to render

  1. Optional: Give your API key access to your folder if you wish to render to a private folder

Even though the previous steps are specific to the document complete webhook, it is crucial to replicate the process when setting up any webhook. As a rule of thumb, you should first determine which data or steps you need to take in order to test.

Creating your webhook

Setting up a webhook is straightforward. While in this example, you will discover how to add a document complete webhook, the process is the same for any webhook.

Continue by following these steps:

  1. In the Inkit web environment, browse to the Development tab
2528
  1. Press the ‘Add webhook’ button and choose a name for your webhook
2224
  1. Include the URL that the Inkit API should notify you on

Note: This is the URL you will receive your event notifications on. For testing purposes, you may wish to use a mock webhook URL. We use https://webhook.site for this.

  1. Add the events you wish you be subscribed to
2224
  1. Confirm by pressing save and save your webhook secret securely

You should have now set up a webhook. In this particular case, the webhook will notify you when a document is generated.

Use the HTML document you prepared earlier and send a create request if you would like to test your webhook.

1788

If all goes well, you should receive a document complete notification on your webhook.

1060

Are you unsure how to send a document create request?