Webhook Notification Support for Adobe PDF Services APIs
Adobe PDF Service APIs now offer support for Webhook notifications. Webhooks are designed to facilitate the receipt of job completion notifications. This new feature eliminates the need for clients to manually invoke the GET Status API to obtain job completion status and results. Instead, they will receive automatic notifications containing the job status and result.
To leverage the power of webhooks, clients are required to include the notifiers key in the request body when making a call to the Submit Job API. The notifiers key is designed to receive a list of objects, with each object corresponding to a specific webhook. Each notifier object is composed of two essential fields: type and data. Here, we provide detailed information about these fields and offer a sample request:
- type: This field specifies the type of notifier to be invoked. Currently, the only supported notifier type is CALLBACK.
- data: This field contains the data required for the webhook. The specific data may vary depending on the type of notifier in use.
For more information on the CALLBACK notifier, please refer to the Callback Notifier section.
Sample Request Body
Copied to your clipboard{"assetID": "<ASSET ID>",....,///REST API Operation related details...."notifiers": [{"type": "<NOTIFIER_TYPE>","data": {//<NOTIFICATION_DATA>}}}]}
Callback Webhook Usage
The callback webhook feature allows the client to receive notifications regarding job completion on an HTTPS URL. To enable this feature, the client is required to create an HTTPS POST URL and share that URL along with the necessary header information in the request. Once the job has been successfully completed, we generate a notification payload that includes information about the job status and the details of the output assets. This payload is then sent via an HTTP POST request to the URL provided by the client.
Parameters for the Notifier Object
When utilizing the callback webhook, the following parameters need to be included within the notifier object:
- type (Required): This field should always be set to CALLBACK.
- data (Required): The "data" field contains the following keys:
- url (Required): This is the HTTPS POST URL created by the user to receive the callback.
- headers (Optional): This is a map of key-value pairs and represents header-related information required to make the URL call. This field is optional but can be used to provide additional context or authentication for the callback.
Sample Notifier Object
Copied to your clipboard{"assetID": "<ASSET ID>",....,///REST API Operation related details...."notifiers": [{"type": "CALLBACK","data": {"url": "https://dummy.callback.org/","headers": {"x-api-key": "dummykey","access-token": "dummytoken"}}}]}
Callback Payload on HTTPS URL
The notification payload sent to CALLBACK URL is same as that of GET STATUS response along with jobID.
In case Job completes with Success
In case of successful job completion, the following callback payload will be sent to callback url:
Copied to your clipboard{"jobID": "<JOB ID>","statusResponse": {"status": "done","asset": {"metadata": {"type": "application/pdf","size": 318974},"downloadUri": "<DOWNLOAD URI","assetID": "<ASSET ID>"}}}
In case Job completes with Failure
In case of failed job completion, the following callback payload will be sent to callback url:
Copied to your clipboard{"jobID": "<JOB ID>","statusResponse": {"status": "failed","error": {"code": "<ERROR CODE>","message": "<ERROR MESSAGE>","status": 400}}}
Expected Response from the Client
The client is expected to return the following response payload with an HTTP status code of 200 (OK):
Copied to your clipboard{"ack": "done"}
If the response code is not 200 (OK) or the expected payload is not received, it will be considered an error response. In the event of 50 error responses within a 10-minute period, webhook notification support will be temporarily blocked for that client for the next 20 minutes.
Note: The webhook notification support is only available in SDKs version 4.x.x and the REST APIs.