twiliotwilio-apitwilio-programmable-chat

Twilio Chatbot through Website - User has no phone number


My client's use case is a Barista Chatbot, but only accessible through their website. An icon in the lower right of web pages allowing the user to click and ask questions of an automated chatbot.

I've created a Studio Flow that works from a cell phone using SMS.

Now I need to trigger that Studio Flow for a user that opens the chat popup.

The website is ASP.NET v4.8 with MVC and .NET Framework 4.8.

The problem I'm having is finding any documentation/example code on how to create a Conversation without a user having a phone number. I'm sure this is possible?

        // Create a Participant
        var participant = ParticipantResource.Create(
            messagingBindingAddress: "<NONUMBER FOR HERE>",
            messagingBindingProxyAddress: _twilioPhoneNumber,
            pathConversationSid: conversation.Sid
        );

We don't have any intention of collecting phone numbers from users at the point of this interaction.

Can someone point me on how to add a webchat participant without a phone number?


Solution

  • When creating a chat participant for a conversation, you only need to provide their identity, not a messageBingingAddress or messageBindingProxyAddress.

            var participant = ParticipantResource.Create(
                identity: "<Chat User Identity>",
                pathConversationSid: "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
            );
    

    See also the example in the docs here.