GET CONTACT HISTORY

Gets a contact's history by contact id

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

REQUEST PARAMETERS

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

RESPONSE PARAMETERS

Parameter Data Type Description
ContactHistory List Calls or Texts associated with Contact
Call Call Information
Id long Unique ID of action
FromNumber PhoneNumber E.164 11 digit number or short code
ToNumber List[PhoneNumber] List of E.164 11 digit numbers space seperated
State ActionState Current State of Action[READY, SELECTED, CALLBACK, FINISHED, DNC, DUP, INVALID, TIMEOUT]
BatchId long Unique ID of Batch associated with Action
BroadcastId long Unique ID of Broadcast associated with Action
ContactId long Unique ID of Contact associated with Action
Inbound boolean Is inbound Action
Created dateTime DateTime Action was created 'CCYY-MM-DDThh:mm:ss[Z(+/-)hh:mm]'
Modified dateTime DateTime Action was modified 'CCYY-MM-DDThh:mm:ss[Z(+/-)hh:mm]'
FinalResult 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]
Label
Name string
CallRecord
Id long
Result 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]
FinishTime dateTime DateTime action finished in 'CCYY-MM-DDThh:mm:ss[Z(+/-)hh:mm]' format
BilledAmount float Credits charged for call or text
QuestionResponse Question / Response pair defined in IVR campaign with ['stash'] (https://www.callfire.com/help/docs/callfire-xml/tags/stash).
Question string IVR stash 'varname'
Response string IVR stash value associated with 'varname'
OriginateTime dateTime
AnswerTime dateTime
Duration int Duration of call in seconds
RecordingMeta Recordings are audio recorded during a call.
Id long
Name string
Created dateTime
LengthInSeconds int
Link string
Text
Id long Unique ID of action
FromNumber PhoneNumber E.164 11 digit number or short code
ToNumber List[PhoneNumber] List of E.164 11 digit numbers space seperated
State ActionState Current State of Action [READY, SELECTED, CALLBACK, FINISHED, DNC, DUP, INVALID, TIMEOUT]
BatchId long Unique ID of Batch associated with Action
BroadcastId long Unique ID of Broadcast associated with Action
ContactId long Unique ID of Contact associated with Action
Inbound boolean Is inbound Action
Created dateTime DateTime Action was created 'CCYY-MM-DDThh:mm:ss[Z(+/-)hh:mm]'
Modified dateTime DateTime Action was modified 'CCYY-MM-DDThh:mm:ss[Z(+/-)hh:mm]'
FinalResult 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]
Label
Name string
Message string
TextRecord
Id long
Result 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]
FinishTime dateTime DateTime action finished in 'CCYY-MM-DDThh:mm:ss[Z(+/-)hh:mm]' format
BilledAmount float Credits charged for call or text
QuestionResponse Question / Response pair defined in IVR campaign with ['stash'] (https://www.callfire.com/help/docs/callfire-xml/tags/stash) .
Question string IVR stash 'varname'
Response string IVR stash value associated with 'varname'
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>