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
}
};
}
// - contactInfo: { id, type, phoneNumber, name }
// - message : same as in https://developers.ringcentral.com/api-reference/Message-Store/readMessage
// - recordingLink: recording link of voice mail
// - additionalSubmission: all additional fields that are setup in manifest under call log page
async function createMessageLog({ user, contactInfo, authHeader, message, additionalSubmission, recordingLink, faxDocLink }) {
// ---------------------------------------
// ---TODO.7: Implement message logging---
// ---------------------------------------
// const postBody = {
// data: {
// subject: `[SMS] ${message.direction} SMS - ${message.from.name ?? ''}(${message.from.phoneNumber}) to ${message.to[0].name ?? ''}(${message.to[0].phoneNumber})`,
// body: `${message.direction} SMS - ${message.direction == 'Inbound' ? `from ${message.from.name ?? ''}(${message.from.phoneNumber})` : `to ${message.to[0].name ?? ''}(${message.to[0].phoneNumber})`} \n${!!message.subject ? `[Message] ${message.subject}` : ''} ${!!recordingLink ? `\n[Recording link] ${recordingLink}` : ''}\n\n--- Created via RingCentral App Connect`,
// type: 'Message'
// }
// }
// const addLogRes = await axios.post(
// `https://api.crm.com/activity`,
// postBody,
// {
// headers: { 'Authorization': authHeader }
// });
const messageType = recordingLink ? 'Voicemail' : (faxDocLink ? 'Fax' : 'SMS');
console.log(`adding message log... \n\n${JSON.stringify(message, null, 2)}`);
mockMessageLog = {
id: 'testMessageLogId'
}
const addLogRes = {
data: {
id: mockMessageLog.id
}
}
logBody = logBody.replace(matchResult[0], `<br>Conversation(${parseInt(matchResult[1]) + 1} messages)`);
patchBody = {
note: logBody,
deal_id: dealId
}
if (!dealId && leadId) {
patchBody.lead_id = leadId;
}
const patchLogRes = await axios.patch(
`https://${user.hostname}/api/v2/activities/${existingLogId}`,
patchBody,
{
headers: { 'Authorization': authHeader }
});
extraDataTracking = {
ratelimitRemaining: patchLogRes.headers['x-ratelimit-remaining'],
ratelimitAmount: patchLogRes.headers['x-ratelimit-limit'],
ratelimitReset: patchLogRes.headers['x-ratelimit-reset']
};
return {
extraDataTracking
}
}
async function getCallLog({ user, callLogId, authHeader }) {
let extraDataTracking = {};
const getLogRes = await axios.get(
`https://${user.hostname}/api/v2/activities/${callLogId}`,
{
headers: { 'Authorization': authHeader }
});