Setting User Verification Via External Bot

Prerequisites

To call the MedChat API to set up user verification, first obtain your organization's OrgId and Access Token, as described in the API Authentication documentation.

Read through the external bot documentation found here: External Bots

Read through the webhook documentation found here: Webhooks

Create a chatbot where the first step is an 'External Bot' with a Flow Identifier of your choice, such as "SetupVerificationFlow".

Following the 'ExtenalBot' step in the chatbot, add a 'Verify User' step. For more on this step, see the documentation as described in Verifying Chat Users

External Bot User Verification Sequence

1120

Sequence Diagram

The above sequence diagram describes the use case for setting up the verification configuration from an external chatbot flow. The following items in the sequence diagram will be covered in detail here. All other items are External Bot related and are not covered in this guide.

Prompt User w/ Lookup Fields

In order to pass to MedChat verification configuration, such as email address/sms phone number/security questions, you will need to be able uniquely identify a user. To accomplish this, you will need to prompt the user for a unique identifier and/or other identifying information that can be used to find the user. It is also strongly recommended that you ask for information about the user that will help with validating any records found.

We have a rich set of message blocks that can be used for the user to input data that can be posted to the widget. See Message Blocks and Message Composition

Get ChatContext

Once the user has inputted their response to your prompts, you will receive a webhook event of 'ChatContextUpdated', this is your bot's opportunity to get the answers the user has provided and to lookup the user on your system using those values.
For more information on the ChatContextUpdated event and getting the ChatContext see: Key Concepts and Get chat context

Set User Verification Config

Once your bot has found the user, you can now pass us the verification configuration required to verify the user. You must provide one or more of the following; Sms Phone Number, Email Address, and/or at least one Security Question/Answer.
For more information about creating this configuration, see Create a user verification config.

Resume External Chatbot

Calling the Resume chatbot execution endpoint will hand back control of the chatbot to MedChat and the next step will be performed. In this case, the chatbot will perform the Verify User step.