question

KingAJOlly avatar image
0 Votes"
KingAJOlly asked ramr-msft commented

Bot Framework Twilio Adapater / Channel Receiving and Sending Questions

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-bot-service
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@KingAJOlly Thanks for the question.please follow the below documentation for the integration of Bot and Twilio.
https://docs.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-twilio?view=azure-bot-service-4.0
With respect to authentication of already logged in user, Since users are already logged in to the website you can pass this information to the bot. How is the authentication done currently? Is there Azure AD integration? If there isn’t, what’s your identity provider?
If you’re using open standards like Open ID Connect you could pass along the JWT id_token in each request to the bot. This makes it easy to then decode the token and extract claims (like e-mail, first and last name).

0 Votes 0 ·

Thank you, which of the parameters of the payload from Twilio does the function at the API URL use, so that I know which parameters to pass after intercepting an incoming message via my Twilio function?

Thanks!

0 Votes 0 ·

@KingAJOlly We are checking internally for the parameters of the payload required from Twilio will update on the same.

1 Vote 1 ·
Show more comments

0 Answers