{"__v":0,"_id":"5845a4a99f6fbb1b004307ff","category":{"version":"5845a4a89f6fbb1b004307b7","project":"54d3007669578e0d002730c9","_id":"5845a4a89f6fbb1b004307bd","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-07-08T18:48:02.369Z","from_sync":false,"order":5,"slug":"integrations","title":"Integrations"},"parentDoc":null,"project":"54d3007669578e0d002730c9","user":"55bf6cdcad601c2b00762d13","version":{"__v":1,"_id":"5845a4a89f6fbb1b004307b7","project":"54d3007669578e0d002730c9","createdAt":"2016-12-05T17:32:24.708Z","releaseDate":"2016-12-05T17:32:24.708Z","categories":["5845a4a89f6fbb1b004307b8","5845a4a89f6fbb1b004307b9","5845a4a89f6fbb1b004307ba","5845a4a89f6fbb1b004307bb","5845a4a89f6fbb1b004307bc","5845a4a89f6fbb1b004307bd","5845a4a89f6fbb1b004307be","5845a4a89f6fbb1b004307bf","5845a4a89f6fbb1b004307c0"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"25.0.0","version":"25"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-03-01T01:01:37.173Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"* [Overview](#overview)\n* [Setting Up Slack Integration in API.AI](#setting-up-slack-integration-in-apiai)\n* [Testing Your Agent in Slack](#testing-your-agent-in-slack)\n* [Making Your Bot Public](#making-your-bot-public)\n * [Creating Slack App](#section-creating-slack-app)\n * [Authentication](#section-authentication)\n * [Creating Bot User](#section-creating-bot-user)\n * [Configuring 'Add to Slack' Button](#section-configuring-add-to-slack-button)\n* [Another Way to Integrate API.AI with Slack](#another-way-to-integrate-apiai-with-slack)\n* [Related Topics](#related-topics)\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Overview\"\n}\n[/block]\nAPI.AI Slack Integration makes it easy to create your <a href=\"https://api.slack.com/slack-apps\" target=\"_blank\">Slack apps</a> and <a href=\"https://api.slack.com/bot-users\" target=\"_blank\">Slack bots</a> and train them to understand natural language.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Setting Up Slack Integration in API.AI\"\n}\n[/block]\nTo enable Slack Integration, click ‘Integrations’ from the left side menu and turn Slack integration on. \n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/y1SBnMLmTbiXL0xyxWr9_Slack-integration-enable.png\",\n        \"Slack-integration-enable.png\",\n        \"2078\",\n        \"986\",\n        \"#2d9be0\",\n        \"\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\nTo define the way people can interact with your bot, tick the relevant checkboxes in the ‘Message Types’ section.\n\n* **Direct message.** The bot will receive a direct message from a user.\n* **Direct mention.** The bot will answer when mentioned at the beginning of a message.\n* **Mention**. The bot will answer when mentioned in any part of a message.\n* **Ambient**. The bot will monitor any message in a channel.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/N3e2xxVwSEkyVIYdo1z7_Slack-message-type.png\",\n        \"Slack-message-type.png\",\n        \"2220\",\n        \"800\",\n        \"#143b5b\",\n        \"\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Testing Your Agent in Slack\"\n}\n[/block]\nBefore publishing your agent as a Slack bot or App, you can run it in test mode. To do this, connect it to your Slack account by clicking 'Test in Slack' and then signing in with your team account. The API.AI Bot will appear in your Slack team members list.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"A test bot has the default name API.AI Bot. To give your Slack bot a custom name, you need to [make your bot public](#making-your-bot-public).\"\n}\n[/block]\nYou can add new intents into your agent and test them right away via the bot. \n\nTo stop the test, click the 'Shutdown test bot' button.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Making Your Bot Public\"\n}\n[/block]\n##Creating a Slack App\n\nWhen you’re ready to publish your bot to the community, <a href=\"https://api.slack.com/slack-apps\" target=\"_blank\">go to the Slack Apps webpage</a> where you can find all the necessary documentation. Click on ‘My apps’ from the top menu, and then on ‘Create a new application’.\n\nYou’ll be asked to fill in the app name, descriptions of the app and a Redirect URI. Use the Redirect URI from your API.AI agent’s Slack Integration settings. \n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/sWB3yTXWTBI0E5WETTRE_SlackAPI.gif\",\n        \"SlackAPI.gif\",\n        \"1050\",\n        \"677\",\n        \"#2fa6cc\",\n        \"\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\n##Authentication\n\nAfter clicking on the ‘Create application’ button, you’ll see your Client ID and Client Secret. Go to your API.AI agent’s Slack integration settings and fill in the Client ID and Client Secret fields with the values from your Slack app’s settings. Then click 'Go online'.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/cQO0xuCvTqihMrZD5e8f_ClientIDClientSecret3.png\",\n        \"ClientIDClientSecret3.png\",\n        \"2558\",\n        \"1126\",\n        \"#1d9b5e\",\n        \"\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\n##Creating Bot User\n\nGo back to your app settings on the Slack webpage, scroll down to the ‘Bot User’ section, and configure a new Bot user for your app by clicking on ‘Add a bot to this app’ button.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/sohKxSKcTn6AgJXxdXax_Slack_Bot_User.gif\",\n        \"Slack_Bot_User.gif\",\n        \"1066\",\n        \"677\",\n        \"#6b4d32\",\n        \"\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\n##Configuring 'Add to Slack' Button\n\nScroll up to the top of the page and click the ‘Add to Slack’ link. The <a href=\"https://api.slack.com/docs/slack-button\" target=\"_blank\">Slack button page</a> will open.\n\nScroll down to the ‘Add to Slack button’ section. Uncheck ‘incoming webhook’ and tick the ‘bot’ checkbox, which generates the HTML code for the ‘Add to Slack’ button that can be added to your website.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/qRyKNQymhsOQBBuBVQ2x_Slack_button.gif\",\n        \"Slack_button.gif\",\n        \"1066\",\n        \"677\",\n        \"#6b4d33\",\n        \"\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]\nTo launch the bot for your Slack team(s), just click the button ‘Add to Slack’ above the generated code.\n\nIf you intend to make your bot accessible to other teams, you’ll need to place the ‘Add to Slack’ button on your website, so that anyone can launch your bot by clicking it.\n\nThe following instructional video will lead you through the entire integration process step by step.\n[block:embed]\n{\n  \"html\": \"<iframe class=\\\"embedly-embed\\\" src=\\\"//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FcCCKOLFEXBU%3Ffeature%3Doembed&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DcCCKOLFEXBU%26feature%3Dyoutu.be&image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FcCCKOLFEXBU%2Fhqdefault.jpg&key=02466f963b9b4bb8845a05b53d3235d7&type=text%2Fhtml&schema=youtube\\\" width=\\\"640\\\" height=\\\"480\\\" scrolling=\\\"no\\\" frameborder=\\\"0\\\" allowfullscreen></iframe>\",\n  \"url\": \"https://www.youtube.com/watch?v=cCCKOLFEXBU&feature=youtu.be\",\n  \"title\": \"Pizza Delivery Agent for Slack\",\n  \"favicon\": \"https://s.ytimg.com/yts/img/favicon-vflz7uhzw.ico\",\n  \"image\": \"https://i.ytimg.com/vi/cCCKOLFEXBU/hqdefault.jpg\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"If you want to have your bot published in the <a href=\\\"https://slack.com/apps\\\" target=\\\"_blank\\\">Slack App Directory</a>, you have to register as a developer and go through the Slack approval process.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Another Way to Integrate API.AI with Slack\"\n}\n[/block]\nIf you’d like to host your bot on your own server, you might prefer using our  <a href=\"https://github.com/api-ai/api-ai-slack-bot\" target=\"_blank\">Slack Integration Toolkit</a>. It also gives you the flexibility to customize the action processing logic.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Related Topics\"\n}\n[/block]\n- <a href=\"https://docs.api.ai/docs/slack-webhook-integration-guideline\" target=\"_blank\">Slack + Webhook Integration Example</a>","excerpt":"","slug":"slack-integration","type":"basic","title":"Slack Integration"}
* [Overview](#overview) * [Setting Up Slack Integration in API.AI](#setting-up-slack-integration-in-apiai) * [Testing Your Agent in Slack](#testing-your-agent-in-slack) * [Making Your Bot Public](#making-your-bot-public) * [Creating Slack App](#section-creating-slack-app) * [Authentication](#section-authentication) * [Creating Bot User](#section-creating-bot-user) * [Configuring 'Add to Slack' Button](#section-configuring-add-to-slack-button) * [Another Way to Integrate API.AI with Slack](#another-way-to-integrate-apiai-with-slack) * [Related Topics](#related-topics) [block:api-header] { "type": "basic", "title": "Overview" } [/block] API.AI Slack Integration makes it easy to create your <a href="https://api.slack.com/slack-apps" target="_blank">Slack apps</a> and <a href="https://api.slack.com/bot-users" target="_blank">Slack bots</a> and train them to understand natural language. [block:api-header] { "type": "basic", "title": "Setting Up Slack Integration in API.AI" } [/block] To enable Slack Integration, click ‘Integrations’ from the left side menu and turn Slack integration on. [block:image] { "images": [ { "image": [ "https://files.readme.io/y1SBnMLmTbiXL0xyxWr9_Slack-integration-enable.png", "Slack-integration-enable.png", "2078", "986", "#2d9be0", "" ], "sizing": "full" } ] } [/block] To define the way people can interact with your bot, tick the relevant checkboxes in the ‘Message Types’ section. * **Direct message.** The bot will receive a direct message from a user. * **Direct mention.** The bot will answer when mentioned at the beginning of a message. * **Mention**. The bot will answer when mentioned in any part of a message. * **Ambient**. The bot will monitor any message in a channel. [block:image] { "images": [ { "image": [ "https://files.readme.io/N3e2xxVwSEkyVIYdo1z7_Slack-message-type.png", "Slack-message-type.png", "2220", "800", "#143b5b", "" ], "sizing": "full" } ] } [/block] [block:api-header] { "type": "basic", "title": "Testing Your Agent in Slack" } [/block] Before publishing your agent as a Slack bot or App, you can run it in test mode. To do this, connect it to your Slack account by clicking 'Test in Slack' and then signing in with your team account. The API.AI Bot will appear in your Slack team members list. [block:callout] { "type": "info", "body": "A test bot has the default name API.AI Bot. To give your Slack bot a custom name, you need to [make your bot public](#making-your-bot-public)." } [/block] You can add new intents into your agent and test them right away via the bot. To stop the test, click the 'Shutdown test bot' button. [block:api-header] { "type": "basic", "title": "Making Your Bot Public" } [/block] ##Creating a Slack App When you’re ready to publish your bot to the community, <a href="https://api.slack.com/slack-apps" target="_blank">go to the Slack Apps webpage</a> where you can find all the necessary documentation. Click on ‘My apps’ from the top menu, and then on ‘Create a new application’. You’ll be asked to fill in the app name, descriptions of the app and a Redirect URI. Use the Redirect URI from your API.AI agent’s Slack Integration settings. [block:image] { "images": [ { "image": [ "https://files.readme.io/sWB3yTXWTBI0E5WETTRE_SlackAPI.gif", "SlackAPI.gif", "1050", "677", "#2fa6cc", "" ], "sizing": "full" } ] } [/block] ##Authentication After clicking on the ‘Create application’ button, you’ll see your Client ID and Client Secret. Go to your API.AI agent’s Slack integration settings and fill in the Client ID and Client Secret fields with the values from your Slack app’s settings. Then click 'Go online'. [block:image] { "images": [ { "image": [ "https://files.readme.io/cQO0xuCvTqihMrZD5e8f_ClientIDClientSecret3.png", "ClientIDClientSecret3.png", "2558", "1126", "#1d9b5e", "" ], "sizing": "full" } ] } [/block] ##Creating Bot User Go back to your app settings on the Slack webpage, scroll down to the ‘Bot User’ section, and configure a new Bot user for your app by clicking on ‘Add a bot to this app’ button. [block:image] { "images": [ { "image": [ "https://files.readme.io/sohKxSKcTn6AgJXxdXax_Slack_Bot_User.gif", "Slack_Bot_User.gif", "1066", "677", "#6b4d32", "" ], "sizing": "full" } ] } [/block] ##Configuring 'Add to Slack' Button Scroll up to the top of the page and click the ‘Add to Slack’ link. The <a href="https://api.slack.com/docs/slack-button" target="_blank">Slack button page</a> will open. Scroll down to the ‘Add to Slack button’ section. Uncheck ‘incoming webhook’ and tick the ‘bot’ checkbox, which generates the HTML code for the ‘Add to Slack’ button that can be added to your website. [block:image] { "images": [ { "image": [ "https://files.readme.io/qRyKNQymhsOQBBuBVQ2x_Slack_button.gif", "Slack_button.gif", "1066", "677", "#6b4d33", "" ], "sizing": "full" } ] } [/block] To launch the bot for your Slack team(s), just click the button ‘Add to Slack’ above the generated code. If you intend to make your bot accessible to other teams, you’ll need to place the ‘Add to Slack’ button on your website, so that anyone can launch your bot by clicking it. The following instructional video will lead you through the entire integration process step by step. [block:embed] { "html": "<iframe class=\"embedly-embed\" src=\"//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FcCCKOLFEXBU%3Ffeature%3Doembed&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DcCCKOLFEXBU%26feature%3Dyoutu.be&image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FcCCKOLFEXBU%2Fhqdefault.jpg&key=02466f963b9b4bb8845a05b53d3235d7&type=text%2Fhtml&schema=youtube\" width=\"640\" height=\"480\" scrolling=\"no\" frameborder=\"0\" allowfullscreen></iframe>", "url": "https://www.youtube.com/watch?v=cCCKOLFEXBU&feature=youtu.be", "title": "Pizza Delivery Agent for Slack", "favicon": "https://s.ytimg.com/yts/img/favicon-vflz7uhzw.ico", "image": "https://i.ytimg.com/vi/cCCKOLFEXBU/hqdefault.jpg" } [/block] [block:callout] { "type": "info", "body": "If you want to have your bot published in the <a href=\"https://slack.com/apps\" target=\"_blank\">Slack App Directory</a>, you have to register as a developer and go through the Slack approval process." } [/block] [block:api-header] { "type": "basic", "title": "Another Way to Integrate API.AI with Slack" } [/block] If you’d like to host your bot on your own server, you might prefer using our <a href="https://github.com/api-ai/api-ai-slack-bot" target="_blank">Slack Integration Toolkit</a>. It also gives you the flexibility to customize the action processing logic. [block:api-header] { "type": "basic", "title": "Related Topics" } [/block] - <a href="https://docs.api.ai/docs/slack-webhook-integration-guideline" target="_blank">Slack + Webhook Integration Example</a>