updateCallback
Updates the CRM record for an existing call-back. App Connect calls this after a user edits a call-back without marking it called.
Marking a call-back called uses markCalledCallback.
Signature
async function updateCallback({
user,
authHeader,
proxyConfig,
callback,
previous,
thirdPartyId
}) {
return {
returnMessage: {
message: 'Callback updated.',
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 the local write. |
previous |
The call-back before the write. phoneNumber is omitted. |
thirdPartyId |
CRM record id stored from createCallback. null when create did not return one. |
phoneNumber is present on callback only when the current edit request sent it.
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 edit that does not mark it called.
// Marking a call-back called uses markCalledCallback.
// thirdPartyId is the id returned by createCallback, or null when that create did not return one.
// phoneNumber is present only when the current request sent it.
//
// Wire it from the connector entry file:
// exports.updateCallback = require('./interfaces/updateCallback');
async function updateCallback({ authHeader, callback, previous, thirdPartyId }) {
// await axios.patch(`https://api.crm.com/tasks/${thirdPartyId}`, callback, {
// headers: { Authorization: authHeader }
// });
if (!authHeader || !callback?.id || !thirdPartyId || !previous) {
return {};
}
return {};
}
module.exports = updateCallback;
export {};