Rate this page:

Inbound Messages with Flex WebChat UI

Webchat is a common channel that customers use to communicate with a Flex agent. The Flex Webchat UI offers you a simple way to embed chat on your website and seamlessly manage messaging orchestration.

Any inbound messages sent with the Webchat widget get passed through to your contact center. The end user using the widget is generally unauthenticated, or anonymous. You can gather information through a pre-engagement form before presenting the chat interface and pass the gathered meta-data to Studio, Flex, or your internal systems for validation and personalization.

In this use case, the Flex Flow and Studio Flow are available by default with standard Flex setup. The Flex Flow will be specified when configuring the Flex Webchat UI.

The event flow detailed below is automatically handled by Twilio Webchat UI and requires no further integration. It is provided to show how the data passed from the Webchat UI is used when creating the Flex ChatChannel.

How Inbound Webchat with Flex Works

First, Twilio creates an access token for the guest user.

  • Flex Webchat UI uses standard Twilio token generation
    • Auto-generated token expires after one hour
    • The Flex Webchat UI will automatically renew this token before it expires

This doesn't require any coding on your part. Once the access token is created, Twilio orchestrates the relevant Chat engagement and Chat Channel, connects the Integration Type, and places the User into the Chat Channel. Twilio ensures other parts of the defined Message Handler are set.

  • Channels are generated via the following endpoint:
  • This request uses the Access Token that the Webchat UI generated in the first step

If you have configured a pre-engagement with the Webchat UI, Flex will pass the pre-engagement data as a part of this request.


        Subsequent messages exchanged are now being passed using the Chat SDK from the Webchat UI.

        Rate this page:

        Need some help?

        We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Community Forums or browsing the Twilio tag on Stack Overflow.


              Thank you for your feedback!

              We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

              Sending your feedback...
              🎉 Thank you for your feedback!
              Something went wrong. Please try again.

              Thanks for your feedback!

              Refer us and get $10 in 3 simple steps!

              Step 1

              Get link

              Get a free personal referral link here

              Step 2

              Give $10

              Your user signs up and upgrade using link

              Step 3

              Get $10

              1,250 free SMSes
              OR 1,000 free voice mins
              OR 12,000 chats
              OR more