{"_id":"@ajhall/botbuilder-adapter-slack","_rev":"6-6a511552552f6c4f43a313b97246fa7c","time":{"1.0.11":"2020-07-23T02:59:48.736Z","created":"2020-07-23T03:00:49.966Z","1.0.11-republish":"2020-07-23T03:00:50.234Z","modified":"2022-04-04T12:26:44.845Z","1.0.12":"2020-07-23T03:06:05.583Z","1.0.13":"2020-07-23T03:10:52.749Z"},"name":"@ajhall/botbuilder-adapter-slack","dist-tags":{"latest":"1.0.13"},"versions":{"1.0.11-republish":{"name":"@ajhall/botbuilder-adapter-slack","version":"1.0.11-republish","description":"Forked version of Botkit for current Slack API.","main":"./lib/index.js","typings":"./lib/index.d.ts","scripts":{"build":"tsc","test":"tsc ; nyc mocha tests/*.tests.js","eslint":"eslint --fix src/*"},"author":{"name":"Microsoft Corp."},"license":"MIT","keywords":["slack","botkit","botbuilder","botframework","bots","chatbots","azure"],"homepage":"https://github.com/howdyai/botkit/blob/master/packages/botbuilder-adapter-slack#readme","bugs":{"url":"https://github.com/howdyai/botkit/issues"},"repository":{"type":"git","url":"git+https://github.com/howdyai/botkit.git"},"dependencies":{"@slack/web-api":"^5.8.0","botbuilder":"^4.9.0","botkit":"^4.9.0","debug":"^4.1.0"},"devDependencies":{"eslint":"^6.8.0","eslint-config-standard":"^14.1.0","eslint-plugin-import":"^2.20.0","eslint-plugin-node":"^11.0.0","eslint-plugin-promise":"^4.2.1","eslint-plugin-standard":"^4.0.1"},"_id":"@ajhall/botbuilder-adapter-slack@1.0.11-republish","_nodeVersion":"12.13.1","_npmVersion":"6.10.1","dist":{"integrity":"sha512-PJnmMYEHIFF8u4Rh4s9oiI2UKArMwTGJFtb6OIWXNRfh6Jae/WsmIEdPxQN5cFFrS6IpwQ9A7iPBoe0IrVsNCg==","shasum":"021db50f99cb3178e63fa53b7116d38eac26ace9","tarball":"https://registry.npmjs.org/@ajhall/botbuilder-adapter-slack/-/botbuilder-adapter-slack-1.0.11-republish.tgz","fileCount":28,"unpackedSize":207158,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfGP1iCRA9TVsSAnZWagAAXXAP/Ash1Br67/gOD8LW186/\nHCKeOJNxuZw+3sCBWuRr97ypO49Bh2XMsiWb3z//Ulx4Bxm31K02oYIf33f9\n7dEofb582yja9ZNzJT2kFakSlCyaffwdWbaRCggIJV8YF5ddVkq3z9dzwP5V\nqrG4m2PmTS5ZODWgLWKhhgKQF4XMBh8tMpnEkpEbBDKq36sHB86kJ63kHFQi\nRhjHoiWqSpHGhh/4I6AmPfLf7I3ScI1QRinPA4zgV+d1Tj+OTZAvRyQ6t0eF\n/XbFXyoO9WImIrZIWgt6Xcu3CduTiyAvHg9Q2oXb+Y3bDcMbXtw81XOkLEgM\nzQe0UqH4YdKPxJMKK4BbXGFDDxH1oo4Le4A0MLwH7ajCNuH5UWhYWQ9vk8dr\n1Aj+nXmGQ9CG6zWPx22Vk6co7PHMZqYhzOnb0BYnVWhgYdiIEh6QOLnNhdtp\n1oME88dRSfkoX1zoNYMatgpHStUAjSfCIH7JqWwEcZ1pUnR10x7/1LgHjWww\nhQ3SMvoWLq8dMiDRTyXU4N65oMQnvZEfmEOgUMbaHbrx0KYBCcPXzgmJ9uDT\n3PQdsvfT072OVNyjGQdo4RxJ9yiIPilvIRePOyCefxm3FW+yDRYKZ/IHojcU\nCAwUsk8Zjm5NCt7wAS07HKACg9+i5G3p+6wbi13RXvj8qQo+bcFSZ1b+ooin\nCqkd\r\n=SqhF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCuxLd6r1iOFw8ASllyKnWUuoMBK7WV1mL7eXGk4KIxRwIhAJsa2h0bywwCIGIL1fdqgbwmfRhac4GftefaiJ4kEIjF"}]},"maintainers":[{"name":"ajhall","email":"ajhall.us@gmail.com"}],"_npmUser":{"name":"ajhall","email":"ajhall.us@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/botbuilder-adapter-slack_1.0.11-republish_1595473250018_0.2630600689020768"},"_hasShrinkwrap":false},"1.0.12":{"name":"@ajhall/botbuilder-adapter-slack","version":"1.0.12","description":"Forked version of Botkit for current Slack API.","main":"./lib/index.js","typings":"./lib/index.d.ts","scripts":{"build":"tsc","test":"tsc ; nyc mocha tests/*.tests.js","eslint":"eslint --fix src/*"},"author":{"name":"Microsoft Corp."},"license":"MIT","keywords":["slack","botkit","botbuilder","botframework","bots","chatbots","azure"],"homepage":"https://github.com/howdyai/botkit/blob/master/packages/botbuilder-adapter-slack#readme","bugs":{"url":"https://github.com/howdyai/botkit/issues"},"repository":{"type":"git","url":"git+https://github.com/howdyai/botkit.git"},"dependencies":{"@slack/web-api":"^5.8.0","botbuilder":"^4.9.0","botkit":"^4.9.0","debug":"^4.1.0"},"devDependencies":{"eslint":"^6.8.0","eslint-config-standard":"^14.1.0","eslint-plugin-import":"^2.20.0","eslint-plugin-node":"^11.0.0","eslint-plugin-promise":"^4.2.1","eslint-plugin-standard":"^4.0.1"},"_id":"@ajhall/botbuilder-adapter-slack@1.0.12","_nodeVersion":"12.13.1","_npmVersion":"6.10.1","dist":{"integrity":"sha512-8qZiSbM0tsj0b0q52NyYeEu9ue/xRrAyOZxlwLoal8eWiKojlc3P4Q7MPucq5sJFunsGNQ2Nel3dhOAtfg/14w==","shasum":"18fdeabbc37c952772564156e1286712c8ce4565","tarball":"https://registry.npmjs.org/@ajhall/botbuilder-adapter-slack/-/botbuilder-adapter-slack-1.0.12.tgz","fileCount":28,"unpackedSize":207148,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfGP6dCRA9TVsSAnZWagAA18EP/jLBr3EiuaIKMCREXulM\n1lcyy105QDDecLSI6srHpFys2BswSNIF4qnA/H1/KvyQFHviYYbsgbG6eZlI\nlbkw4UcZCdeOpJY9aR1Jup7PP+y4YQiIuICo6buWo79JmueHXCNp48yJLSOm\nxwo8n2FMHqlrcsRhDAR+yJ9UDhrHSiesM6+DhusMOv9NwLMlAHIVsrZF9MEK\nxBYJGDLtHgfTnMQW0qiKqsVF7Xxg4jui9iRgwZSQjh834iHqhDU7RawadhUL\n+cRPv3/7RPsMIh/FJ/OEfDGgT654yKquu75GKWb8NCB82ccVxmpGolTzY+JS\njh0STPjga1Qp8ZZ1FBYsFpkYMgXihoWlEv6MQRytvWiptOizuBsLbT0ymmdc\nL9yydEwAi/diEAC3EeP7g+nP1wald/l9VyfUhnFwlF/Dg5UWBFheAqTzRE9D\nbaJWiaFFBoc06J7DAlc/0qGU+p7YwTCehn6uiKUkhnd40DFzOHEw1ECB22Cg\nVUU7oO02podX2j0899R9eaDKuloVchYLyOQZbOVQPo4l/CUEOe2uA4OK4FL0\nbxJNrArlhjZCMKsSXIXkbj48ooRg+Eu1kDNotpW72EPS0UJCPC+prfSXiEBx\ncMX5gkEROqzEJBMhqnIAl9td877iUenH67pGUUZAhY40+FET9Ku7jOjAW/zA\ngaXL\r\n=Yx0E\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHuINjCMII5D4LDAT7TygP1Pd3L238gUMuyLhCKupz9LAiA1LUErT8g6VmuOvQ2mc9AMMWHeXPo6NGZhGoGA2YD2aA=="}]},"maintainers":[{"name":"ajhall","email":"ajhall.us@gmail.com"}],"_npmUser":{"name":"ajhall","email":"ajhall.us@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/botbuilder-adapter-slack_1.0.12_1595473565450_0.5837761762987244"},"_hasShrinkwrap":false},"1.0.13":{"name":"@ajhall/botbuilder-adapter-slack","version":"1.0.13","description":"Forked version of Botkit for current Slack API.","main":"./lib/index.js","typings":"./lib/index.d.ts","scripts":{"build":"tsc","test":"tsc ; nyc mocha tests/*.tests.js","eslint":"eslint --fix src/*"},"author":{"name":"Microsoft Corp."},"license":"MIT","keywords":["slack","botkit","botbuilder","botframework","bots","chatbots","azure"],"homepage":"https://github.com/howdyai/botkit/blob/master/packages/botbuilder-adapter-slack#readme","bugs":{"url":"https://github.com/howdyai/botkit/issues"},"repository":{"type":"git","url":"git+https://github.com/howdyai/botkit.git"},"dependencies":{"@slack/web-api":"^5.8.0","botbuilder":"^4.9.0","botkit":"^4.9.0","debug":"^4.1.0"},"devDependencies":{"eslint":"^6.8.0","eslint-config-standard":"^14.1.0","eslint-plugin-import":"^2.20.0","eslint-plugin-node":"^11.0.0","eslint-plugin-promise":"^4.2.1","eslint-plugin-standard":"^4.0.1"},"_id":"@ajhall/botbuilder-adapter-slack@1.0.13","_nodeVersion":"12.13.1","_npmVersion":"6.10.1","dist":{"integrity":"sha512-GCeT+6c2sRa36BKKSkJtRrrRFOUyI0TaLDAeEhYST/znfuH623y0PIlgmYy3ZiG71cn54Q10L3+XY8ZVwsL+9Q==","shasum":"b3a3e98cf237e698ad4c4dea11bae98ae63eefa1","tarball":"https://registry.npmjs.org/@ajhall/botbuilder-adapter-slack/-/botbuilder-adapter-slack-1.0.13.tgz","fileCount":28,"unpackedSize":207172,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfGP+9CRA9TVsSAnZWagAAEAoP/RW+TsL1dw862MNLfTzx\nNKjnmbf92SLkQcOAum+ICKZpkww8IsYoF9l7PE0rrWk3ez9B6fc91v1xhPLW\npDRhxy4d7bwWmSV92rtmCAc4K7ZXUTdave+UnPL43frZdZSdeqF3C1Em+Cwy\nw9yE0S//RI+spvfRYTZtCeIt85m7AtvEFHYkMiO/eoyByHa8Yow0TqDy5rTy\nJxI+Y/oHBfUOd15qoBPyxvp1WZAuI4W6h3xBtNhMOVugJEXgE40BOJhO3hdF\nuKeQtCeeAktvXLfgP2W1RWFv+ksEbFrfoH04uC3w4wnCW+s0qVCYxuzF9+nY\n07o9/BML7Y273Olk143Y/O3FgC35y6vc+RdsdYqEo+WtYdvmgYhmayjAuBkL\nYMx7Z1fuZMuhzC25LjbyDAqe10bUFnQ+qifYURUya8rsplLfLyD5uW3JQfZo\nrhqvt06OV/j1GOQNe3mbhXXzZK7rOchLAlCNBMAP/hox1P2IQ1nkzNhowKCp\nUXGzS8LSy7PTg+jSPTVTNsnHgPy4hPJuVhbvmqYOxI3Rpn9ZMuy1OGnJsl9Q\nRVITxNcxcvutEqr0cAqG3Gwq6+woAHp4B7QJ9zMka1COOVuvTzGEw38YpjaI\n9l+y1g2K29nOqltm1doWqrxtZy9ZoQV4pryi0bSn245+w3+gqjF3FDt1mdSt\na7GX\r\n=SAUO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCOJKzXG8UDlwd2xEd1EA33sLvmxhL5WChsa/zR4nnG9AIgef6Oe8t0Xh9Gt9KYDggB/wR9vyPK6GmiUqBU9q8vq80="}]},"maintainers":[{"name":"ajhall","email":"ajhall.us@gmail.com"}],"_npmUser":{"name":"ajhall","email":"ajhall.us@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/botbuilder-adapter-slack_1.0.13_1595473852600_0.7057889180856676"},"_hasShrinkwrap":false}},"maintainers":[{"name":"ajhall","email":"ajhall.us@gmail.com"}],"description":"Forked version of Botkit for current Slack API.","homepage":"https://github.com/howdyai/botkit/blob/master/packages/botbuilder-adapter-slack#readme","keywords":["slack","botkit","botbuilder","botframework","bots","chatbots","azure"],"repository":{"type":"git","url":"git+https://github.com/howdyai/botkit.git"},"author":{"name":"Microsoft Corp."},"bugs":{"url":"https://github.com/howdyai/botkit/issues"},"license":"MIT","readme":"# botbuilder-adapter-slack\r\n\r\nConnect [Botkit](https://www.npmjs.com/package/botkit) or [BotBuilder](https://www.npmjs.com/package/botbuilder) to Slack.\r\n\r\nThis package contains an adapter that communicates directly with the Slack API,\r\nand translates messages to and from a standard format used by your bot. This package can be used alongside your favorite bot development framework to build bots that work with Slack.\r\n\r\n## Install Package\r\n\r\nAdd this package to your project using npm:\r\n\r\n```bash\r\nnpm install --save botbuilder-adapter-slack\r\n```\r\n\r\nImport the adapter class into your code:\r\n\r\n```javascript\r\nconst { SlackAdapter } = require('botbuilder-adapter-slack');\r\n```\r\n\r\n## Get Started\r\n\r\nIf you are starting a brand new project, [follow these instructions to create a customized application template.](https://botkit.ai/getstarted.html)\r\n\r\n## Use SlackAdapter in your App\r\n\r\nSlackAdapter provides a translation layer for Botkit and BotBuilder so that bot developers can connect to Slack and have access to the Slack's API.\r\n\r\n### Botkit Basics\r\n\r\nWhen used in concert with Botkit, developers need only pass the configured adapter to the Botkit constructor, as seen below. Botkit will automatically create and configure the webhook endpoints and other options necessary for communicating with Slack.\r\n\r\nDevelopers can then bind to Botkit's event emitting system using `controller.on` and `controller.hears` to filter and handle incoming events from the messaging platform. [Learn more about Botkit's core feature &rarr;](../docs/index.md).\r\n\r\n[A full description of the SlackAdapter options and example code can be found in the class reference docs.](../docs/reference/slack.md#create-a-new-slackadapter)\r\n\r\n```javascript\r\nconst adapter = new SlackAdapter({\r\n    clientSigningSecret: process.env.SLACK_SECRET,\r\n    botToken: process.env.SLACK_TOKEN\r\n});\r\n\r\nconst controller = new Botkit({\r\n    adapter,\r\n    // ...other options\r\n});\r\n\r\ncontroller.on('message', async(bot, message) => {\r\n    await bot.reply(message, 'I heard a message!');\r\n});\r\n```\r\n\r\n### BotBuilder Basics\r\n\r\nAlternately, developers may choose to use `SlackAdapter` with BotBuilder. With BotBuilder, the adapter is used more directly with a webserver, and all incoming events are handled as [Activities](https://docs.microsoft.com/en-us/javascript/api/botframework-schema/activity?view=botbuilder-ts-latest).\r\n\r\n```javascript\r\nconst adapter = new SlackAdapter({\r\n    clientSigningSecret: process.env.SLACK_SECRET,\r\n    botToken: process.env.SLACK_TOKEN\r\n});\r\n\r\nconst server = restify.createServer();\r\nserver.use(restify.plugins.bodyParser());\r\nserver.post('/api/messages', (req, res) => {\r\n     adapter.processActivity(req, res, async(context) => {\r\n         await context.sendActivity('I heard a message!');\r\n     });\r\n});\r\n```\r\n\r\n### Important URLs\r\n\r\nYour bot application will present several important URLs. You'll need to configure your Slack application profile with these urls.\r\n\r\nThe messaging endpoint, which receives all events from Slack is: `https://YOURBOT/api/messages`\r\n\r\nThe default \"install\" URL that triggers the oauth flow for multi-team installation is `https://YOURBOT/install`\r\n\r\nThe oauth callback URL (or \"redirect uri\") that should be added to your Slack application profile is `https://YOURBOT/install/auth`\r\n\r\n### Multi-team Support\r\n\r\nIn the examples above, the `SlackAdapter` constructor received a single `botToken` parameters. This binds the adapter and all API calls it makes to a single Slack workspace.\r\n\r\nTo use `SlackAdapter` with multiple Slack workspaces, the constructor must receive a a different set of parameters. These parameters allow the adapter to be configured to work as an oauth client application of Slack's API, and will expose an \"install link\" used to add the application to each Slack workspace.\r\n\r\nIn additionto fields related to oauth, the constructor must also receive 2 functions:\r\n\r\n* a parameter named `getTokenForTeam` that is responsible for returning a token value when provided a Slack workspace ID.\r\n* a parameter named `getBotUserByTeam` that is responsible for returning a bot's user id value when provided a Slack workspace ID.\r\n\r\nThe application must implement its own mechanism for securely storing and retrieving these values.\r\n\r\n```javascript\r\nconst adapter = new SlackAdapter({\r\n    clientSigningSecret: process.env.SLACK_SECRET,\r\n    clientId: process.env.CLIENT_ID, // oauth client id\r\n    clientSecret: process.env.CLIENT_SECRET, // oauth client secret\r\n    scopes: ['bot'], // oauth scopes requested, 'bot' deprecated by Slack in favor of granular permissions\r\n    redirectUri: process.env.REDIRECT_URI, // url to redirect post-login\r\n    oauthVersion: 'v1', // or use v2\r\n    getTokenForTeam: async(team_id) => {\r\n        // load the token for this team\r\n        // as captured during oauth \r\n    }, \r\n    getBotUserByTeam: async(team_id) = {\r\n        // load bot user id for this team   \r\n        // as captured during oauth \r\n    }\r\n});\r\n\r\n// Create a route for the install link.\r\n// This will redirect the user to Slack's permission request page.\r\ncontroller.webserver.get('/install', (req, res) => {\r\n    res.redirect(adapter.getInstallLink());\r\n});\r\n\r\n// Create a route to capture the results of the oauth flow.\r\n// this URL should match the value of the `redirectUri` passed to Botkit.\r\ncontroller.webserver.get('/install/auth', (req, res) => {\r\n    try {\r\n        const results = await controller.adapter.validateOauthCode(req.query.code);\r\n\r\n        // Store token by team in bot state.\r\n        let team = results.team_id; // results.team.id in oauth v2\r\n        let token = results.bot.bot_access_token; // results.access_token in oauth v2\r\n        let userId = results.bot.bot_user_id; // results.bot_user_id in oauth v2\r\n\r\n        // Securely store the token and usedId so that they can be retrieved later by the team id.\r\n        // ...\r\n\r\n        // customize your post-install success page\r\n        res.send('Success! Bot installed.');\r\n\r\n    } catch (err) {\r\n        console.error('OAUTH ERROR:', err);\r\n        // customize your post-install failure page\r\n        res.status(401);\r\n        res.send(err.message);\r\n    }\r\n});\r\n```\r\n\r\n### Using Slack's v2 OAuth\r\n\r\nTo use Slack's [newer \"granular scopes\"](https://api.slack.com/authentication/oauth-v2), specify `oauthVersion: 'v2'` in your adapter configuration.\r\nThis will cause the adapter to use the v2 oauth URL and credential validation function.\r\nHowever, note that the payload returned `validateOauthCode` differs between versions.\r\n\r\nIn v1, your bot's token will be located at `results.bot.bot_access_token`, whereas in v2, it will be `results.access_token`.\r\n\r\nIn v1, your bot's user id will be at `results.bot.bot_user_id`, whereas in v2 it will be `results.bot_user_id`.\r\n\r\nFrom Slack's official docs:\r\n\r\n* [V1 response payload](https://api.slack.com/methods/oauth.access#response)\r\n* [V2 response payload](https://api.slack.com/methods/oauth.v2.access#response)\r\n\r\nTake care to update your auth handler function when you migrate to granular scopes.\r\n\r\n## Class Reference\r\n\r\n* [SlackAdapter](../docs/reference/slack.md#slackadapter)\r\n* [BotWorker Extensions](../docs/reference/slack.md#slackbotworker)\r\n* [SlackMessageTypeMiddleware](../docs/reference/slack.md#slackmessagetypemiddleware)\r\n* [SlackEventMiddleware](../docs/reference/slack.md#slackeventmiddleware)\r\n\r\n\r\n## Event List\r\n\r\nBotkit will emit the following events: \r\n\r\n| Event | Description\r\n|--- |---\r\n| message | a message from a user received in a shared channel\r\n| event | all other events from Slack (unless middlewares enabled, see below)\r\n\r\nThis package includea a set of optional middleware that will modify the type of incoming events to match their Slack event types (rather than being cast into generic \"message or \"event\" types).\r\n\r\nMost Botkit developers who plan to use features above and beyond the basic send/receive API should enable these middleware.\r\n\r\nImport the adapter and the middlewares:\r\n\r\n```javascript\r\n// load SlackAdapter AND SlackEventMiddleware\r\nconst { SlackAdapter, SlackEventMiddleware, SlackMessageTypeMiddleware } = require('botbuilder-adapter-slack');\r\n```\r\n\r\nCreate your adapter (as above), then bind the middlewares to the adapter:\r\n\r\n```javascript\r\nadapter.use(new SlackEventMiddleware());\r\nadapter.use(new SlackMessageTypeMiddleware());\r\n```\r\n\r\nNow, Botkit will emit events with their original Slack names:\r\n\r\n```\r\ncontroller.on('channel_join', async(bot, message) => {\r\n    // do stuff\r\n});\r\n```\r\n\r\n## Calling Slack APIs\r\n\r\nThis package exposes a pre-configured [Slack API client](https://slack.dev/node-slack-sdk/web-api) for developers who want to use one of the many available API endpoints.\r\n\r\nIn Botkit handlers, the `bot` worker object passed into all handlers will contain a `bot.api` field that contains the client, preconfigured and ready to use.\r\n\r\n```javascript\r\ncontroller.on('message', async(bot, message) {\r\n\r\n    // load a user profile\r\n    let profile = await bot.api.users.info({user: message.user});\r\n\r\n});\r\n```\r\n\r\n## Botkit Extensions\r\n\r\nIn Botkit handlers, the `bot` worker for Slack contains [all of the base methods](../docs/reference/core.md#BotWorker) as well as the following platform-specific extensions:\r\n\r\n### [controller.getInstallLink()](../docs/reference/slack.md#getinstalllink)\r\n\r\nReturns the first step of an oauth-flow that results in the Botkit application being enabled on a workspace.\r\nUse this in concert with [multi-team support](#multi-team-support).\r\n\r\n### [controller.validateOauthCode()](../docs/reference/slack.md#validateoauthcode)\r\n\r\nThis method receives the oauth code returned by Slack at the end of the oauth-flow and returns all of the credentials and authentication details associated with it.  Use this to capture the workspace token and bot user ID needed for multi-team support.\r\n\r\n### Use attachments, blocks, and other rich message features\r\n\r\nBotkit will automatically construct your outgoing messages according to Slack's specifications. To use attachments, blocks or other features, add them to the message object used to create the reply.\r\n\r\n**Use Block Kit Blocks**\r\n\r\nThe preferred way of composing interactive messages is using Slack's Block Kit.  [Read the official Slack documentation here](https://api.slack.com/messaging/composing/layouts). Slack provides a UI to help create your interactive messages. Check out [Block Kit Builder](https://api.slack.com/tools/block-kit-builder).\r\n\r\nInteractive messages using blocks can be sent via any of Botkit's built in functions by passing in the appropriate \"blocks\" as part of the message.  Here is an example:\r\n\r\n```javascript\r\nconst content = {\r\n    blocks: [{...}]; // insert valid JSON following Block Kit specs\r\n};\r\n\r\nawait bot.reply(message, content);\r\n```\r\n\r\n**Use \"Secondary\" Attachments**\r\n\r\nAttachments are still supported by Slack, but the preferred way is to use Block Kit. [Read the official Slack documentation here](https://api.slack.com/reference/messaging/attachments)\r\n\r\n\r\n### [Spawn a worker](../docs/reference/slack.md#create-a-new-slackbotworker)\r\n\r\nIt is possible to spawn bot workers bound to a specific team by passing the team ID as the primary parameter to `controller.spawn()`:\r\n\r\n```javascript\r\nlet bot = await controller.spawn(SLACK_TEAM_ID);\r\n```\r\n\r\n### Start or resume conversations with people\r\n\r\nUse these method to initiate a conversation with a user, or in a specific channel or thread. After calling these methods, any further actions carried out by the bot worker will happen in that context.\r\n\r\nThis can be used to create or resume conversations with users that are not in direct response to an incoming message, like those sent on a schedule or in response to external events.\r\n\r\n* [bot.startPrivateConversation()](../docs/reference/slack.md#startprivateconversation)\r\n* [bot.startConversationInChannel()](../docs/reference/slack.md#startconversationinchannel)\r\n* [bot.startConversationInThread()](../docs/reference/slack.md#startconversationinthread)\r\n\r\n### Slash Commands\r\n\r\nSlash commands are special commands triggered by typing a \"/\" then a command. They are configured inside Slack's API portal.\r\n\r\n[Read Slack's documentation for Slash commands here &rarr;](https://api.slack.com/slash-commands)\r\n\r\nWhen a Botkit application receives a request from a slash command, it will emit a `slash_command` event that can be handled using `controller.on()`.  Several additional reply methods have been provided to handle slash commands.\r\n\r\n* [bot.replyPublic()](../docs/reference/slack.md#replypublic)\r\n* [bot.replyPrivate()](../docs/reference/slack.md#replyprivate)\r\n\r\n```javascript\r\ncontroller.on('slash_command', async(bot, message) => { \r\n\r\n    // the /<command> part\r\n    let command = message.command;\r\n    // the /command <parameters> part\r\n    let parameter = message.text;\r\n\r\n    await bot.replyPublic(message, 'My response to your command is: ...');\r\n\r\n});\r\n```\r\n\r\nNote that if you would prefer to send a response to the Slash command via the synchronous http response back to Slack, you can achieve this by using [bot.httpBody()](../docs/reference/core.md#httpbody).\r\n\r\n```javascript\r\ncontroller.on('slash_command', async(bot, message) => {\r\n    bot.httpBody({text:'You can send an immediate response using bot.httpBody()'});\r\n});\r\n```\r\n\r\n### Work with threads\r\n\r\nMessages in Slack may now exist as part of a thread, separate from the messages included in the main channel. Threads can be used to create new and interesting interactions for bots.\r\n\r\nBotkit's default behavior is for replies to be sent in-context. That is, if a bot replies to a message in a main channel, the reply will be added to the main channel. If a bot replies to a message in a thread, the reply will be added to the thread. This behavior can be changed by using one of the following specialized functions:\r\n\r\n* [bot.replyInThread()](../docs/reference/slack.md#replyinthread)\r\n* [bot.startConversationInThread()](../docs/reference/slack.md#startconversationinthread)\r\n\r\n### Ephemeral Messages\r\n\r\nMessages can be sent to a user \"ephemerally\" which will only show to them, and no one else. [Learn more about ephemeral messages at the Slack API Documentation.](https://api.slack.com/methods/chat.postEphemeral)\r\n\r\n* [bot.replyEphemeral()](../docs/reference/slack.md#replyephemeral)\r\n\r\n### Interactive messages\r\n\r\nSlack applications can use \"interactive messages\" to include buttons, menus and other interactive elements to improve the user's experience. [See here for how to attach cards and blocks.](#use-attachments-blocks-and-other-rich-message-features)\r\n\r\nIf your interactive message contains a button, when the user clicks the button in Slack, Botkit triggers an event based on the message type.\r\n\r\nWhen an event is received, your bot can either reply normally, or use the special `bot.replyInteractive` function which will result in the original message in Slack being _replaced_ by the reply. Using `replyInteractive`, bots can present dynamic interfaces inside a single message.\r\n\r\nTo receive callbacks, register a callback url as part of applications configuration. Botkit's built in support for the Slack Button system supports interactive message callbacks at same url as other events (`/api/messages` by default). \r\n\r\n* [bot.replyInteractive()](../docs/reference/slack.md#replyinteractive)\r\n\r\n### Work with Slack Dialogs\r\n\r\n[Dialogs](https://api.slack.com/dialogs) allow bots to present multi-field pop-up forms in response to a button click or other interactive message interaction.\r\nBotkit provides helper functions and special events to make using dialogs in your app possible.\r\n\r\nDialogs can be created in response to `interactive_message` or `slash_command` events.\r\nBotkit provides a specialized reply function, `bot.replyWithDialog()` and a object builder class,\r\n`SlackDialog` that should be used to create and send the dialog.\r\n\r\n* [bot.replyWithDialog()](../docs/reference/slack.md#replywithdialog)\r\n* [bot.dialogError()](../docs/reference/slack.md#dialogerror)\r\n* [SlackDialog](../docs/reference/slack.md#slackdialog)\r\n\r\n### Update and remove messages\r\n\r\nSlack supports updating and deleting messages. Do so with the following convenience methods:\r\n\r\n* [bot.updateMessage()](../docs/reference/slack.md#updatemessage)\r\n* [bot.deleteMessage()](../docs/reference/slack.md#deletemessage)\r\n\r\n## Community & Support\r\n\r\nJoin our thriving community of Botkit developers and bot enthusiasts at large.\r\nOver 10,000 members strong, [our open Slack group](https://community.botkit.ai) is\r\n_the place_ for people interested in the art and science of making bots.\r\nCome to ask questions, share your progress, and commune with your peers!\r\n\r\nYou can also find help from members of the Botkit team [in our dedicated Cisco Spark room](https://eurl.io/#SyNZuomKx)!\r\n\r\n## About Botkit\r\n\r\nBotkit is a part of the [Microsoft Bot Framework](https://dev.botframework.com).\r\n\r\nWant to contribute? [Read the contributor guide](https://github.com/howdyai/botkit/blob/master/CONTRIBUTING.md)\r\n\r\nBotkit is released under the [MIT Open Source license](https://github.com/howdyai/botkit/blob/master/LICENSE.md)\r\n","readmeFilename":"readme.md"}