Bot Framework Twilio Adapater / Channel Receiving and Sending Questions

King-A. J. Olly 1 Reputation point
2021-01-04T17:39:51.607+00:00

Hello!

I'd like to know, which data the function at https://sms.botframework.com/api/sms is using when it's handling an incoming HTTP post from Twilio via a phone number, TwiML App or other Twilio origin?

For example, the payload for an incoming message via a Twilio number looks like this:

{
"method": "POST",
"path": "/",
"query": {},
"headers": {
"x-forwarded-for": "[Redacted for privacy and security]",
"x-forwarded-proto": "https",
"x-forwarded-port": "443",
"host": "https://sms.botframework.com/api/sms",
"x-amzn-trace-id": "[Redacted for privacy and security]",
"content-length": "425",
"content-type": "application/x-www-form-urlencoded",
"x-twilio-signature": "[Redacted for privacy and security]",
"i-twilio-idempotency-token": "[Redacted for privacy and security]",
"accept": "/",
"user-agent": "TwilioProxy/1.1"
},
"bodyRaw": "[Redacted for privacy and security]",
"body": {
"ToCountry": "[Redacted for privacy and security]",
"ToState": "[Redacted for privacy and security]",
"SmsMessageSid": "[Redacted for privacy and security]",
"NumMedia": "[Redacted for privacy and security]",
"ToCity": "[Redacted for privacy and security]",
"FromZip": "[Redacted for privacy and security]",
"SmsSid": "[Redacted for privacy and security]",
"FromState": "[Redacted for privacy and security]",
"SmsStatus": "received",
"FromCity": "[Redacted for privacy and security]",
"Body": "[Redacted for privacy and security]",
"FromCountry": "[Redacted for privacy and security]",
"To": "[Redacted for privacy and security]",
"ToZip": "[Redacted for privacy and security]",
"NumSegments": "1",
"MessageSid": "[Redacted for privacy and security]",
"AccountSid": "[Redacted for privacy and security]",
"From": "[Redacted for privacy and security]",
"ApiVersion": "2010-04-01"
}
}

In the areas where you see "[Redacted for privacy and security]", there's actual data that was there, but I've redacted it.

What I'm asking is: which of these pieces of data is the function at https://sms.botframework.com/api/sms using to acknowledge that it's an incoming message from my specific Twilio account number and then forward it to my bot. Also, which header information is necessary to keep and what can be removed?

Use case: I need to intercept the incoming messages to add additional metadata about the user when they message us before it reaches our CRM (which is where the bot's endpoint is directed). I will do this on the Twilio side using Twilio Functions, so I need to understand which parameters are required to be present in the reconstructed http post that I send to the botframework webhook (https://sms.botframework.com/api/sms) and which parameters can be ignored and/or dropped.

Please advise.

Thanks!

Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
841 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.