Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Content Zone
Table of Contents

This document gives an overview of how to use the Twilio node and configure a sample flow in Experience Designer for a bi-directional conversation using SMS.

When a mobile phone user sends an SMS to the Twilio phone number, Orbita tries to recognize the intent and replies back with an SMS (which contains the configured response for that intentn) via Twilio phone number to the user.

Prerequisites

  • Registered Twilio account.

  • Twilio-powered Phone number.

Experience Designer

  1. Import the below flow to the Experience Designer

    Code Block
    [
        {
            "id": "fc3d6a5b.e921e8",
            "type": "http in",
            "z": "8a8b3a1.0b8abc8",
            "name": "Twilio - SMS",
            "url": "/twilio/message",
            "method": "post",
            "upload": false,
            "swaggerDoc": "",
            "x": 90,
            "y": 440,
            "wires": [
                [
                    "ce22e0f2.724c2",
                    "e6e548b3.6bb298"
                ]
            ]
        },
        {
            "id": "e6e548b3.6bb298",
            "type": "function",
            "z": "8a8b3a1.0b8abc8",
            "name": "Post Process",
            "func": "var _ = global.get('lodash');\nvar text = _.get(msg, 'payload.Body',null);\nmsg.payload.text = text;\nmsg.payload.sessionId = _.get(msg, 'req.sessionID', '');\nreturn msg;\n",
            "outputs": 1,
            "noerr": 0,
            "x": 270,
            "y": 440,
            "wires": [
                [
                    "3ab2c841.9b1d28",
                    "8db04496.f15b38"
                ]
            ]
        },
        {
            "id": "3ab2c841.9b1d28",
            "type": "orbita-bot-provider-v2",
            "z": "8a8b3a1.0b8abc8",
            "name": "",
            "botInParser": "",
            "botOutParser": "",
            "transcriptEnabled": false,
            "ttsconfig": "{\n              \"languageCode\": \"en-US\",\n              \"ssmlGender\": \"FEMALE\",\n              \"name\": \"en-US-Standard-C\",\n              \"audioEncoding\": \"MP3\"\n              }",
            "providerType": "Google",
            "skillConfig": "496cb5db.ebb6fc",
            "token": "",
            "noerr": 0,
            "agentId": "",
            "nlpData": false,
            "x": 460,
            "y": 440,
            "wires": [
                [
                    "7c190c7f.9afab4",
                    "70f78986.278088"
                ]
            ]
        },
        {
            "id": "7c190c7f.9afab4",
            "type": "function",
            "z": "8a8b3a1.0b8abc8",
            "name": "Process",
            "func": "const utils = global.get('orbitaUtil');\nmsg.text = utils.sanitizeSimpleHtmlText(msg.payload.orbitaPayload.payload.multiagent.chat.chatText);\nreturn msg;",
            "outputs": 1,
            "noerr": 0,
            "x": 640,
            "y": 440,
            "wires": [
                [
                    "97de6336.c9e2e"
                ]
            ]
        },
        {
            "id": "97de6336.c9e2e",
            "type": "template",
            "z": "8a8b3a1.0b8abc8",
            "name": "Respond",
            "field": "payload",
            "fieldType": "msg",
            "format": "handlebars",
            "syntax": "mustache",
            "template": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response>\n    <Message>{{text}}</Message>\n</Response>\n",
            "output": "str",
            "x": 800,
            "y": 440,
            "wires": [
                [
                    "5bba4979.cbe6a8"
                ]
            ]
        },
        {
            "id": "5bba4979.cbe6a8",
            "type": "http response",
            "z": "8a8b3a1.0b8abc8",
            "name": "",
            "statusCode": "",
            "headers": {},
            "x": 950,
            "y": 440,
            "wires": []
        },
        {
            "id": "496cb5db.ebb6fc",
            "type": "alexa-skill-config",
            "skillname": "Documentation Flows",
            "projectId": "5cf9249637e124a03087780b",
            "intents": "[]",
            "skillstate": "",
            "disableLogging": false
        },
        {
            "id": "slots",
            "type": "slots",
            "z": "",
            "slots": []
        }
    ]

  2. Change the endpoint in the http in node. In the above example, it is /twilio/message

    Image Added

  3. Now the mobile phone user can send a text message to the Twilio number and converse with the chatbot.

Twilio Configuration

  1. Navigate to https://console.twilio.com/

  2. From the Side navigation bar, select Phone Numbers > Manage > Active Numbers

    Image Added

  3. On the Active numbers page, select the “Configure“ tab and scroll down to the Messaging section.
    Add the webhook you created in the Experience Designer.
    In this example, it is https://sandbox15.orbita.cloud:8443/oeapi/twilio/message

    Image Added

Video Content

https://cdn.orbita.cloud/assets/orbita/ivr/bidirectionaltwilio.mp4

...