Create new subscription¶
POST https://api.copper.com/developer_api/v1/webhooks
Parameters¶
Field | Type | Details |
---|---|---|
Required Parameters | ||
target | string | The URL of your webhook endpoint. Must be a valid URL. |
type | string | The entity type that this subscription is for. Valid values are: "lead", "person", "company", "opportunity", "project", "task". |
event | string | The event that will trigger notifications for this subscription. Valid values are: "new", "update", "delete". |
Optional Parameters | ||
secret | object | Custom key/value pairs that are sent with every notification. Using this secret, your notification endpoint can authenticate the request to make sure it is coming from a trusted source. |
headers | object | Custom HTTP headers that are sent with every notification. |
custom_field_computed_values | boolean | If provided and set to true, dropdown custom fields (standard and multi-select) will have their option_ids converted to the option names. |
See the Webhook properties section for more details.
This example shows the creation of a new subscription for events when existing Leads are updated.
Request body¶
{
"target": "https://your.endpoint.here",
"type": "lead",
"event": "update",
"secret": {
"secret": "hook_source",
"key": "copper_notifications"
},
"headers": {
"Authentication": "Bearer token"
},
"custom_field_computed_values": true
}
Example Requests¶
Create subscription¶
curl --location --request POST "https://api.copper.com/developer_api/v1/webhooks" \
--header "X-PW-AccessToken: YOUR_TOKEN_HERE" \
--header "X-PW-Application: developer_api" \
--header "X-PW-UserEmail: YOUR_EMAIL_HERE" \
--header "Content-Type: application/json" \
--data "{
\"target\": \"https://your.endpoint.here\",
\"type\": \"lead\",
\"event\": \"update\",
\"secret\": {
\"secret\": \"hook_source\",
\"key\": \"copper_notifications\"
},
\"headers\": {
\"Authentication\": \"Bearer token\",
},
\"custom_field_computed_values\": false,
}"
{
"id": 17065,
"target": "https://your.endpoint.here",
"type": "lead",
"event": "update",
"secret": {
"secret": "hook_source",
"key": "copper_notifications"
},
"headers": {
"Authentication": "Bearer token"
},
"custom_field_computed_values": false,
"created_at": 1489173015
}
{
"success": false,
"status": 422,
"message": "Invalid input: Invalid URI For External Request"
}