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.
- Jump to Method
- ADD methods
- Campaign Reports
Call Reports
Subscribe to Call Reports
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
Parameter name | Required | Description |
---|---|---|
apikey | Y | The API key that is registered with your account |
postUrl | Y | The postback URL |
Example Response
xml | |
---|---|
<?xml version="1.0" encoding="UTF-8" standalone="yes"> | |
<reportresponse> | |
<description>Saved</description> | |
<success>true</success> | |
</reportresponse> |
Sample C# Code
Before using this code:
- Download the PostRequest.cs file: here
csharp | |
---|---|
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); |
Subscribe to Call Reports for a Single Campaign
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
Parameter name | Required | Description |
---|---|---|
apikey | Y | The API key that is registered with your account |
postUrl | Y | The postback URL |
Example Response
xml | |
---|---|
<?xml version="1.0" encoding="UTF-8" standalone="yes"> | |
<reportresponse> | |
<description>Saved</description> | |
<success>true</success> | |
</reportresponse> |
Sample C# Code
Before using this code:
- Download the PostRequest.cs file: here
- Replace the {campaignid} in the code given below with your campaign id
csharp | |
---|---|
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); |
Call Finish Postback
Sample Call Postback
xml | |
---|---|
<?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 | |
---|---|
<?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> | |
</recordings></stored-data></extra-data></notes></call-finished> |
Sample Text Reply Postback
xml | |
---|---|
<?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> | |
</recordings></stored-data></extra-data></notes></call-finished> |
Parsing Call Reports
CallFire will post pure XML to your server. You could parse results using the following snippet of php.
Sample PHP Code
php | |
---|---|
<?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; | |
?> |
Campaign Reports
Subscribe to Campaigns Finished
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
Parameter name | Required | Description |
---|---|---|
apikey | Y | The API key that is registered with your account |
postUrl | Y | The postback URL |
Example Response
xml | |
---|---|
<?xml version="1.0" encoding="UTF-8" standalone="yes"> | |
<reportresponse> | |
<description>Saved</description> | |
<success>true</success> | |
</reportresponse> |
Sample C# Code
Before using this code:
- Download the PostRequest.cs file: here
csharp | |
---|---|
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); |
Campaign Finished Postback
xml | |
---|---|
<?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> |