PactSafe

The PactSafe Developer Hub

Welcome to the PactSafe developer hub. You'll find comprehensive guides and documentation to help you start working with PactSafe as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Guides

Working with PactSafe Webhooks

With PactSafe, you can setup Webhooks to notify any third party system of major events that you can configure through Integrations. If you don't have Integrations enabled in your account, please contact help@pactsafe.com and we'll help you out!

Here's a view of how Webhooks are managed from within the PactSafe interface.

Should I do HTTP GET or POST?

Up to you. We will pass parameters for the Webhook as Querystring variables in GET and the request body with POST. The examples for this Guide are POST.

What's the "Secret Code"?

The secret code allows you to create a more secure connection to the Webhook. We'll pass the secret code in an HTTP Header called Pactsafe-Webhook-Token.

Example Payloads

There are 6 types of events you can configure for when setting up webhooks. Each event has some common properties and some properties unique to the Webhook. We'll outline an example payload for each Webhook below.

Test Webhook

You can test your webhook prior to saving it to ensure you've set things up properly on your end. Here's the payload for an example of the Test:

HTTP Headers:

Cf-Ray: 380ef90f28072156-EWR
Cf-Ipcountry: US
Pactsafe-Webhook-Token: 12345
Content-Type: application/json
Connection: close
Via: 1.1 vegur
Total-Route-Time: 0
X-Request-Id: dddaef54-ad14-427c-aa8d-4d20175135be
Connect-Time: 0
Content-Length: 324
Accept: application/json
Cf-Connecting-Ip: 50.16.30.147
Host: requestb.in
Cf-Visitor: {"scheme":"https"}
Accept-Encoding: gzip

Webhook Payload (body):

{
  "type": "webhook",
  "integration": "596f854922d3a615b6dce9f7",
  "sent_to": "https://requestb.in/xy5t8exy",
  "event_type": "test_event",
  "description": "PactSafe sent a test event!",
  "site": 2,
  "user": 45,
  "updated_time": "2017-07-19T16:14:17.421Z",
  "created_time": "2017-07-19T16:14:17.420Z",
  "deliverable": true,
  "id": "596f8559b2023107ce3e0da6"
}

Version Published

This Webhook will fire when a new Version of a Contract is published either from the PactSafe Dashboard or via the REST API:

HTTP Headers:

Cf-Ray: 380efa071e4c0785-EWR
Cf-Ipcountry: US
Pactsafe-Webhook-Token: 12345
Content-Type: application/json
Connection: close
Via: 1.1 vegur
Total-Route-Time: 0
X-Request-Id: 847e586f-22a9-4cbd-8429-ad710c86882f
Connect-Time: 1
Content-Length: 409
Accept: application/json
Cf-Connecting-Ip: 50.16.101.133
Host: requestb.in
Cf-Visitor: {"scheme":"https"}
Accept-Encoding: gzip

Webhook Payload (body):

Note: version is the Version ID of the Contract. Contract ID is passed in contract.

{
   "type":"webhook",
   "integration":"596f854922d3a615b6dce9f7",
   "sent_to":"https://requestb.in/xy5t8exy",
   "event_type":"version_published",
   "description":"PactSafe published version 3.0 of \"E-Waiver Form\"",
   "site":2,
   "version":"596ce71022d3a615b6d94345",
   "contract":11602,
   "user":45,
   "updated_time":"2017-07-19T16:14:57.090Z",
   "created_time":"2017-07-19T16:14:57.088Z",
   "deliverable":true,
   "id":"596f858184281715b3493651"
}

Request Sent

This Webhook will fire when a new Request is sent for execution either from the PactSafe Dashboard or via the REST API:

HTTP Headers:

Cf-Ray: 380efa071e4c0785-EWR
Cf-Ipcountry: US
Pactsafe-Webhook-Token: 12345
Content-Type: application/json
Connection: close
Via: 1.1 vegur
Total-Route-Time: 0
X-Request-Id: 847e586f-22a9-4cbd-8429-ad710c86882f
Connect-Time: 1
Content-Length: 409
Accept: application/json
Cf-Connecting-Ip: 50.16.101.133
Host: requestb.in
Cf-Visitor: {"scheme":"https"}
Accept-Encoding: gzip

Webhook Payload (body):

Note: request is the Request ID of the Request.

{
   "type":"webhook",
   "integration":"596f854922d3a615b6dce9f7",
   "sent_to":"https://requestb.in/xy5t8exy",
   "event_type":"request_sent",
   "description":"PactSafe sent \"Example Contract\"",
   "site":2,
   "request":"596f858584281715b3493d0c",
   "activity": "5a26bbf9e623117c2a6eed1b",
   "user":45,
   "updated_time":"2017-07-19T16:15:28.510Z",
   "created_time":"2017-07-19T16:15:28.509Z",
   "deliverable":true,
   "id":"596f85a084281715b349513f"
}

