Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

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 intent) 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.

    [
        {
            "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 to your liking.
    In the above example, it is /twilio/message.

  3. Click on Done and Deploy the Experience Designer flow.

Twilio Configuration

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

  2. From the Side navigation bar, select Phone Numbers > Manage > Active Numbers and click on the phone number to go to the configuration page.

  3. On the configuration 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

Best Practices

  1. Do not use special characters in the messages.

  2. If the message is large (i.e; greater than 140 characters), split the message into segments and use multiple Twilio nodes to send the segments with a delay.

  3. The maximum number of characters allowed in one segment is 140. If you use multiple segments, then you should restrict the maximum number of characters used in each segment to 134 as 6 characters will be utilized to link the segments together.

Video Content

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

Supporting Documentation

No additional supporting documentation

Useful Links

http://orbita.ai

Related Content

  • No labels