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 version="1.0" encoding="UTF-8" standalone="yes">
Saved
true
Sample C# Code
Before using this code:
- Download the PostRequest.cs file: here
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 version="1.0" encoding="UTF-8" standalone="yes">
Saved
true
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
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 version="1.0" encoding="UTF-8"?>
111111
22222
2132212289
8778973473
sales number
houston
TRANSFER
35
2010-03-24 15:58:18.0
notes that a call center campaign will add to a call.
additional data uploaded with the phone number
21212
interested
2010-03-24 15:58:38.0
economy
yes
https://www.callfire.com/cloud/1/files/recording/
Sample Text Sent Postback
<?xml version="1.0" encoding="UTF-8"?>
111111
22222
2132212289
88202
sent message
LA
60
2011-06-27 17:18:55.0
Sample Text Reply Postback
<?xml version="1.0" encoding="UTF-8"?>
111111
22222
2132212289
88202
Reply message
2740908
LA
60
2011-06-27 17:18:55.0
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
$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 version="1.0" encoding="UTF-8" standalone="yes">
Saved
true
Sample C# Code
Before using this code:
- Download the PostRequest.cs file: here
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 version="1.0" encoding="UTF-8"?>
22222
My Campaign Name
finished
$2.25
100
100
48
24
12
0
6
10
0
0