Activity (All)

This Webhook will fire when any Activity is logged in our system. Examples would be activity_visited (a Signer visits/"opens" a Request signing page), activity_displayed (when a displayed event is logged via our JavaScript library), activity_agreed (whan a user accepts a contract via our JavaScript Library, sending via our Activity API, or when someone clicks "Agree" on a Request signing page):

HTTP Headers:

Cf-Ray: 380efa071e4c0785-EWR
Cf-Ipcountry: US
Pactsafe-Webhook-Token: 12345
Content-Type: application/json
Connection: close
Via: 1.1 vegur
Total-Route-Time: 0
X-Request-Id: 847e586f-22a9-4cbd-8429-ad710c86882f
Connect-Time: 1
Content-Length: 409
Accept: application/json
Cf-Connecting-Ip: 50.16.101.133
Host: requestb.in
Cf-Visitor: {"scheme":"https"}
Accept-Encoding: gzip

Webhook Payload (body):

Payload for activity_visited on a Request, which includes revision ID which you can call via the REST API:

{
   "type":"webhook",
   "integration":"596f854922d3a615b6dce9f7",
   "sent_to":"https://requestb.in/xy5t8exy",
   "event_type":"activity_visited",
   "description":"Eric Prugh (Eric@pactsafe.com) visited \"Mutual NDA\" in Request \"Example Contract\"",
   "site":2,
   "request":"596f858584281715b3493d0c",
   "activity": "5a26bbf9e623117c2a6eed1b",
   "contract":11501,
   "version":"593acfac79858610b032bf25",
   "revision":"596f858d22d3a615b6dcfad0",
   "updated_time":"2017-07-19T16:15:40.078Z",
   "created_time":"2017-07-19T16:15:40.078Z",
   "deliverable":true,
   "id":"596f85ac84281715b3495145"
}

Payload for activity_agreed on a Request, which includes revision ID which you can call via the REST API:

{
   "type":"webhook",
   "integration":"596f854922d3a615b6dce9f7",
   "sent_to":"https://requestb.in/xy5t8exy",
   "event_type":"activity_agreed",
   "description":"Eric Prugh (Eric@pactsafe.com) agreed to \"Mutual NDA\" in Request \"Example Contract\"",
   "site":2,
   "request":"596f858584281715b3493d0c",
   "contract":11501,
   "version":"593acfac79858610b032bf25",
   "revision":"596f858d22d3a615b6dcfad0",
   "activity": "5a26bbf9e623117c2a6eed1b",
   "updated_time":"2017-07-19T16:15:43.457Z",
   "created_time":"2017-07-19T16:15:43.456Z",
   "deliverable":true,
   "id":"596f85af22d3a615b6dcfe2e",
   "render_data": {
      "Salesforce.Amount": "$100.00"
   },
   "fields": {
      "first_name": "Eric",
      "last_name": "Prugh"
   }
}

Payload for activity_displayed from a Click-through agreement using our JavaScript library:

{
   "type":"webhook",
   "integration":"596f854922d3a615b6dce9f7",
   "sent_to":"https://requestb.in/xy5t8exy",
   "event_type":"activity_displayed",
   "description":"Eric Prugh (eric@pactsafe.com) viewed \"E-Waiver Form\" in Group \"UGC Consent Waiver\"",
   "site":2,
   "group":544,
   "contract":11602,
   "version":"596ce71022d3a615b6d94345",
   "activity": "5a26bbf9e623117c2a6eed1b",
   "updated_time":"2017-07-19T17:04:52.628Z",
   "created_time":"2017-07-19T17:04:52.627Z",
   "deliverable":true,
   "id":"596f913484281715b3498591"
}

Payload for activity_agreed from a Click-through agreement using our JavaScript library:

{
   "type":"webhook",
   "integration":"596f854922d3a615b6dce9f7",
   "sent_to":"https://requestb.in/xy5t8exy",
   "event_type":"activity_agreed",
   "description":"Eric Prugh (eric@pactsafe.com) agreed to \"E-Waiver Form\" in Group \"UGC Consent Waiver\"",
   "site":2,
   "group":544,
   "contract":11602,
   "version":"596ce71022d3a615b6d94345",
   "activity": "5a26bbf9e623117c2a6eed1b",
   "updated_time":"2017-07-19T17:04:53.524Z",
   "created_time":"2017-07-19T17:04:53.523Z",
   "deliverable":true,
   "id":"596f913584281715b3498592",
   "render_data": {
      "Salesforce.Amount": "$100.00"
   },
   "fields": {
      "first_name": "Eric",
      "last_name": "Prugh"
   }
}

Activity (Agreed)

This Webhook will only fire when an agreed Actvity has been processed. agreed Activities are fired when a user clicks "Agree" inside a Request or checks a box as part of a click-through agreement.

