twilio / twilio-webchat-react-app

Twilio Webchat React App is an application that demonstrates a website chat widget built with Twilio's Conversations JS SDK, Twilio Paste Design library and Create React App.
MIT License
64 stars 71 forks source link

Prefill pre-engagement-data #39

Open iam-steve opened 1 year ago

iam-steve commented 1 year ago

Hello! I apologize in advance if this already possible and I'm missing something -- but is there anyway to pre-fill some of the engagement form data and skip showing the form to the user but just open the chat right on page load?

For example, if we are embedding this on a website where we already know who the user is (because they've logged in), we don't need them to fill out their name and email address again on a form as long as we could pass that info somewhere. Would be great if we can initialize the chat with those values somehow? This may be the wrong way to accomplish it, but I'm thinking something like this:

Twilio.initWebchat({
    theme: {
        isLight: true
    },
    formData: {
        friendlyName: "First_Name Last_Name",
        email: "their_email@domain.com"
        skip_engagement_form: true
    };
})

Any help is appreciated!