Merge pull request #1174 from automatisch/twilio-receive-sms-fix
fix(twilio): Receive SMS webhook payload
This commit is contained in:
@@ -11,8 +11,20 @@ const fetchMessages = async ($: IGlobalVariable) => {
|
|||||||
response = await $.http.get(requestPath);
|
response = await $.http.get(requestPath);
|
||||||
|
|
||||||
response.data.messages.forEach((message: IJSONObject) => {
|
response.data.messages.forEach((message: IJSONObject) => {
|
||||||
|
const computedMessage = {
|
||||||
|
To: message.to,
|
||||||
|
Body: message.body,
|
||||||
|
From: message.from,
|
||||||
|
SmsSid: message.sid,
|
||||||
|
NumMedia: message.num_media,
|
||||||
|
SmsStatus: message.status,
|
||||||
|
AccountSid: message.account_sid,
|
||||||
|
ApiVersion: message.api_version,
|
||||||
|
NumSegments: message.num_segments,
|
||||||
|
};
|
||||||
|
|
||||||
const dataItem = {
|
const dataItem = {
|
||||||
raw: message,
|
raw: computedMessage,
|
||||||
meta: {
|
meta: {
|
||||||
internalId: message.date_sent as string,
|
internalId: message.date_sent as string,
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user