markCalledCallback
Updates the CRM record when a user marks a call-back called. App Connect calls this after the local status becomes called, including when an edit changes the status to called.
Edits that leave the status unchanged use updateCallback.
Signature
async function markCalledCallback({
user,
authHeader,
proxyConfig,
callback,
previous,
thirdPartyId
}) {
return {
returnMessage: {
message: 'Callback marked called.',
messageType: 'success',
ttl: 2000
}
};
}
Input
| Field | Description |
|---|---|
user |
Connected CRM user. |
authHeader |
Prepared CRM auth header. |
proxyConfig |
Proxy connector configuration when applicable. |
callback |
The call-back after it is marked called. callback.status is called. |
previous |
The call-back before the change. phoneNumber is omitted. |
thirdPartyId |
CRM record id stored from createCallback. null when create did not return one. |
Mark-as-called does not include a phone number.
Use thirdPartyId to find the CRM record. callback.id remains the App Connect id.
Return
| Field | Description |
|---|---|
returnMessage |
Optional UI feedback. |
Return { successful: false, returnMessage } or throw when the CRM write fails. App Connect keeps the local change and shows a warning. The call-back request still succeeds.
Reference
// Optional. Called after a call-back is marked called.
// callback.status is "called". previous is the call-back before the change.
// thirdPartyId is the id returned by createCallback, or null when that create did not return one.
// Mark-as-called does not include a phone number.
//
// Wire it from the connector entry file:
// exports.markCalledCallback = require('./interfaces/markCalledCallback');
async function markCalledCallback({ authHeader, callback, previous, thirdPartyId }) {
// await axios.patch(`https://api.crm.com/tasks/${thirdPartyId}`, { status: callback?.status }, {
// headers: { Authorization: authHeader }
// });
if (!authHeader || !callback?.id || !thirdPartyId || !previous) {
return {};
}
return {};
}
module.exports = markCalledCallback;
export {};