Skip to content

updateCallLog

This interface is called when a call log activity record needs to be updated. This interface is invoked in response to the following user actions:

  • The user of App Connect's Chrome extension updates the subject or notes associated with a call log.
  • When a recording has become available for a phone call.

Adding a recording to a call log entry

Events are triggers the moment a phone call is completed so that it can be logged properly. However, recordings take additional time to process and encode to make available to users. Therefore, for any given call you will receive an event when the call ends, and a subsequent event when a record is made available (assuming a recording of the call was made).

It is the developer's responsibility to update the call log record contents as they see fit to make a call recording available.

Input parameters

Parameter Description
user An object describing the Chrome extension user associated with the action that triggered this interface.
existingCallLog All the metadata associated with the call to be logged. Call Log schema is described in our API Reference.
authHeader The HTTP Authorization header to be transmitted with the API request to the target CRM.
recordingLink If the call has a recording associated with it, then this field will contain a link to the voicemail.
subject The subject or summary of the call activity. The value may have been changes by the user.
note The notes saved by the user. The value may change if the user has updated the notes they have taken.
startTime Updated value of start date/time of this call.
duration Updated value of duration of this call.
result Updated value of result of this call.
  • Why need startTime, duration and result? Call info could be not as accurate right after the call. Our app uses call info from user local data until it's updated by RingCentral server. If users create call logs before RingCentral server updates the data, another API call will be triggered to call this updateCallLog function with true call data.

Contact Info

{ 
  id: "<string">,
  type: "<string>", 
  phoneNumber: "<E.164 Phone Number>",
  name: "<string>"
}

Return value(s)

An object with following properties:

Parameter Description
updatedNote updated note on CRM
returnMessage message, messageType and ttl

Example

  return {
    updatedNote: "Some random notes",
    returnMessage:{
      message: 'Call logged',
      messageType: 'success', // 'success', 'warning' or 'danger'
      ttl: 30000 // in miliseconds
    }
  }

Reference

            messageType: 'success',
            ttl: 1000
        }
    };
}

// Used to update existing message log so to group message in the same day together
async function updateMessageLog({ user, contactInfo, existingMessageLog, message, authHeader }) {
    // ---------------------------------------
    // ---TODO.8: Implement message logging---
    // ---------------------------------------

    // const existingLogId = existingMessageLog.thirdPartyLogId;
    // const getLogRes = await axios.get(
    //     `https://api.crm.com/activity/${existingLogId}`,
    //     {
    //         headers: { 'Authorization': authHeader }
    //     });
    // const originalNote = getLogRes.data.body;
    // const updateNote = orginalNote.replace();

    // const patchBody = {
    //     data: {
    //         body: updateNote,
    //     }
    // }
    // const updateLogRes = await axios.patch(
    //     `https://api.crm.com/activity`,
    //     patchBody,
    //     {
    //         headers: { 'Authorization': authHeader }
    //     });
    console.log(`update message log with... \n\n${JSON.stringify(message, null, 2)}`);

    //---------------------------------------------------------------------------------------------------------------------------------------------
    //---CHECK.8: For multiple messages or additional message during the day, open db.sqlite and CRM website to check if message logs are saved ---
    //---------------------------------------------------------------------------------------------------------------------------------------------
}

async function createContact({ user, authHeader, phoneNumber, newContactName, newContactType }) {
    // ----------------------------------------
    // ---TODO.9: Implement contact creation---
    // ----------------------------------------

    const postBody = {
        name: newContactName,
        type: newContactType,
        phone_numbers: [
            {
                name: "Work",
                number: phoneNumber,
                default_number: true
        getLogRes = await axios.get(
            `https://${user.hostname}/api/v2/activities/${existingPipedriveLogId}`,
            {
                headers: { 'Authorization': authHeader }
            });
    }

    let patchBody = {};
    patchBody.note = composedLogDetails;

    if (subject) {
        patchBody.subject = subject;
    }
    if (duration) {
        patchBody.duration = secondsToHoursMinutesSecondsInPipedriveFormat(duration);
    }

    const patchLogRes = await axios.patch(
        `https://${user.hostname}/api/v2/activities/${existingPipedriveLogId}`,
        patchBody,
        {
            headers: { 'Authorization': authHeader }
        });
    extraDataTracking = {
        ratelimitRemaining: patchLogRes.headers['x-ratelimit-remaining'],
        ratelimitAmount: patchLogRes.headers['x-ratelimit-limit'],
        ratelimitReset: patchLogRes.headers['x-ratelimit-reset']
    };
    return {
        updatedNote: patchBody.note,
        returnMessage: {
            message: 'Call log updated.',
            messageType: 'success',
            ttl: 2000
        },
        extraDataTracking
    };
}

async function upsertCallDisposition({ user, existingCallLog, authHeader, dispositions }) {
    let extraDataTracking = {};
    if (!dispositions.deals && !dispositions.leads) {
        return {
            logId: null
        };
    }