Skip to content

getCallLog

This interface retrieves a previously logged call log record in the target CRM. This information is used to render a form to allow an end user to view or edit that record within the App Connect client.

Request parameters

Parameter Description
user TODO
callLogId The ID of the activity or call log record within the CRM.
authHeader The HTTP Authorization header to be transmitted with the API request to the target CRM.

Return value(s)

This interface should return the associated call log record in a prescribed format.

Parameter Description
callLogInfo Contain subject, note and optionally additionalSubmission
returnMessage message, messageType and ttl

Example

{
  callLogInfo:{
    subject: "A new call from John Doe",
    note: "Delivery location changed.",
    additionalSubmission: {
      address: "12 Some Street, CA"
    }
  },
  returnMessage:{
    message: 'Log fetched',
    messageType: 'success', // 'success', 'warning' or 'danger'
    ttl: 30000 // in miliseconds
  }
}

Reference

        returnMessage: {
            message: 'Call log added.',
            messageType: 'success',
            ttl: 3000
        }
    };
}

async function getCallLog({ user, callLogId, authHeader }) {
    // -----------------------------------------
    // ---TODO.5: Implement call log fetching---
    // -----------------------------------------

    // const getLogRes = await axios.get(
    //     `https://api.crm.com/activity/${callLogId}`,
    //     {
    //         headers: { 'Authorization': authHeader }
    //     });

    const getLogRes = {
        subject: mockCallLog.subject,
        note: mockCallLog.note
    }

    //-------------------------------------------------------------------------------------
    //---CHECK.5: In extension, for a logged call, click edit to see if info is fetched ---
    //-------------------------------------------------------------------------------------
    return {
        callLogInfo: {
            subject: getLogRes.subject,
            note: getLogRes.note
        putBody,
        {
            headers: { 'Authorization': authHeader }
        });
}


async function getCallLog({ user, callLogId, authHeader }) {
    const getLogRes = await axios.get(
        `https://${user.hostname}/v1/activities/${callLogId}`,
        {
            headers: { 'Authorization': authHeader }
        });
    const logBody = getLogRes.data.data.note;
    const note = logBody.split('<p>[Note]')[1].split('</p>')[0];
    const relatedContact = getLogRes.data.related_objects?.person;
    let contactName = 'Unknown';
    if (!!relatedContact) {
        const contactKeys = Object.keys(relatedContact);
        contactName = relatedContact[contactKeys[0]].name;
    }
    return {