Webhooks

Setting up a webhook

Documents generation is asynchronous. You can wait for the generation to end and call the API repeatedly or configure a webhook to get notified of a document’s generation.

Go to the Edit app page and set a Webhook URL then click on the Save button.

Everytime a Document is generated for this app, your webhook will be called using a POST request with a Content-Type: application/json header and your Document details as body.

Warning: PDFMonkey will expect a 200 OK response from your webhook URL with an empty body.

Testing your webhook

You can use the following curl command to test your webhook:

curl https://your.website.com/replace-with-your-webhook \
  -H 'Content-Type: application/json' \
  -D- \
  -d '{
    "document": {
      "id": "11111111-2222-3333-4444-555555555555",
      "status": "success",
      "app_id": "22222222-3333-4444-5555-666666666666",
      "document_template_id": "33333333-4444-5555-6666-777777777777",
      "payload": "{\"name\":\"Jane Doe\"}",
      "checksum": "1234567890abcdefghijklmnopqrstuv",
      "download_url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
      "preview_url": null,
      "meta": null,
      "created_at": "2018-12-04T20:28:35.072+01:00",
      "updated_at": "2018-12-04T20:28:38.899+01:00"
    }
  }'