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
if (!!callLog.recording?.link && (user.userSettings?.addCallLogRecording?.value ?? true)) { body = upsertCallRecording({ body, recordingLink: callLog.recording.link }); }
if (!!aiNote && (user.userSettings?.addCallLogAiNote?.value ?? true)) { body = upsertAiNote({ body, aiNote }); }
if (!!transcript && (user.userSettings?.addCallLogTranscript?.value ?? true)) { body = upsertTranscript({ body, transcript }); }
// const postBody = {
// subject: callLog.customSubject ?? `[Call] ${callLog.direction} Call ${callLog.direction === 'Outbound' ? 'to' : 'from'} ${contactInfo.name} [${contactInfo.phone}]`,
// body: `\nContact Number: ${contactInfo.phoneNumber}\nCall Result: ${callLog.result}\nNote: ${note}${callLog.recording ? `\n[Call recording link] ${callLog.recording.link}` : ''}\n\n--- Created via RingCentral App Connect`,
// type: 'PhoneCommunication',
// received_at: moment(callLog.startTime).toISOString()
// }
// const addLogRes = await axios.post(
// `https://api.crm.com/activity`,
// postBody,
// {
// headers: { 'Authorization': authHeader }
// });
console.log(`adding call log... \n${JSON.stringify(callLog, null, 2)}`);
console.log(`body... \n${body}`);
console.log(`with additional info... \n${JSON.stringify(additionalSubmission, null, 2)}`);
mockCallLog = {
id: 'testCallLogId',
subject: callLog.customSubject,
note: body,
contactName: contactInfo.name
}
const addLogRes = {
data: {
id: mockCallLog.id
}
}
//----------------------------------------------------------------------------
extraDataTracking
}
}
async function createMessageLog({ user, contactInfo, authHeader, message, additionalSubmission, recordingLink, faxDocLink }) {
let extraDataTracking = {};
const userInfoResponse = await axios.get(`https://${user.hostname}/v1/users/me`, {
headers: {
'Authorization': authHeader
}
});
const personResponse = await axios.get(`https://${user.hostname}/api/v2/persons/${contactInfo.id}`, { headers: { 'Authorization': authHeader } });
const userName = userInfoResponse.data.data.name;
const dealId = additionalSubmission ? additionalSubmission.deals : '';
const orgId = personResponse.data.data.org_id ?? '';
const timeUtc = moment(message.creationTime).utcOffset(0).format('HH:mm')
const dateUtc = moment(message.creationTime).utcOffset(0).format('YYYY-MM-DD');
const activityTypesResponse = await axios.get(`https://${user.hostname}/v1/activityTypes`, { headers: { 'Authorization': authHeader } });
const smsType = activityTypesResponse.data.data.find(t => t.name === 'SMS' && t.active_flag);
const messageType = recordingLink ? 'Voicemail' : (faxDocLink ? 'Fax' : 'SMS');