CallFire Solutions

Get Contact History

Follow

GET CONTACT HISTORY

Gets a contact's history by contact id

This operation lists all calls and texts associated with a contact.

REQUEST PARAMETERS

ParameterDemo ValueDescriptionData Type
GetContactHistory   ContactHistory request by unique ID object
MaxResults Max number of results to return limited to 1000 (default: 1000) long
FirstResult Start of next result set (default: 0) long
ContactId Contact to get history long

RESPONSE PARAMETERS

ParameterDescriptionData Type
ContactHistory List Calls or Texts associated with Contact  
Call Call Information  
Id Unique ID of action long
FromNumber E.164 11 digit number or short code PhoneNumber
ToNumber List of E.164 11 digit numbers space seperated List[PhoneNumber]
State Current State of Action[READY, SELECTED, CALLBACK, FINISHED, DNC, DUP, INVALID, TIMEOUT] ActionState
BatchId Unique ID of Batch associated with Action long
BroadcastId Unique ID of Broadcast associated with Action long
ContactId Unique ID of Contact associated with Action long
Inbound Is inbound Action boolean
Created DateTime Action was created 'CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]' dateTime
Modified DateTime Action was modified 'CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]' dateTime
FinalResult [LA, AM, BUSY, DNC, XFER, XFER_LEG, NO_ANS, UNDIALED, SENT, RECEIVED, DNT, TOO_BIG, INTERNAL_ERROR, CARRIER_ERROR, CARRIER_TEMP_ERROR, SD, POSTPONED] Result
Label    
Name   string
CallRecord    
Id   long
Result [LA, AM, BUSY, DNC, XFER, XFER_LEG, NO_ANS, UNDIALED, SENT, RECEIVED, DNT, TOO_BIG, INTERNAL_ERROR, CARRIER_ERROR, CARRIER_TEMP_ERROR, SD, POSTPONED] Result
FinishTime DateTime action finished in 'CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]' format dateTime
BilledAmount Credits charged for call or text float
QuestionResponse Question / Response pair defined in IVR campaign with 'stash'.  
Question IVR stash 'varname' string
Response IVR stash value associated with 'varname' string
OriginateTime   dateTime
AnswerTime   dateTime
Duration Duration of call in seconds int
RecordingMeta Recordings are audio recorded during a call.  
Id   long
Name   string
Created   dateTime
LengthInSeconds   int
Text    
Id Unique ID of action long
FromNumber E.164 11 digit number or short code PhoneNumber
ToNumber List of E.164 11 digit numbers space seperated List[PhoneNumber]
State Current State of Action[READY, SELECTED, CALLBACK, FINISHED, DNC, DUP, INVALID, TIMEOUT] ActionState
BatchId Unique ID of Batch associated with Action long
BroadcastId Unique ID of Broadcast associated with Action long
ContactId Unique ID of Contact associated with Action long
Inbound Is inbound Action boolean
Created DateTime Action was created 'CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]' dateTime
Modified DateTime Action was modified 'CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]' dateTime
FinalResult [LA, AM, BUSY, DNC, XFER, XFER_LEG, NO_ANS, UNDIALED, SENT, RECEIVED, DNT, TOO_BIG, INTERNAL_ERROR, CARRIER_ERROR, CARRIER_TEMP_ERROR, SD, POSTPONED] Result
Label    
Name   string
Message   string
TextRecord    
Id   long
Result [LA, AM, BUSY, DNC, XFER, XFER_LEG, NO_ANS, UNDIALED, SENT, RECEIVED, DNT, TOO_BIG, INTERNAL_ERROR, CARRIER_ERROR, CARRIER_TEMP_ERROR, SD, POSTPONED] Result
FinishTime DateTime action finished in 'CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]' format dateTime
BilledAmount Credits charged for call or text float
QuestionResponse Question / Response pair defined in IVR campaign with 'stash'.  
Question IVR stash 'varname' string
Response IVR stash value associated with 'varname' string
Message   string

EXAMPLE

In this example we are requesting all calls and texts associated to the contact identified by '169915679001'. We are also limiting the results to up to 10 - the default is 1000 - and the first result returned will be the fifth (5) - the default is 0.


using RestSharp;

namespace [your-namespace]
{
    public class [your-class]
    {
        public string GetContactHistory()
        {
            long contactId = 1428507003; // Your Contact Id here

            var client = new RestClient("https://www.callfire.com/api/1.1/rest/");
            client.Authenticator = new HttpBasicAuthenticator("YourLoginId", "password");

            var request = new RestRequest(string.Format("contact/{0}/history", contactId), Method.GET);
            request.AddParameter("MaxResults", "10");
            request.AddParameter("FirstResult", "5");

            var response = client.Execute(request);
            string content = response.Content;
            return content;
        }
    }
}

Response Parameters

The contact has calls and texts

Response Code: 200

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<r:Resource xmlns="http://api.callfire.com/data" xmlns:r="http://api.callfire.com/resource">

   <ContactHistory>

      <Call id="228182415001">

          <FromNumber>12132609784</FromNumber>

          <ToNumber campaign-sound="459768001" context="cf3-record">19196991764</ToNumber>

          <State>FINISHED</State>

          <BroadcastId>1836940001</BroadcastId>

          <ContactId>169915679001</ContactId>

          <Inbound>false</Inbound>

          <Created>2014-06-23T18:30:58Z</Created>

          <Modified>2014-06-23T18:31:46Z</Modified>

          <FinalResult>LA</FinalResult>

          <CallRecord id="137408795001">

             <Result>LA</Result>

             <FinishTime>2014-06-23T18:31:46Z</FinishTime>

             <BilledAmount>0.0</BilledAmount>

             <OriginateTime>2014-06-23T18:30:58Z</OriginateTime>

             <AnswerTime>2014-06-23T18:31:26Z</AnswerTime>

             <Duration>20</Duration>

          </CallRecord>

      </Call>

      <Text id="225956502001">

             <FromNumber>67076</FromNumber>

             <ToNumber>19196991764</ToNumber>

             <State>READY</State>

             <BatchId>1203687001</BatchId>

             <BroadcastId>1956159001</BroadcastId>

             <ContactId>169915679001</ContactId>

             <Inbound>false</Inbound>

             <Created>2014-06-19T14:36:08Z</Created>

             <Modified>2014-06-19T14:36:08Z</Modified>

      </Text>

   </ContactHistory>

</r:Resource>

In this case the contact has one call and one text.

The contact has an empty history

Response Code: 200

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<r:Resource xmlns="http://api.callfire.com/data" xmlns:r="http://api.callfire.com/resource">

   <ContactHistory/>

</r:Resource>

Have more questions? Submit a request

Comments