Skip to content

updateMessageLog

Updates an existing CRM message activity for later messages in the same conversation/day or for an existing shared SMS thread.

Signature

async function updateMessageLog({
  user,
  contactInfo,
  assigneeName,
  ownerName,
  sharedSMSLogContent,
  existingMessageLog,
  message,
  authHeader,
  additionalSubmission,
  imageLink,
  imageDownloadLink,
  imageContentType,
  videoLink,
  proxyConfig
}) {
  return {
    returnMessage: {
      message: 'Message log updated.',
      messageType: 'success',
      ttl: 3000
    }
  };
}

Input

Field Description
user Connected CRM user.
contactInfo Selected contact.
assigneeName, ownerName Shared SMS assignment/owner context when available.
sharedSMSLogContent { subject, body } generated by core for shared SMS updates.
existingMessageLog Local App Connect linkage record. Use existingMessageLog.thirdPartyLogId as the CRM log ID.
message RingCentral message object for normal message updates.
authHeader Prepared CRM auth header.
additionalSubmission Values from manifest page.messageLog.additionalFields[].
imageLink, imageDownloadLink, imageContentType, videoLink MMS media fields when present.
proxyConfig Proxy configuration when applicable.

Return

Field Description
returnMessage Optional UI feedback.
extraDataTracking Optional analytics/tracing data.

Core uses existingMessageLog.thirdPartyLogId; you do not need to return the CRM log ID.

Reference

const axios = require('axios');

// Used to update existing message log so to group message in the same day together
async function updateMessageLog({ user, contactInfo, existingMessageLog, message, authHeader }) {
    //--------------------------------------
    //--- TODO: Add CRM API call here ------
    //--------------------------------------
    // 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)}`);
}

module.exports = updateMessageLog;