Subscription
Subscriptions provide a way for application developers to receive notifications from CallFire once a monitored event is occurred. The mechanism of callbacks in CallFire API v1.1 called subscriptions.
If you are using CallFire API v2 take a look at Webhooks API which replaced Subscriptions API. You can find an information about their differences and recommendations to use at CallFire Webhooks page.
Subscriptions endpoint
API path: https://www.callfire.com/api/1.1/rest/subscription
All api endpoints return response in XML format by default, to get response in JSON put .json at the end of API path.
Create subscription
- Method: POST
- Request URI: /subscription
This operation registers a URI endpoint to start receiving CallFire notification events on. Returned is the id that can be used later to query, update, or delete the subscription. The id is also returned as part of all notification events as 'subscriptionId'. A URI endpoint will need to be provided that can handle the HTTP notification events coming from CallFire.com
You can find samples of notification payload for different events on Notification samples page.
Limitation: max number of subscriptions - 10.000 per account.
Operation parameters
- Enabled - Enable publishing of postback notifications for subscribed events.
- NonStrictSsl - Enable posting to unknown ssl endpoints (ssl certificate verification will be disabled)
- Endpoint - Email or URI endpoint to publish notification event to
- NotificationFormat - defines callback payload format, available values:
- XML - XML format
- JSON - JSON format
- EMAIL - send notification to email
- SOAP - callback request in SOAP message format
- LEGACY - legacy platform format (deprecated)
- TriggerEvent - Set event to trigger on, possible values:
- INBOUND_CALL_FINISHED
- INBOUND_TEXT_FINISHED
- OUTBOUND_CALL_FINISHED
- OUTBOUND_TEXT_FINISHED
- CAMPAIGN_STARTED
- CAMPAIGN_STOPPED
- CAMPAIGN_FINISHED
- BroadcastId - Broadcast ID to filter on
- BatchId - Batch ID to filter on
- FromNumber - From number (11 digit) or shortcode to filter on
- ToNumber - E.164 11 digit phone number
Example request
$ curl https://www.callfire.com/api/1.1/rest/subscription.json \
-X POST \
-u login:password \
-d Enabled=true \
-d Endpoint=http://customer-service.com/callback \
-d NotificationFormat=JSON \
-d TriggerEvent=OUTBOUND_TEXT_FINISHED \
-d BroadcastId=12345 \
-d ToNumber=67076:KEYWORD
Example response
response code - 201 Created
{
"ResourceReference": {
"Id":609951003,
"Location":"https://www.callfire.com/api/1.1/rest/subscription/609951003"
}
}
Get all account's subscriptions
- Method: GET
- Request URI: /subscription
Return a list of all subscriptions registered to an account.
Operation parameters
- FirstResult - Start of next result set (default: 0)
- MaxResults - Max number of results to return limited to 1000 (default: 1000)
Example request
$ curl https://www.callfire.com/api/1.1/rest/subscription.json?MaxResults=2 \
-u login:password
Example response
response code - 200 OK
{
"ResourceList":{
"@totalResults":2,
"Subscription":[
{
"@id":567040003,
"Enabled":false,
"NonStrictSsl":false,
"NotificationFormat":"EMAIL",
"TriggerEvent":"INBOUND_TEXT_FINISHED",
"SubscriptionFilter":{
"ToNumber":"67076:ANTLR"
}
},
{
"@id":609076003,
"Enabled":true,
"NonStrictSsl":false,
"Endpoint":"http://79b55ae6.ngrok.io",
"NotificationFormat":"JSON",
"TriggerEvent":"OUTBOUND_TEXT_FINISHED",
"SubscriptionFilter":{
}
}
]
}
}
Get single subscription
- Method: GET
- Request URI: /subscription/{id}
Return a subscription registered to an account using id returned from CreateSubscription request
Operation parameters
- Id - Unique ID of resource
Example request
$ curl https://www.callfire.com/api/1.1/rest/subscription/6090706003.json \
-u login:password
Example response
response code - 200 OK
{
"Resource":{
"Subscription":{
"@id":609076003,
"Enabled":true,
"NonStrictSsl":false,
"Endpoint":"http://79b44ae6.ngrok.io",
"NotificationFormat":"JSON",
"TriggerEvent":"OUTBOUND_TEXT_FINISHED",
"SubscriptionFilter":{
}
}
}
}
Update subscription
- Method: PUT
- Request URI: /subscription/{id}
Update existing subscription by ID. Use this to enable or disable notification events, change the notification endpoint URI, or change the filtering so only receive notification for a subset of events.
Operation parameters
- Id - Unique ID of resource
- Enabled - Enable publishing of postback notifications for subscribed events.
- NonStrictSsl - Enable posting to unknown ssl endpoints (ssl certificate verification will be disabled)
- Endpoint - Email or URI endpoint to publish notification event to
- NotificationFormat - defines callback payload format, available values:
- XML - XML format
- JSON - JSON format
- EMAIL - send notification to email
- SOAP - callback request in SOAP message format
- LEGACY - legacy platform format (deprecated)
- TriggerEvent - Set event to trigger on, possible values:
- INBOUND_CALL_FINISHED
- INBOUND_TEXT_FINISHED
- OUTBOUND_CALL_FINISHED
- OUTBOUND_TEXT_FINISHED
- CAMPAIGN_STARTED
- CAMPAIGN_STOPPED
- CAMPAIGN_FINISHED
- BroadcastId - Broadcast ID to filter on
- BatchId - Batch ID to filter on
- FromNumber - From number (11 digit) or shortcode to filter on
- ToNumber - E.164 11 digit phone number
Example request
$ curl https://www.callfire.com/api/1.1/rest/subscription/609951003.json \
-X PUT \
-u login:password \
-d Enabled=false \
-d Endpoint=http://new-service.com/callback \
-d NotificationFormat=XML
Example response
response code - 204 No content
Delete subscription
- Method: DELETE
- Request URI: /subscription/{id}
Delete subscription to stop receiving CallFire notification events at the registered URI postback endpoint.
Operation parameters
- Id - Unique ID of resource
Example request
$ curl https://www.callfire.com/api/1.1/rest/subscription/6090706003.json \
-X DELETE \
-u login:password
Example response
response code - 204 No content