{"_id":"5845a4a99f6fbb1b00430800","project":"54d3007669578e0d002730c9","version":{"_id":"5845a4a89f6fbb1b004307b7","project":"54d3007669578e0d002730c9","__v":2,"createdAt":"2016-12-05T17:32:24.708Z","releaseDate":"2016-12-05T17:32:24.708Z","categories":["5845a4a89f6fbb1b004307b8","5845a4a89f6fbb1b004307b9","5845a4a89f6fbb1b004307ba","5845a4a89f6fbb1b004307bb","5845a4a89f6fbb1b004307bc","5845a4a89f6fbb1b004307bd","5845a4a89f6fbb1b004307be","5845a4a89f6fbb1b004307bf","5845a4a89f6fbb1b004307c0","592deb23644f060f008e5aa6"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"25.0.0","version":"25"},"user":"55bf6cdcad601c2b00762d13","parentDoc":null,"__v":0,"category":{"_id":"5845a4a89f6fbb1b004307bd","project":"54d3007669578e0d002730c9","__v":0,"version":"5845a4a89f6fbb1b004307b7","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-07-08T18:48:02.369Z","from_sync":false,"order":5,"slug":"integrations","title":"Integrations"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-08-17T00:20:07.957Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":14,"body":"* [Overview](#overview)\n* [Enabling Twilio IP Integration in API.AI](#enabling-twilio-ip-integration-in-apiai)\n* [Obtaning the Configuration Settings from Twilio](#obtaning-configuration-settings-from-twilio)\n * [Obtain Service Instance SID](#section-obtain-service-instance-sid)\n * [Obtain Account SID](#section-obtain-account-sid)\n * [Obtain API Key SID and Secret](#section-obtain-api-key-sid-and-secret)\n* [Launching Twilio IP Bot in API.AI](#launching-twilio-ip-bot-in-apiai)\n* [Testing Your Twilio IP Bot](#testing-your-twilio-ip-bot)\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Overview\"\n}\n[/block]\n**API.AI Twilio IP Messaging Integration** allows you to easily create Twilio IP Messaging bots with natural language understanding based on the API.AI technology.\n\nYou can use our source code from <a href=\"https://github.com/api-ai/apiai-nodejs-client/tree/master/samples/twilio/ip-messaging\">github</a> to create custom Twilio IP bots.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Enabling Twilio IP Integration in API.AI\"\n}\n[/block]\n<a href=\"https://console.api.ai/api-client/#/newAgent\" target=\"_blank\">Create an API.AI agent</a> with the help of the <a href=\"https://docs.api.ai/docs/key-concepts\" target=\"_blank\">API.AI NLU technology tools</a>.\n\nTo enable Twilio IP Messaging Integration, click ‘Integrations’ from the left side menu and turn Twilio IP integration on.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/3c00a26-Twilio-IP-enable-integration.png\",\n        \"Twilio-IP-enable-integration.png\",\n        2028,\n        912,\n        \"#fbfbfb\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\nIn the integration settings, you'll be prompted to fill in the following fields:\n* Secret Instance SID\n* Account SID\n* API Key SID\n* API Secret\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/71ea3f6-Twilio-IP-Api-ai-fields.png\",\n        \"Twilio-IP-Api-ai-fields.png\",\n        2218,\n        1250,\n        \"#495162\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\nTo obtain these values, you'll need to log in to your Twilio account.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Obtaning Configuration Settings from Twilio\"\n}\n[/block]\n## Obtain Service Instance SID\n\nIn your Twilio account, go to **Products > IP Messaging > IP Messaging Services** or just click <a href=\"https://www.twilio.com/user/account/ip-messaging/services\" target=\"_blank\">here</a>.\n\nClick 'Create an IP Messaging Service' button.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/31bad3e-Twilio-IP-create-service.png\",\n        \"Twilio-IP-create-service.png\",\n        2238,\n        860,\n        \"#ebeef1\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\nName your new service and click 'Create'.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/e2e6492-Twilio-IP-name-service.png\",\n        \"Twilio-IP-name-service.png\",\n        2256,\n        828,\n        \"#262626\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\nOn the page that will open, you'll see your Service SID. Copy and paste it to the respective field in the API.AI integration settings.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/85ee3e3-Twilio-IP-SID-copy.png\",\n        \"Twilio-IP-SID-copy.png\",\n        2232,\n        1090,\n        \"#dfe8f0\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\nScroll down to the bottom of the page and click 'Save'. \n\n## Obtain Account SID\n\nGo to **Products > IP Messaging > Getting Started** (or just click <a href=\"https://www.twilio.com/user/account/ip-messaging/getting-started\" target=\"_blank\">here</a>) and click on 'Show IP Credentials'.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/9d5d996-Twilio-IP-Show-Credentials.png\",\n        \"Twilio-IP-Show-Credentials.png\",\n        2220,\n        862,\n        \"#edeff2\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\nCopy the Account SID and paste it to the respective field in the API.AI integration settings.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/bdbbaf4-Twilio-IP-Account-SID.png\",\n        \"Twilio-IP-Account-SID.png\",\n        2230,\n        806,\n        \"#dfe8f0\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\n## Obtain API Key SID and Secret\n\nGo to **Products > Dev Tools > API Keys** (or just click  or just click <a href=\"https://www.twilio.com/user/account/ip-messaging/dev-tools/api-keys\" target=\"_blank\">here</a>) and click 'Creat an API Key'. \n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/e75cf7e-Twilio-IP-create-API-key.png\",\n        \"Twilio-IP-create-API-key.png\",\n        2258,\n        994,\n        \"#edeff2\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\nCreate a name and click 'Create API Key'.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/103cf3e-Twilio-IP-Login-to-chat.png\",\n        \"Twilio-IP-Login-to-chat.png\",\n        2058,\n        1078,\n        \"#393939\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\nOn the page that will open, you'll see Sid and Secret values. Copy and paste the values to the respective fields in the API.AI integration settings.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"This secret is only shown ONCE. Make note of it and store it in a safe, secure location.\"\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/2a82323-Twilio-IP-Sid-and-Secret.png\",\n        \"Twilio-IP-Sid-and-Secret.png\",\n        2194,\n        1192,\n        \"#e6eee6\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Launching Twilio IP Bot in API.AI\"\n}\n[/block]\nAfter having inserted all the values obtained from your Twilio account to the respective fields in the API.AI Twilio IP integration settings, click 'Start' to launch your bot.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/716b5d7-Twilio-IP-Api-ai-start.png\",\n        \"Twilio-IP-Api-ai-start.png\",\n        2192,\n        1224,\n        \"#485361\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Testing Your Twilio IP Bot\"\n}\n[/block]\nDownload the IP Messaging Demo Application from <a href=\"https://github.com/twilio/ip-messaging-demo-js\" target=\"_blank\">https://github.com/twilio/ip-messaging-demo-js</a> and unzip it.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/b704ab8-Twilio-IP-download-from-Github.png\",\n        \"Twilio-IP-download-from-Github.png\",\n        2360,\n        1088,\n        \"#f4f5f6\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\nOpen the unzipped folder.\n\nCopy `credentials.example.json` to `credentials.json`.\n\nPlug your credentials into `credentials.json` and save the file.\n\nIf you are on Mac, go to the unzipped directory in the Terminal and type the command `npm install` and then `npm start`.\n\nOpen the local server in a browser: <a href=\"http://localhost:8080\" target=\"_blank\">http://localhost:8080</a>.\n\nType in your name and click 'Log in As Guest'.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/0513e5e-Twilio-IP-Login-to-chat.png\",\n        \"Twilio-IP-Login-to-chat.png\",\n        2058,\n        1078,\n        \"#393939\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\nClick 'Channel for API.AI bot' and then, 'Join this Channel' at the bottom of the page.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/93ff10a-Twilio-IP-join-api-ai-channel.png\",\n        \"Twilio-IP-join-api-ai-channel.png\",\n        2098,\n        552,\n        \"#292b2a\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\nTest your bot.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/e416313-Twilio-IP-test-your-bot.png\",\n        \"Twilio-IP-test-your-bot.png\",\n        2420,\n        1548,\n        \"#262626\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"twilioipmessaging-integration","type":"basic","title":"Twilio IP Messaging"}

Twilio IP Messaging


* [Overview](#overview) * [Enabling Twilio IP Integration in API.AI](#enabling-twilio-ip-integration-in-apiai) * [Obtaning the Configuration Settings from Twilio](#obtaning-configuration-settings-from-twilio) * [Obtain Service Instance SID](#section-obtain-service-instance-sid) * [Obtain Account SID](#section-obtain-account-sid) * [Obtain API Key SID and Secret](#section-obtain-api-key-sid-and-secret) * [Launching Twilio IP Bot in API.AI](#launching-twilio-ip-bot-in-apiai) * [Testing Your Twilio IP Bot](#testing-your-twilio-ip-bot) [block:api-header] { "type": "basic", "title": "Overview" } [/block] **API.AI Twilio IP Messaging Integration** allows you to easily create Twilio IP Messaging bots with natural language understanding based on the API.AI technology. You can use our source code from <a href="https://github.com/api-ai/apiai-nodejs-client/tree/master/samples/twilio/ip-messaging">github</a> to create custom Twilio IP bots. [block:api-header] { "type": "basic", "title": "Enabling Twilio IP Integration in API.AI" } [/block] <a href="https://console.api.ai/api-client/#/newAgent" target="_blank">Create an API.AI agent</a> with the help of the <a href="https://docs.api.ai/docs/key-concepts" target="_blank">API.AI NLU technology tools</a>. To enable Twilio IP Messaging Integration, click ‘Integrations’ from the left side menu and turn Twilio IP integration on. [block:image] { "images": [ { "image": [ "https://files.readme.io/3c00a26-Twilio-IP-enable-integration.png", "Twilio-IP-enable-integration.png", 2028, 912, "#fbfbfb" ], "sizing": "full" } ] } [/block] In the integration settings, you'll be prompted to fill in the following fields: * Secret Instance SID * Account SID * API Key SID * API Secret [block:image] { "images": [ { "image": [ "https://files.readme.io/71ea3f6-Twilio-IP-Api-ai-fields.png", "Twilio-IP-Api-ai-fields.png", 2218, 1250, "#495162" ], "sizing": "full" } ] } [/block] To obtain these values, you'll need to log in to your Twilio account. [block:api-header] { "type": "basic", "title": "Obtaning Configuration Settings from Twilio" } [/block] ## Obtain Service Instance SID In your Twilio account, go to **Products > IP Messaging > IP Messaging Services** or just click <a href="https://www.twilio.com/user/account/ip-messaging/services" target="_blank">here</a>. Click 'Create an IP Messaging Service' button. [block:image] { "images": [ { "image": [ "https://files.readme.io/31bad3e-Twilio-IP-create-service.png", "Twilio-IP-create-service.png", 2238, 860, "#ebeef1" ], "sizing": "full" } ] } [/block] Name your new service and click 'Create'. [block:image] { "images": [ { "image": [ "https://files.readme.io/e2e6492-Twilio-IP-name-service.png", "Twilio-IP-name-service.png", 2256, 828, "#262626" ], "sizing": "full" } ] } [/block] On the page that will open, you'll see your Service SID. Copy and paste it to the respective field in the API.AI integration settings. [block:image] { "images": [ { "image": [ "https://files.readme.io/85ee3e3-Twilio-IP-SID-copy.png", "Twilio-IP-SID-copy.png", 2232, 1090, "#dfe8f0" ], "sizing": "full" } ] } [/block] Scroll down to the bottom of the page and click 'Save'. ## Obtain Account SID Go to **Products > IP Messaging > Getting Started** (or just click <a href="https://www.twilio.com/user/account/ip-messaging/getting-started" target="_blank">here</a>) and click on 'Show IP Credentials'. [block:image] { "images": [ { "image": [ "https://files.readme.io/9d5d996-Twilio-IP-Show-Credentials.png", "Twilio-IP-Show-Credentials.png", 2220, 862, "#edeff2" ], "sizing": "full" } ] } [/block] Copy the Account SID and paste it to the respective field in the API.AI integration settings. [block:image] { "images": [ { "image": [ "https://files.readme.io/bdbbaf4-Twilio-IP-Account-SID.png", "Twilio-IP-Account-SID.png", 2230, 806, "#dfe8f0" ], "sizing": "full" } ] } [/block] ## Obtain API Key SID and Secret Go to **Products > Dev Tools > API Keys** (or just click or just click <a href="https://www.twilio.com/user/account/ip-messaging/dev-tools/api-keys" target="_blank">here</a>) and click 'Creat an API Key'. [block:image] { "images": [ { "image": [ "https://files.readme.io/e75cf7e-Twilio-IP-create-API-key.png", "Twilio-IP-create-API-key.png", 2258, 994, "#edeff2" ], "sizing": "full" } ] } [/block] Create a name and click 'Create API Key'. [block:image] { "images": [ { "image": [ "https://files.readme.io/103cf3e-Twilio-IP-Login-to-chat.png", "Twilio-IP-Login-to-chat.png", 2058, 1078, "#393939" ], "sizing": "full" } ] } [/block] On the page that will open, you'll see Sid and Secret values. Copy and paste the values to the respective fields in the API.AI integration settings. [block:callout] { "type": "warning", "body": "This secret is only shown ONCE. Make note of it and store it in a safe, secure location." } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/2a82323-Twilio-IP-Sid-and-Secret.png", "Twilio-IP-Sid-and-Secret.png", 2194, 1192, "#e6eee6" ], "sizing": "full" } ] } [/block] [block:api-header] { "type": "basic", "title": "Launching Twilio IP Bot in API.AI" } [/block] After having inserted all the values obtained from your Twilio account to the respective fields in the API.AI Twilio IP integration settings, click 'Start' to launch your bot. [block:image] { "images": [ { "image": [ "https://files.readme.io/716b5d7-Twilio-IP-Api-ai-start.png", "Twilio-IP-Api-ai-start.png", 2192, 1224, "#485361" ], "sizing": "full" } ] } [/block] [block:api-header] { "type": "basic", "title": "Testing Your Twilio IP Bot" } [/block] Download the IP Messaging Demo Application from <a href="https://github.com/twilio/ip-messaging-demo-js" target="_blank">https://github.com/twilio/ip-messaging-demo-js</a> and unzip it. [block:image] { "images": [ { "image": [ "https://files.readme.io/b704ab8-Twilio-IP-download-from-Github.png", "Twilio-IP-download-from-Github.png", 2360, 1088, "#f4f5f6" ], "sizing": "full" } ] } [/block] Open the unzipped folder. Copy `credentials.example.json` to `credentials.json`. Plug your credentials into `credentials.json` and save the file. If you are on Mac, go to the unzipped directory in the Terminal and type the command `npm install` and then `npm start`. Open the local server in a browser: <a href="http://localhost:8080" target="_blank">http://localhost:8080</a>. Type in your name and click 'Log in As Guest'. [block:image] { "images": [ { "image": [ "https://files.readme.io/0513e5e-Twilio-IP-Login-to-chat.png", "Twilio-IP-Login-to-chat.png", 2058, 1078, "#393939" ], "sizing": "full" } ] } [/block] Click 'Channel for API.AI bot' and then, 'Join this Channel' at the bottom of the page. [block:image] { "images": [ { "image": [ "https://files.readme.io/93ff10a-Twilio-IP-join-api-ai-channel.png", "Twilio-IP-join-api-ai-channel.png", 2098, 552, "#292b2a" ], "sizing": "full" } ] } [/block] Test your bot. [block:image] { "images": [ { "image": [ "https://files.readme.io/e416313-Twilio-IP-test-your-bot.png", "Twilio-IP-test-your-bot.png", 2420, 1548, "#262626" ], "sizing": "full" } ] } [/block]