What is Webhooks?

Webhooks

A webhook is one of the most popular callback mechanisms developers use to integrate two applications. It provides updates to the integrated application whenever an event or action occurs. 

Zoho Sign Webhooks

Zoho Sign lets you configure webhooks to receive updates about events that occur in Zoho Sign. When you create a webhook, you choose which events trigger it. The events are grouped into document events and recipient events.

Document events

Event
Description 
Sent
Triggers when documents are sent for signatures or approval.
Completed by all
Triggers when documents are completely signed and
approved by all recipients.
Expired
Triggers when documents are sent for signatures or approval expire.
Recalled
Triggers when documents sent for signatures or approval
are recalled by the sender.

Recipient events

Event
Description
Viewed
Triggers when documents are viewed by one of the recipients.
Signed by a recipient
Triggers when documents are signed by one of the recipients.
Approved by a recipient
Triggers when documents are approved by one of the recipients.
Declined
Triggers when documents are declined by one of the recipients.
Reassigned
Triggers when documents are reassigned by one of the recipients to be signed or approved by another person.
Hard bounced
Triggers when signature request emails or signer authentication emails hard bounce.

Prerequisites

  1. Webhooks, at present, are available on Enterprise, API, Zoho One, and People Plus plans.
  2. You can create up to two webhooks per account.

How to register a webhook

  1. The Zoho Sign admin can register a webhook by clicking Settings > Developer Settings > Webhooks from the left navigation pane.
  2. Click Create webhook.
  3. Enter the Callback URL (click Test URL to confirm it's reachable) and a name for the webhook.
  4. You can further set trigger criteria so that a webhook fires only for the events that match specific conditions, instead of for every selected event. Note that callbacks are not triggered for events that don't match the criteria you set. If no criteria is set, callbacks are triggered for all the events you select under Callback events. 
  5. To set a trigger criterion:
    1. Under Callback trigger criteria, select a field to check.
    2. Choose a condition.
    3. In Enter value, type the value to match against.
    4. To add another criterion, click the + icon.
  6. Under Callback events, select the document and recipient events that should trigger the webhook.
  7. Configure your Security settings and click Save.



Securing your webhook

Under Security settings, you can authenticate the requests sent to your endpoint and verify the integrity of each payload. Learn how to configure the security settings.

Authentication

  1. Basic Authentication - Protect your endpoint with a username and password. The credentials are Base64-encoded and sent in the Authorization header with every request.
  2. OAuth 2.0 - Zoho Sign fetches an access token from your token URL using the Client Credentials grant and sends it as a Bearer token with every request. (OAuth 2.0 and Basic Authentication can't be enabled together.)
  3. Mutual TLS (mTLS) - Authenticate your endpoint using client certificates. Upload either a PEM certificate and private key, or a PFX/P12 bundle (only one format can be active at a time).
  4. Custom Request Headers - Attach custom HTTP headers to every request for additional authentication or routing. You can add up to five headers' names.

Integrity

  1. HMAC signature - Enable HMAC SHA-256 signature verification to authenticate incoming payloads and ensure their integrity. Enter or Generate a secret key; Zoho Sign signs each payload and sends the result in the X-ZS-WEBHOOK-SIGNATURE header. Once configured, the saved secret key cannot be retrieved from Zoho Sign. Keep it safe, as it's required to validate the webhook payload in your application.
  2. Timestamp - Include a timestamp (X-ZS-WEBHOOK-TIMESTAMP header) in each request to help prevent replay attacks.



Webhook payload

  1. For every webhook event, following payload will be triggered.
  2. This payload is a JSON object with two keys, "notifications" and "requests", each internally containing a JSON object.
  3. The notifications object gives details about the action which was performed on the document and the requests object contains the details about the document for which the webhook was called.

Structure

  1. {
  2. "notifications": 
  3. {
  4. "performed_by_email": "<email address of the person performing the operation. ",
  5. "performed_by_name": "<user who performed this operation",
  6. "performed_at": <time value in java current time in mills format>,
  7. "reason": "Reason stated for the operation-applicable if any",
  8. "activity": "<small description of activity performed",
  9. "operation_type": "RequestSubmitted | RequestViewed | RequestSigningSuccess | RequestCompleted | RequestRejected | RequestRecalled | RequestForwarded | RequestExpired",
  10. "action_id": "<sign action id",
  11. "ip_address": "<ip address captured during this operation>"
  12. },
  13. "requests": 
  14. {
  15. "request_status": "<status of the document>",
  16. "request_name": "<name of the sign request>",
  17. "request_id": "<long value - primary key of the signature request",
  18. "document_ids": 
  19. [
  20. {
  21. "document_name": "<name of the document inside signature request",
  22. "document_id": "<long value - of the document contained inside request"
  23. }
  24. ]
  25. }
  26. }
Sample payload:
  1. {
  2. "notifications": 
  3. {
  4. "performed_by_email": "testuser@zoho.com",
  5. "performed_at": 1555062604837,
  6. "reason": "reason given if any",
  7. "activity": "Document has been signed",
  8. "operation_type": "RequestSigningSuccess",
  9. "action_id": "1000000000090",
  10. "performed_by_name": "test user",
  11. "ip_address": "192.168.100.100"
  12. },
  13. "requests": 
  14. {
  15. "request_name": "NDA Document",
  16. "request_id": "1000000000000",
  17. "org_id": "9876543210",
  18. "request_type_id": "10000000011",
  19. "document_ids": 
  20. [
  21. {
  22. "document_name": "CommonNDA.pdf",
  23. "document_id": "100000000000050"
  24. }
  25. ]
  26. }
  27. }
Note:
  1. operation_type attribute under notification JSON object can have one of the following pre-defined constants with which actions are triggered. This attribute plays an important role in identifying the type of event that took place.
Operation Types
Reason for triggering
RequestSubmitted
When a document is submitted for signature.
RequestViewed
When a submitted document is viewed.
RequestSigningSuccess
When one of the signers successfully completes the signing process.
RequestCompleted
When all the assigned signers or approvers completes the signing or approval process.
RequestRejected
When a submitted signature request is rejected.
RequestRecalled
When a submitted signature request is recalled by the sender.
RequestForwarded
When a submitted request is forwarded to another person by the assigned signer.
RequestExpired
When a submitted document expires the allocated signing time.

  1. For signer-related actions, such as RequestViewed, RequestSigningSuccess, RequestRejected, and RequestForwarded, there will be 'action_id' of the signer present inside the 'notifications' json. 
  2. All other data that comes as part of notification payload are not standard data attributes and may be removed anytime in future. Users are advised to use documented attributes alone.