Create a voice-enabled chatbot
Voice-enabled chatbots can send and receive voice messages in addition to text messages.
Chatbot to end user: The chatbot sends voice messages to end users.
End user to chatbot: End users can send voice messages to the chatbot instead of text messages. Example: Instead of typing I want to build a chatbot, the end user can send this message as a voice message.
How it works
Answers uses the following services for voice functionality:
- Text-to-speech: Create the voice-enabled message in text format. When the end user receives this message, the text-to-speech service converts it into a voice message.
- Speech-to-text: When end users send voice messages to your chatbot, Answers converts the voice message into text by using the speech-to-text service. From the message, the chatbot identifies the information that it needs to continue the conversation.
In AI chatbots, similar to identifying the intent of an end user's text message, the chatbot can identify the intent of a voice message.
Create the chatbot
Do the following:
-
Enable voice functionality for your chatbot.
-
To send voice messages to end users, create the text message that needs to be sent as a voice message. Use one or more of the following:
- Use the Voice element.
- Use a voice-enabled element.
Guidelines for creating the voice message
Follow these guidelines for the text message that needs to be sent as a voice message.
- Avoid using emojis. Emojis are also read when the message is sent to the end user. Example: The chatbot reads smiley face.
- To add a pause between two sentences in the voice message, enter the messages on separate lines.
Change the language based on end user selection
If end users want to communicate with the chatbot in a different language, you can dynamically update the voice settings.
Offer the end users the option to select their preferred language. Then, use the Code element to change the voice settings based on their selection.
The following example shows how to change the language to either English or Spanish.
-
Create an attribute to save the end user's language selection. Example: language_choice
-
Offer language options to the end user and save their response. Use the Save user response element.
- In this element, specify the following text: Select your language - English or Spanish.
- Save the end user's response in the language_choice attribute.
-
Add a Conditions element to branch the flow based on the end user's selection.
-
In each branch, add a Code element to change the language.
-
In the Code element, specify the code in the following format.
voiceApi.set('Chatbot response language','End-user language','Voice name', 'MALE or Female', Speech rate)
Example: To change the voice settings to Spanish, use the following code:
voiceApi.set('es','es', 'Alonso', 'MALE', 1)
Refer to the Speech languages reference for the language abbreviations.
