Action: Web Hook
When a webhook is configured, Insights will send a POST, with JSON.
Configuration
To configure a web hook, simply add the webhook action to a workflow and then specify the receiving URL. This URL should be accessible publicly. If you'd like to add some kind of authentication to the URL, then we suggest you use a SSL HTTPS url and include the secret in the URL as a parameter, such as https://www.example.com/webhook.php?key=my_secret_key.
Once you've entered the url, you can submit a Test Webhook and log the request in your webhook script.
JSON OBJECT
The JSON will consist of the below information. To see the actual JSON request, we suggest using request.bin, doing a test JSON request and parsing the request using a JSON parser to see a visual representation.
- Event
- name
- id
- timestamp
- attributes
- ...any attributes of the event...
- Standard Subscriber Attributes
- email_address
- opt_status
- ....
- Custom Subscriber Attributes
- first_name
- last_name
- company
- .....
- Standard Owner Attributes (if multi-location framework is turned on)
- Custom Owner Attributes (if multi-location framework is turned on)
PHP Example
<?php $json = file_get_contents('php://input'); $result = json_decode($json, true); print $result[event][name]; // => Visit print $result[personIdentifier]; // => test_user@example.com print $result[standardSubscriberAttributes][opt_status]; // => active print $result[customSubscriberAttributes][first_name]; // => Dan print_r($result); // => see the entire array ?>
ERRORS
Our Webhook system will continue to retry a webhook url that is returning an error based on the below logic
- We will continue to retry for 12hrs or 15 attempts with exponential back-off time period