CREATE SUBSCRIPTION
Creates a new subscription for CallFire event notifications
CreateSubscription registers a URI endpoint to start receiving CallFire notification events. the subscriptionId is returned, and it can be used later to query, update, or delete the subscription. The subscriptionId is also returned as part of all notification events.
A URI endpoint will need to be provided that can handle the HTTP notification events coming from CallFire.com.
REQUEST PARAMETERS
Parameter | Data Type | Demo Value | Description |
---|---|---|---|
CreateSubscription | object | Create Subscription using attached info | |
RequestId | anyURI | 1 | Unique ID of web request needed for de-duping |
Subscription | object | Subscribe to a CallFire postback notification event, such as 'textnotification', by registering a callback URI endpoint where events will get published to. | |
Id | long | 123 | Unique ID of Subscription |
Enabled | boolean | true | Enable publishing of postback notifications for subscribed events. |
Endpoint | anyURI | http://www.yourwebsite.com/somephpfile.php | Email or URI endpoint to publish notification event to. |
NotificationFormat | NotificationFormat | XML | [XML, JSON, SOAP, EMAIL] |
TriggerEvent | SubscriptionTriggerEvent | CAMPAIGN_FINISHED | Event to trigger on[UNDEFINED_EVENT, INBOUND_CALL_FINISHED, INBOUND_TEXT_FINISHED, OUTBOUND_CALL_FINISHED, OUTBOUND_TEXT_FINISHED, CAMPAIGN_STARTED, CAMPAIGN_STOPPED, CAMPAIGN_FINISHED] |
SubscriptionFilter | object | Filter the type of notification events published to postback URI endpoint. | |
BroadcastId | long | 123 | Broadcast ID to filter on |
BatchId | long | 123 | Batch ID to filter on |
FromNumber | PhoneNumber | 123 | From number (11 digit) or shortcode to filter on |
ToNumber | List[PhoneNumber] | 13105551212 | E.164 11 digit phone number |
Inbound | boolean | Deprecated, use TriggerEvent |
RESPONSE PARAMETERS
Parameter | Data Type | Description |
---|---|---|
CreatedId | long | Unique ID of resource |
EXAMPLE
using RestSharp;
namespace [your-namespace]
{
public class [your-class]
{
public string CreateSubscription()
{
var client = new RestClient("https://www.callfire.com/api/1.1/rest/");
client.Authenticator = new HttpBasicAuthenticator("YourLoginId", "password");
var request = new RestRequest("subscription", Method.POST);
request.AddParameter("Endpoint", "example@test.com");
request.AddParameter("NotificationFormat", "JSON");
request.AddParameter("TriggerEvent", "INBOUND_CALL_FINISHED");
var response = client.Execute(request);
string content = response.Content;
return content;
}
}
}
The XML returned is:
<?xml version="1.0" encoding="UTF-8"?>
<r:ResourceReference xmlns:r="http://api.callfire.com/resource" xmlns="http://api.callfire.com/data">
<r:Id>222046003</r:Id>
<r:Location>https://www.callfire.com/api/1.1/rest/subscription/222046003</r:Location>
</r:ResourceReference>