twilio connect within salesforce

I would like to add twilio connect button to my salesforce app, Does anyone know what to do with the AUTHORIZE URL, which is required to return user ( after authorization) back to salesforce?

Asked on February 28, 2019 in APEX,   VIsualforce.
Add Comment
2 Answer(s)
Best answer

This is what the Twilio documentation says about the Authorize URL:

The URL where the user will be redirected after they go through the authorization flow. If the user approves access for your Connect App they will be redirected to this URL with their AccountSid as an HTTP GET query string parameter named AccountSid.

If a user chooses to decline authorization they will be redirected to this URL with a single parameter:”

 

So what they are saying is you will provide a URL for them to GET/POST request to after the authentication flow runs for Twilio Connect. This request will contain the authenticated user’s AccountSid as a parameter to your page, and possibly other information about the user (see custom tags).  You will need to store this information for use during the user session.

So what do you need to do in Salesforce?

You have options here but first to mind are a custom Visualforce page with an APEX controller, or an APEX REST Endpoint.   Configure the controller to accept the parameters from Twilio and store them appropriately for the session.  This page will most likely need to be made public via Salesforce Sites.  Because this page will be public you need to add security to authenticate the request is coming from Twilio (I can do another post for this if needed).  Once you have the data from the Twilio auth flow, you can redirect the user to the page where the Twilio Connect client widget is being implemented and use the authentication parameters to get them logged in to a session.

 

Hope this helps!

 

 

Answered on February 28, 2019.
Add Comment

Thank you! This helps lots. I can do.

Answered on February 28, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.