|
|
|
@ -24,8 +24,9 @@ const timeField = { saved: 'createTime', pending: 'createTime', sent: 'sendTime'
|
|
|
|
|
const statusMapped = { saved: 'accepted', pending: 'accepted', sent: 'sent', delivered: 'delivered', read: 'read', failed: 'failed' };
|
|
|
|
|
const directionField = { 'message:received': 'inbound', 'message:updated': 'outbound' };
|
|
|
|
|
const directionPrefix = { inbound: 'in_', outbound: 'out_' };
|
|
|
|
|
const directionIdUserPrefix = { inbound: 'to', outbound: 'from' };
|
|
|
|
|
|
|
|
|
|
const uniqueMsgId = msg => (msg.id && msg.direction ? `${directionPrefix[msg.direction]}${msg.to.replace('+', '')}_${msg.id}` : undefined);
|
|
|
|
|
const uniqueMsgId = msg => (msg.id && msg.direction ? `${directionPrefix[msg.direction]}${msg[directionIdUserPrefix[msg.direction]].replace('+', '')}_${msg.id}` : undefined);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @returns {Object} webhookBody
|
|
|
|
|