What are Webhooks?
Webhooks are a simple, efficient way of integrating with web applications. Instead of polling to see if data has been updated in OnePage, you can register a URL to which we will send POSTs containing the updated data. This has benefits for both sides.
OnePage has to respond to less API requests and you have to send less requests, reducing server load on both ends. Along with this you receive the data the moment it is available, not when you think it should be available.
Activate Webhooks in OnePageCRM
First the OnePage administrator will have to activate Webhooks on the Apps page and configure them by supplying the URL we will send hooks to and optionally add a secretkey.
The secret key will be sent with every POST, to validate that we sent the webhook and not an imposter. For added security it is advised to supply a https instead of http URL.
Configure your application
Now that we send Webhooks you can configure your server to react to the different types of data which we send. We send POSTs whose params contain the following data: a type, reason, secretkey and the data which has been updated.
Element Name | Type | Notes |
timestamp |
int | Sent as unix time (http://en.wikipedia.org/wiki/Unix_time) |
secretkey |
string | If you provided a SecretKey it will be included here, otherwise this field is empty |
data |
hash | A data hash containing the same data as returned from a API call but as a POST parameter body. |
type |
string | What type of data was changed(Contact, Action, Deal etc..) |
reason |
string | What change triggered the Webhook(Created, Deleted, Updated etc..) |
Sample Data
contact
endpoint has a slightly different format than the other endpoints. Please see the sample data.Request Type | Sample Data (json formatted) |
contact |
|
action |
|
deal |
|
note |
Reasons | Description |
Created |
Object has been created. |
Updated |
Object has been updated. |
Deleted |
The object has been deleted. If it can still be undone, then the object data will be sent along, otherwise the data object will only contain the objects id. |
Undeleted |
Contact only: The delete action has been undone and the contact has been reactivated. |
expected_close_time_updated |
Deal only: The expected close date for this deal has been changed. Note: A deal can also be rescheduled in a update POST |
changed_to_pending |
Deal only: The deal has been updated to pending, check the deal_stage param to see at what stage it is. Note: A deal status can also be changed in an update POST |
changed_to_won |
Deal only: The deal has been updated to won. Note: A deal status can also be changed in an update POST |
changed_to_lost |
Deal only: The deal has been updated to lost. Note: A deal status can also be changed in an update POST |
Completed |
Action only: The action has been marked as done. |
Uncompleted |
Action only: The done action has been reopened. |
Testing Webhooks
The easiest way to test the output of your webhooks is to use a service such as RequestBin or Postcatcher.in
These services will give you a URL that will collect requests made to it and let you inspect them in a human-friendly way.