Contents |
This rest api will enable reports to be sent (via file stream) back to your server. You can subscribe to call finishes and campaign finishes.
CallFire can POST raw XML to your site after any calls or texts that occur on your account.
You can subscribe to these posts via the CallFire website or by using this API.
To enable CallFire CallBacks for all calls using the website visit your Account Settings page and look for the following settings (be sure to grab an API key first):
You can also use the API to subscribe and unsubscribe dynamically.
URL
https://www.callfire.com/cloud/1/reports/callback/callfinish
HTTP Method
POST
Content Type
text/plain or application/x-www-form-urlencoded
Parameters
- apikey: Required. This is your account api key.
- postUrl: The postback URL
Response
Content-Type = application/xml
<?xml version="1.0" encoding="UTF-8" standalone="yes">
<reportResponse>
<description>Saved</description>
<success>true</success>
</reportResponse>
Before using this code:
PostSubmitter post = new PostSubmitter();
post.Url = "https://www.callfire.com/cloud/1/reports/callback/callfinish";
post.PostItems.Add("apikey", "YOUR_API_KEY");
post.PostItems.Add("postUrl", "ENTER_THE_POST_BACK_URL");
post.Type = PostSubmitter.PostTypeEnum.Post;
string result = post.Post();
Console.WriteLine("Result is");
Console.WriteLine(result);
Use this API and CallFire can send call-finished XML to be 'POST'ed to your site for a campaign specified only. You can have different location for different campaigns.
URL
https://www.callfire.com/cloud/1/reports/callback/callfinish/{campaignid}
HTTP Method
POST
Content Type
text/plain or application/x-www-form-urlencoded
Parameters
- apikey: Required. This is your account api key.
- postUrl: The postback URL
Response
Content-Type = application/xml
<?xml version="1.0" encoding="UTF-8" standalone="yes">
<reportResponse>
<description>Saved</description>
<success>true</success>
</reportResponse>
Before using this code:
PostSubmitter post = new PostSubmitter();
post.Url = "https://www.callfire.com/cloud/1/reports/callback/callfinish/{campaignid}";
post.PostItems.Add("apikey", "YOUR_API_KEY");
post.PostItems.Add("postUrl", "ENTER_THE_POST_BACK_URL");
post.Type = PostSubmitter.PostTypeEnum.Post;
string result = post.Post();
Console.WriteLine("Result is");
Console.WriteLine(result);
Sample Call Postback
<?xml version="1.0" encoding="UTF-8"?> <call-finished> <callid>111111</callid> <campaignid>22222</campaignid> <phonenumber>2132212289</phonenumber> <dnis>8778973473</dnis> <tags> <tag>sales number</tag> <tag>houston</tag> </tags> <disposition>TRANSFER</disposition> <duration>35</duration> <callstart>2010-03-24 15:58:18.0</callstart> <notes> notes that a call center campaign will add to a call. </notes> <extra-data> additional data uploaded with the phone number </extra-data> <agentid>21212</agentid> <agentresponse>interested</agentresponse> <responsetime>2010-03-24 15:58:38.0</responsetime> <stored-data> <var name="bigconcern">economy</var> <var name="willvote">yes</var> </stored-data> <recordings> <file> https://www.callfire.com/cloud/1/files/recording/ </file> </recordings> </call-finished>
Sample Text Sent Postback
<?xml version="1.0" encoding="UTF-8"?> <call-finished> <callid>111111</callid> <campaignid>22222</campaignid> <phonenumber>2132212289</phonenumber> <dnis>88202</dnis> <smsSent>sent message</smsSent> <disposition>LA</disposition> <duration>60</duration> <callstart>2011-06-27 17:18:55.0</callstart> <notes/> <extra-data/> <stored-data/> <recordings/> </call-finished>
Sample Text Reply Postback
<?xml version="1.0" encoding="UTF-8"?> <call-finished> <callid>111111</callid> <campaignid>22222</campaignid> <phonenumber>2132212289</phonenumber> <dnis>88202</dnis> <smsReceived>Reply message</smsReceived> <replyFromCampaign>2740908</replyFromCampaign> <disposition>LA</disposition> <duration>60</duration> <callstart>2011-06-27 17:18:55.0</callstart> <notes/> <extra-data/> <stored-data/> <recordings/> </call-finished>
CallFire will post pure XML to your server. You could parse results using the following snippet of php.
<?
$inputSocket = fopen('php://input','rb');
$contents = stream_get_contents($inputSocket);
fclose($inputSocket);
$xml = simplexml_load_string($contents);
$callstart = $xml->callstart;
$phonenumber = $xml->phonenumber;
$disposition = $xml->disposition;
// for anything that was "stash"ed from IVR campaigns
foreach ($xml->stored-data->var as $var) {
$varName = $var['name'];
$varValue = $var;
}
// for sms replies
if (isset($xml->smsReceived))
$smsReply = $xml->smsReceived;
?>
Use this and CallFire will POST campaign-finished XML to your site.
URL
https://www.callfire.com/cloud/1/reports/callback/campaignfinish
HTTP Method
POST
Content Type
text/plain or application/x-www-form-urlencoded
Parameters
- apikey: Required. This is your account api key.
- postUrl: The postback URL
Response
Content-Type = application/xml
<?xml version="1.0" encoding="UTF-8" standalone="yes">
<reportResponse>
<description>Saved</description>
<success>true</success>
</reportResponse>
Before using this code:
PostSubmitter post = new PostSubmitter();
post.Url = "https://www.callfire.com/cloud/1/reports/callback/campaignfinish";
post.PostItems.Add("apikey", "YOUR_API_KEY");
post.PostItems.Add("postUrl", "ENTER_THE_POST_BACK_URL");
post.Type = PostSubmitter.PostTypeEnum.Post;
string result = post.Post();
Console.WriteLine("Result is");
Console.WriteLine(result);
<?xml version="1.0" encoding="UTF-8"?> <campaign-finished> <campaign> <id>22222</id> <name>My Campaign Name</name> <status>finished</status> <cost>$2.25</cost> <campaign-stats> <total>100</total> <dialed>100</dialed> <live>48</live> <machine>24</machine> <noanswer>12</noanswer> <dnc>0</dnc> <busy>6</busy> <transfer>10</transfer> <error>0</error> <misc>0</misc> </campaign-stats> </campaign> </campaign-finished>