Note: Information rendered on the agreement is processed as render_data and fields filled in a contract are fields. Also please note that render_data and fields are only passed on POST requests because of the potential size they make the payload.

This hook is the same as above:

HTTP Headers:

Cf-Ray: 380efa071e4c0785-EWR
Cf-Ipcountry: US
Pactsafe-Webhook-Token: 12345
Content-Type: application/json
Connection: close
Via: 1.1 vegur
Total-Route-Time: 0
X-Request-Id: 847e586f-22a9-4cbd-8429-ad710c86882f
Connect-Time: 1
Content-Length: 409
Accept: application/json
Cf-Connecting-Ip: 50.16.101.133
Host: requestb.in
Cf-Visitor: {"scheme":"https"}
Accept-Encoding: gzip

Webhook Payload (body):

{
   "type":"webhook",
   "integration":"596f854922d3a615b6dce9f7",
   "sent_to":"https://requestb.in/xy5t8exy",
   "event_type":"activity_agreed",
   "description":"Eric Prugh (eric@pactsafe.com) agreed to \"E-Waiver Form\" in Group \"UGC Consent Waiver\"",
   "site":2,
   "group":544,
   "contract":11602,
   "version":"596ce71022d3a615b6d94345",
   "activity": "5a26bbf9e623117c2a6eed1b",
   "updated_time":"2017-07-19T17:04:53.524Z",
   "created_time":"2017-07-19T17:04:53.523Z",
   "deliverable":true,
   "id":"596f913584281715b3498592",
   "render_data": {
      "Salesforce.Amount": "$100.00"
   },
   "fields": {
      "first_name": "Eric",
      "last_name": "Prugh"
   }
}

Request Signed

This Webhook will fire when a new Request is signed by one of the parties. This webhook is fired for every signature on the Request, including if the final signer has signed:

HTTP Headers:

Cf-Ray: 380efa071e4c0785-EWR
Cf-Ipcountry: US
Pactsafe-Webhook-Token: 12345
Content-Type: application/json
Connection: close
Via: 1.1 vegur
Total-Route-Time: 0
X-Request-Id: 847e586f-22a9-4cbd-8429-ad710c86882f
Connect-Time: 1
Content-Length: 409
Accept: application/json
Cf-Connecting-Ip: 50.16.101.133
Host: requestb.in
Cf-Visitor: {"scheme":"https"}
Accept-Encoding: gzip

Webhook Payload (body):

Note: request is the Request ID of the Request.

{
   "type":"webhook",
   "integration":"596f854922d3a615b6dce9f7",
   "sent_to":"https://requestb.in/xy5t8exy",
   "event_type":"request_signed",
   "description":"Eric Prugh signed \"Example Contract\"",
   "site":2,
   "request":"596f858584281715b3493d0c",
   "activity": "5a26bbf9e623117c2a6eed1b",
   "signer":"58001ea30c7ffa3111e9fa48",
   "updated_time":"2017-07-19T16:15:43.513Z",
   "created_time":"2017-07-19T16:15:43.512Z",
   "deliverable":true,
   "id":"596f85af84281715b3495147"
}

Request Complete

This Webhook will fire when a new Request is complete by all of the parties. This webhook is fired one time per Request:

HTTP Headers:

Cf-Ray: 380efa071e4c0785-EWR
Cf-Ipcountry: US
Pactsafe-Webhook-Token: 12345
Content-Type: application/json
Connection: close
Via: 1.1 vegur
Total-Route-Time: 0
X-Request-Id: 847e586f-22a9-4cbd-8429-ad710c86882f
Connect-Time: 1
Content-Length: 409
Accept: application/json
Cf-Connecting-Ip: 50.16.101.133
Host: requestb.in
Cf-Visitor: {"scheme":"https"}
Accept-Encoding: gzip

Webhook Payload (body):

Note: request is the Request ID of the Request.

Another Note: Information rendered on the agreement is processed as render_data and fields filled in a contract are fields. Also please note that render_data and fields are only passed on POST requests because of the potential size they make the payload.

{
   "type":"webhook",
   "integration":"596f854922d3a615b6dce9f7",
   "sent_to":"https://requestb.in/xy5t8exy",
   "event_type":"request_complete",
   "description":"\"Example Contract\" has been completed",
   "site":2,
   "request":"596f858584281715b3493d0c",
   "activity": "5a26bbf9e623117c2a6eed1b",
   "updated_time":"2017-07-19T16:15:43.521Z",
   "created_time":"2017-07-19T16:15:43.520Z",
   "deliverable":true,
   "id":"596f85af22d3a615b6dcfe2f",
   "render_data": {
      "Salesforce.Amount": "$100.00"
   },
   "fields": {
      "first_name": "Eric",
      "last_name": "Prugh"
   }
}