{"_id":"@botbuildercommunity/adapter-twilio-whatsapp","_rev":"6-4832f1ba6c3699e8641ab5411feb0225","name":"@botbuildercommunity/adapter-twilio-whatsapp","dist-tags":{"latest":"1.2.0"},"versions":{"0.1.0":{"name":"@botbuildercommunity/adapter-twilio-whatsapp","version":"0.1.0","description":"Twilio WhatsApp adapter for use with the Bot Framework.","main":"./lib/index.js","typings":"./lib/index.d.ts","directories":{"lib":"lib"},"scripts":{"build":"tsc","test":"tsc && mocha tests/ --exit"},"repository":{"type":"git","url":"git+https://github.com/BotBuilderCommunity/botbuilder-community-js.git"},"keywords":["chatbots","bot framework","bot builder","whatsapp adapter","adapters","whatsapp"],"contributors":[{"name":"Bot Builder Community"},{"name":"Mick Vleeshouwer","email":"mick@imick.nl"}],"license":"MIT","bugs":{"url":"https://github.com/BotBuilderCommunity/botbuilder-community-js/issues"},"homepage":"https://github.com/BotBuilderCommunity/botbuilder-community-js#readme","dependencies":{"botbuilder":"^4.5.3","twilio":"^3.33.2"},"devDependencies":{"mocha":"^5.2.0","nock":"^10.0.6","tslint":"^5.18.0","tslint-microsoft-contrib":"^5.2.1","typescript":"^3.5.3"},"_id":"@botbuildercommunity/adapter-twilio-whatsapp@0.1.0","_nodeVersion":"10.16.1","_npmVersion":"6.9.0","dist":{"integrity":"sha512-iXUQrdbV2iqIePii1hcy1i6HbRl9jnWTcz0Xbg7cIxBkQltrLZp7EgumNC0WwdmpdbexMfx/9n5We6PKG5W9Qw==","shasum":"1814377ed9dc78c64c03b37c04c2a5efc76de134","tarball":"https://registry.npmjs.org/@botbuildercommunity/adapter-twilio-whatsapp/-/adapter-twilio-whatsapp-0.1.0.tgz","fileCount":13,"unpackedSize":56047,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdRuLaCRA9TVsSAnZWagAA49YQAJUyDFCqbzfImXes8hEX\n9IIn8Jl/4zeNFXb5iaLhweNbAu98SnbtMhiiM5kQR0uQ/W/wTpVnu/utyc80\nFH8Y54o2OR5XnFhCew98gL8gXHd1cKIv1+W+6FcqdjVwJBu6F9xSrG9Mz03m\nodYbT6X5+LlW8LCW1d9qTu4i9zQym0a6bNcdffzQbC36yzuZHdvZlafdqZ9D\nzf4tvEC4bvtd6ZAgPr3QCatf4h2SO0zYKL8qK2zggeoHPlMhN+UeTf1YfZvK\nJbh1VQ17C8O69ARBvty7evnsqR1W8RN88RQYYDeZ+dEunaVNF++3PoluZ2eS\nf9g5pUhGLHkPTckBKB/YyjEPwk6mbpHJfVRvqHIoc10yLlNKnLsigBOevWAO\nex0Nr/ZoaCJDuUGwA2ztfVTY3cECGmT1xRM7eukgzmc90M1re4DtuXo7O+UH\n5LWVaWLMacGg1eE9bXwXpwsfUp7QrQF4j9nwS1cnJ0EtPeruhXZVGhO9MGTT\n5HNvVacACgH1eos/LunCRQIPLujJhmxUr5DI/WBuW/NZ1a9T2lNePBs2Qn//\nl/MyxIKdPpmO4t/XeU3HNrP7mJYXxtMjldCyJtBcg14lD2AYowYgP+n/wx0n\ngXLrbJeuLVCirwEJEOxrX5LPXT4jcNPDv5GSWbXM/qTDrowla6tCoG3Y8iGV\n8TuF\r\n=S0YP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEt3BljNvkF8GkxkuCc6caW1H5/uE1dDftbiZvwxZj6zAiEA/KOiRHHXfgSRKRvdRFrUnG7Cr58uybUXQ5C+dnbTzmY="}]},"maintainers":[{"name":"cloudguy_pro","email":"stephan@bisser.at"},{"name":"szul","email":"michael@szul.us"},{"name":"jamesemann","email":"james.mann@bcs.org"}],"_npmUser":{"name":"szul","email":"michael@szul.us"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/adapter-twilio-whatsapp_0.1.0_1564926681439_0.10947787826821487"},"_hasShrinkwrap":false},"1.0.0":{"name":"@botbuildercommunity/adapter-twilio-whatsapp","version":"1.0.0","description":"Twilio WhatsApp adapter for use with the Bot Framework.","main":"./lib/index.js","typings":"./lib/index.d.ts","directories":{"lib":"lib"},"scripts":{"build":"tsc","test":"tsc && mocha","test-ci":"tsc && mocha --reporter xunit --reporter-options output=./mocha-test-results.xml --reporter-options suiteName=$npm_package_name"},"engines":{"node":">=10.0.0"},"repository":{"type":"git","url":"git+https://github.com/BotBuilderCommunity/botbuilder-community-js.git"},"keywords":["chatbots","bot framework","bot builder","whatsapp adapter","adapters","whatsapp"],"contributors":[{"name":"Bot Builder Community"},{"name":"Mick Vleeshouwer","email":"mick@imick.nl"}],"license":"MIT","bugs":{"url":"https://github.com/BotBuilderCommunity/botbuilder-community-js/issues"},"homepage":"https://github.com/BotBuilderCommunity/botbuilder-community-js#readme","dependencies":{"botbuilder":"^4.5.3","twilio":"^3.33.2"},"devDependencies":{"mocha":"^6.2.0","nock":"^10.0.6","typescript":"^3.5.3"},"publishConfig":{"access":"public"},"_id":"@botbuildercommunity/adapter-twilio-whatsapp@1.0.0","_nodeVersion":"10.16.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-Bz/LAFjOvfm19BP5XvEPViQJtPas9Zl87MJKHMWnCdqi64xxi+UorPe7DUAhhvENzisRkKRuM269Z7REcYTZdw==","shasum":"fd2f23d797becac75ec1eae356cc5acbcaaa12cd","tarball":"https://registry.npmjs.org/@botbuildercommunity/adapter-twilio-whatsapp/-/adapter-twilio-whatsapp-1.0.0.tgz","fileCount":12,"unpackedSize":53409,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjhJNCRA9TVsSAnZWagAAFZkQAJ28fMCz6AEAtFThgNkA\njuwHkVJbNooyYbK36yho1DvKJiMVjMRNHs+cVxZOPbmtJtfTg4W5idkRybWb\nwxVxcmwRNQnJj/2ju+68hc13ww88XGnFeoXiRU8IER2Kv1Ndr5zh1lglFM9x\nFmSRic6OEa/ZQtbOIq9+aZMPxVUK4P2Tlz8TKxCkVDS/5ivCrqgvFvtCBDi0\n7GUgA5fTgZtARKutExfekmOsG5FJU0kzXtQjOa2wvpapHpomfRo12F4TmYXm\nZI+bCa5s0+vxkB/cmmIi6YhH6TdDSZVf5zmKSS8Nw6Nhblb6C8ecgEw1DXqj\n77MI9NE6uLbq6DfpUdnHKuNIdhx9SU1KlCPJ5iBtntrRRiufRJ15mW8F92BH\nQ4HSQhfbCTyDOwdNjQDBCwH0DtwnsXHsf2G2XweWw9zFfmjTdtLglx4jiMKN\nYBGUiIWJudO96/u+JOOZXLGcANaK+DV9hvcMXezkHHl7g62Dd15zRhvlbqoL\nq+cR70wN2kUtIlOknvfEjb0tDYJFIUSMKHdPDT6xaMgq1GHMADb5FeEypVtV\n0YaNGtbdocubUFemVlXCGw6GmuIBnuXWJI1hz2Oxz75We0RUKH+YFTvd7CnS\nPqyGoOyZ7ajitTEMeOoSlNnZVHPbtFvrIHehF04JuqSzhels9V2nQjZupR4i\nvhol\r\n=wZ0a\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEUKhxAeGY7hCbUHTCMBaosgxPkT90l/ncq0ZZ7BrjzSAiA4+fnKKPTp/rHcwJfTTK2e7N6fLXf4gv5kWcTGq455AA=="}]},"maintainers":[{"name":"cloudguy_pro","email":"stephan@bisser.at"},{"name":"jamesemann","email":"james.mann@bcs.org"},{"name":"szul","email":"michael@szul.us"}],"_npmUser":{"name":"szul","email":"michael@szul.us"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/adapter-twilio-whatsapp_1.0.0_1569591885248_0.1829102358244219"},"_hasShrinkwrap":false},"1.1.0":{"name":"@botbuildercommunity/adapter-twilio-whatsapp","version":"1.1.0","description":"Twilio WhatsApp adapter for use with the Bot Framework.","main":"./lib/index.js","typings":"./lib/index.d.ts","directories":{"lib":"lib"},"nyc":{"extends":"@istanbuljs/nyc-config-typescript","all":true,"check-coverage":true,"lines":0,"statements":0,"functions":0,"branches":0,"exclude":["**/*.d.ts","**/*.test.js"],"reporter":["text","cobertura","html"],"report-dir":"./.nyc_output/coverage"},"scripts":{"build":"tsc","test":"tsc && nyc mocha","test-ci":"tsc && nyc mocha --reporter xunit --reporter-options output=./mocha-test-results.xml --reporter-options suiteName=$npm_package_name"},"engines":{"node":">=10.0.0"},"repository":{"type":"git","url":"git+https://github.com/BotBuilderCommunity/botbuilder-community-js.git"},"keywords":["chatbots","bot framework","bot builder","whatsapp adapter","adapters","whatsapp","twilio","twilio-whatsapp"],"contributors":[{"name":"Bot Builder Community"},{"name":"Mick Vleeshouwer","email":"mick@imick.nl"}],"license":"MIT","bugs":{"url":"https://github.com/BotBuilderCommunity/botbuilder-community-js/issues"},"homepage":"https://github.com/BotBuilderCommunity/botbuilder-community-js#readme","dependencies":{"botbuilder":"^4.7.2","twilio":"^3.39.4"},"devDependencies":{"@istanbuljs/nyc-config-typescript":"^1.0.1","mocha":"^7.0.1","nock":"^11.8.2","nyc":"^15.0.0","typescript":"^3.7.5"},"publishConfig":{"access":"public"},"_id":"@botbuildercommunity/adapter-twilio-whatsapp@1.1.0","_nodeVersion":"10.16.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-3nZmf9rM3QWM2mCuT5Vos0IUXAqMnZte/S0RNYhrbPlsuw2N4rdflcbVYqpB6UnGdPLpaomgBByMV8ZAnrn7Sw==","shasum":"4e3ce8b1e021e9b44aa6ca48f6d293d138f8fa7e","tarball":"https://registry.npmjs.org/@botbuildercommunity/adapter-twilio-whatsapp/-/adapter-twilio-whatsapp-1.1.0.tgz","fileCount":28,"unpackedSize":269249,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeQqBnCRA9TVsSAnZWagAAHwwP/1/RLk2lFV/Ytyl6DaUY\nTVxc1P9VqXljGvkbHwU8tlsLZqELjNHxmG8wB9xmxZ6H0hn8TyRiXgnt0cOw\na9JQ8Zr96c62kLasfnYPCSsqIoRTG7KVlKswbpnM+kKxsYg2j2Gn5k/P6lON\n/F0VJN/VX8whVbhiquIrWEtQ+4TpefjPvm6ZAoZ8dwZAodf63eno0dVlWdd3\nq8CU3WPdn7fbwwxbbboXKtXStONvDcECaTBtaFZsRzrp3/cmB5QUxwzls2jE\nLCWfCryM9cPrJANBjMBROXv777PvmjTsI7e0Q3CPjnVgHIYuhNFNrl0X+bys\nnYWKOKbFjl9/cN3lOhrlr7uSehSXbeOccbR93SDKRJmZLWL6dnwSrRi9XRHa\n8kvfCrC4Cvph4E9hrYsm+OCd5kcxNGx3+R0mMxIcSc/6hhgIXGX6wz22U+9p\nese1F7DZNgbZBwOGHv0QaPhdEXZCLxNiFVvKhGVtt51nd12x4VdbgUS3scY1\nZjazKtL/PzmjJuIouH994N2EPTqWITRqY0EzmX6alQgofrO7zNsmxZP+06As\nZVPeAcn0JSTqDzfnO7QtqG6+buwBCEuD8O8e2nQP3oX6a19SC/htzCKiqKKo\n+Lx/u3b0xEpQe+3Czo4FgRHVQREy4Ncl9RXRs0W4vMAEvLrAG5uiGKCj/8A/\n4Lth\r\n=MGvH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC/MozrkM8LkqwthMGKRgEnON2emIymR+q98T8MX6Et3AIgEvEi7+ulT9woB7L0JzBQwo9WpLy2/DQgExQa+AglOUc="}]},"maintainers":[{"email":"stephan@bisser.at","name":"cloudguy_pro"},{"email":"mick@imick.nl","name":"imick"},{"email":"james.mann@bcs.org","name":"jamesemann"},{"email":"michael@szul.us","name":"szul"}],"_npmUser":{"name":"szul","email":"michael@szul.us"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/adapter-twilio-whatsapp_1.1.0_1581424743477_0.4896926123055303"},"_hasShrinkwrap":false},"1.2.0":{"name":"@botbuildercommunity/adapter-twilio-whatsapp","version":"1.2.0","description":"Twilio WhatsApp adapter for use with the Bot Framework.","main":"./lib/index.js","typings":"./lib/index.d.ts","directories":{"lib":"lib"},"nyc":{"extends":"@istanbuljs/nyc-config-typescript","all":true,"check-coverage":true,"lines":0,"statements":0,"functions":0,"branches":0,"exclude":["**/*.d.ts","**/*.test.js"],"reporter":["text","cobertura","html"],"report-dir":"./.nyc_output/coverage"},"scripts":{"build":"tsc","test":"tsc && nyc mocha","test-ci":"tsc && nyc mocha --reporter xunit --reporter-options output=./mocha-test-results.xml --reporter-options suiteName=$npm_package_name"},"engines":{"node":">=10.0.0"},"repository":{"type":"git","url":"git+https://github.com/BotBuilderCommunity/botbuilder-community-js.git"},"keywords":["chatbots","bot framework","bot builder","whatsapp adapter","adapters","whatsapp","twilio","twilio-whatsapp"],"contributors":[{"name":"Bot Builder Community"},{"name":"Mick Vleeshouwer","email":"mick@imick.nl"},{"name":"Néstor Alonso Viña","email":"nalonso@student.42.fr"}],"license":"MIT","bugs":{"url":"https://github.com/BotBuilderCommunity/botbuilder-community-js/issues"},"homepage":"https://github.com/BotBuilderCommunity/botbuilder-community-js#readme","dependencies":{"@botbuildercommunity/core":"^1.0.0","botbuilder":"^4.8.0","twilio":"^3.41.1"},"devDependencies":{"@istanbuljs/nyc-config-typescript":"^0.1.3","mocha":"^7.1.1","nyc":"^15.0.0","typescript":"^3.8.3"},"publishConfig":{"access":"public"},"gitHead":"1066f5f7752f3298e575aa495afa4592d5f54a44","_id":"@botbuildercommunity/adapter-twilio-whatsapp@1.2.0","_nodeVersion":"12.14.0","_npmVersion":"lerna/3.20.2/node@v12.14.0+x64 (darwin)","dist":{"integrity":"sha512-j9vV4fhejvOeYJLPnv9tjJ7Of1rCagzzo+JKYvwlApmWC/sKgYYT7dESQ7zxuk4rvZfhZ+M5p33ufdW81WkEOg==","shasum":"40ae1f1bb65cb1978658182e402e099ac0a0ab27","tarball":"https://registry.npmjs.org/@botbuildercommunity/adapter-twilio-whatsapp/-/adapter-twilio-whatsapp-1.2.0.tgz","fileCount":14,"unpackedSize":66086,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJefMshCRA9TVsSAnZWagAAa80P/RH09nEfzceDSbx1nY7C\n80grsER7avleA1pyCbRBH91hO9BRdcj5jTQqJSixlOmyTizK+ueZqCOODILA\nYpQeF1XWkG8PLRCcjU9Rc7n//X9u+D3eBw3KfFhVfIjayZFA92Cj8KnW5o2i\nIFG6njYCsqxN/5nIcMECY/qremL0mL9yCiGlTa2cJUAvpA/NC19LyUPNZx73\nMSaeziak2GIivNfTPYEV69gGr1Bowij4furWAqd2B9JUpqPkXtu+K3i5qwoF\n02CQa3OhlyJnR73wMKxzN4NLiZaaxsvtq3srvD6pYs7hC+yjXqfN9SRBUp8f\nPvwX54jMDhPdAeU2iHpLYtcOofq65OVeLFVrrqJ4Y8gEEcEgpj87kJYZlNLv\n3BP8ZHv/vU7UKJ04IeigoPjvPW9rb50LQmFnWXOqjQmdmme8vO7qLxY3LcGO\nw5Tn5bvAv2NgV2rJ1dp1zPghGqPUjL/BK5kwyhSeru81wQQr49nNaz2u8I2U\nIRvwf2diVhQjAJpAS7PlRvFHyHGEZGn2QHfu2xOWuw2DL9Rgaf8K6NQQ2quB\nagpH82U5aCPpUuaJyji7NDdmep7tBSpiMvgLIHjCXJZRlewMODVHuIaDXcgU\nyqpy3Po+IZqtCznhVWy/1YMYY+vRSIgIDzFL9hdPGMpMs7ziCmGv5xz3umWi\nJKoZ\r\n=RTch\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDrrO4ZGdwEYLDMHVctq8G43o/7L/SadrIKAPwGdJWMKQIgdtgl2Vtv1tSuKfv9b4MGdtKpg3bPF+K/L0X7YnBYa7E="}]},"maintainers":[{"email":"stephan@bisser.at","name":"cloudguy_pro"},{"email":"mick@imick.nl","name":"imick"},{"email":"james.mann@bcs.org","name":"jamesemann"},{"email":"michael@szul.us","name":"szul"}],"_npmUser":{"name":"imick","email":"mick@imick.nl"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/adapter-twilio-whatsapp_1.2.0_1585236769338_0.40338929342901797"},"_hasShrinkwrap":false}},"time":{"created":"2019-08-04T13:51:21.356Z","0.1.0":"2019-08-04T13:51:21.580Z","modified":"2022-04-04T20:13:41.653Z","1.0.0":"2019-09-27T13:44:45.415Z","1.1.0":"2020-02-11T12:39:03.609Z","1.2.0":"2020-03-26T15:32:49.488Z"},"maintainers":[{"email":"james.mann@bcs.org","name":"jamesemann"},{"email":"stephan@bisser.at","name":"cloudguy_pro"},{"email":"mick@imick.nl","name":"imick"}],"description":"Twilio WhatsApp adapter for use with the Bot Framework.","homepage":"https://github.com/BotBuilderCommunity/botbuilder-community-js#readme","keywords":["chatbots","bot framework","bot builder","whatsapp adapter","adapters","whatsapp","twilio","twilio-whatsapp"],"repository":{"type":"git","url":"git+https://github.com/BotBuilderCommunity/botbuilder-community-js.git"},"contributors":[{"name":"Bot Builder Community"},{"name":"Mick Vleeshouwer","email":"mick@imick.nl"},{"name":"Néstor Alonso Viña","email":"nalonso@student.42.fr"}],"bugs":{"url":"https://github.com/BotBuilderCommunity/botbuilder-community-js/issues"},"license":"MIT","readme":"# Twilio WhatsApp Adapter (beta)\nThis is part of the [Bot Builder Community Extensions](https://github.com/BotBuilderCommunity/botbuilder-community-js) project which contains various pieces of middleware, recognizers and other components for use with the Bot Builder JavaScript SDK v4.\n\nThe Twilio WhatsApp adapter for the Microsoft Bot Framework allows you to add an additional endpoint to your bot for use with Twilio WhatsApp. The goal of this adapter is to support WhatsApp via Twilio as seamlessly as possible. All supported features on WhatsApp are mapped to the default Bot Framework SDK.\n\n>To send messages with WhatsApp in production, you have to wait for WhatsApp to formally approve your account. But, that doesn't mean you have to wait to start building. [Twilio Sandbox for WhatsApp](https://www.twilio.com/console/messaging/whatsapp) lets you test your app in a developer environment.\n\nThis adapter supports the limited capabilities of Twilio WhatsApp, including;\n\n* Send and receive text messages\n* Send and receive text messages with attachments (`image`, `audio`, `video`, `document`, `location`)\n* Send proactive notifications\n* Track message deliveries (`sent`, `delivered` and `read` receipts)\n* User authentication via OAuth (provided by Azure Bot Service)\n\n## Status\n__Currently the Twilio WhatsApp channel is in beta.__\n>Products in Beta may occasionally fall short of speed or performance benchmarks, have gaps in functionality, and contain bugs.\n\n>APIs are stable and unlikely to change as the product moves from Beta to Generally Available (GA). We will do our best to minimize any changes and their impact on your applications. Products in Beta are not covered by Twilio's SLA's and are not recommended for production applications.\n\n## Installation\n\nTo install:\n\n    npm install @botbuildercommunity/adapter-twilio-whatsapp --save\n\n## Usage\n\n1. Use your existing Twilio account or create a new Twilio account.\n2. Go to the [Twilio Sandbox for WhatsApp](https://www.twilio.com/console/messaging/whatsapp) and follow the first steps.\n3. At the `Configure your Sandbox` step, add your endpoint URLs. Those URLs will be defined by the snippet below, by default the URL will be `[your-bot-url]/api/whatsapp/messages`.\n_The `status callback url` is optional and should only be used if you want to track deliveries of your messages._\n4. Go to your [Dashboard](https://www.twilio.com/console/sms/dashboard) and click on `Show API Credentials`.\n5. Implement the snippet below and add your Account SID, Auth Token, your phone number and the endpoint URL you configured in the sandbox.\n6. Give it a try! Your existing bot should be able to operate on the WhatsApp channel via Twilio.\n\n```javascript\nconst { TwilioWhatsAppAdapter } = require('@botbuildercommunity/adapter-twilio-whatsapp');\n\nconst whatsAppAdapter = new TwilioWhatsAppAdapter({\n    accountSid: '', // Account SID\n    authToken: '', // Auth Token\n    phoneNumber: '', // The From parameter consisting of whatsapp: followed by the sending WhatsApp number (using E.164 formatting)\n    endpointUrl: '' // Endpoint URL you configured in the sandbox, used for validation\n});\n\n// WhatsApp endpoint for Twilio\nserver.post('/api/whatsapp/messages', (req, res) => {\n    whatsAppAdapter.processActivity(req, res, async (context) => {\n        // Route to main dialog.\n        await bot.run(context);\n    });\n});\n```\n\n## Advanced\n\n* [Send and receive attachments](#send-and-receive-attachments)\n* [Send and receive location messages](#send-and-receive-location-messages)\n* [Send proactive notifications](#send-proactive-notifications)\n* [Implement channel-specific functionality](#implement-channel-specific-functionality)\n* [Monitor the status of your WhatsApp outbound message](#monitor-the-status-of-your-whatsapp-outbound-message)\n* [User authentication within a conversation](#user-authentication-within-a-conversation)\n\n### Send and receive attachments\nThe Bot Framework SDK supports the task of sending rich messages to the user. The Twilio WhatsApp adapter is using the same principles as the Bot Framework SDK. ([official documentation](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-howto-add-media-attachments?view=azure-bot-service-4.0&tabs=javascript)).\n\nAttachments to WhatsApp messages can be of many different file types, including JPG, MP3, and PDF. [Read more about the supported file types in the Twilio FAQ](https://support.twilio.com/hc/en-us/articles/360017961894-Sending-and-Receiving-Media-with-WhatsApp-Messaging-on-Twilio-Beta-). The file type can be found by looking at the `contentType` property of the attachment.\n\n**Example**\n```javascript\nconst reply = {\n    type: 'message',\n    text: 'This is a message with an attachment.',\n    attachments: [\n        {\n            contentType: 'image/png',\n            contentUrl: 'https://docs.microsoft.com/en-us/bot-framework/media/how-it-works/architecture-resize.png'\n        }\n    ]\n};\n\nawait context.sendActivity(reply);\n```\n\n>_You can send media messages up to 5 MB in size. At this time, Twilio will not transcode media for outgoing WhatsApp messages, so if you need to send a media object that is larger than 5 MB, please reduce the file size before sending it to Twilio._\n\n### Send and receive location messages\nTwilio WhatsApp offers the ability to send and receive [location messages](https://www.twilio.com/docs/sms/whatsapp/api#location-messages-with-whatsapp).\n\n#### Sending\nLocation messages can be sent in two ways. By using a JSON attachment or by sending the location directly via channelData.\n\n**Attachment**\n```javascript\nconst replyWithLocation = {\n    type: 'message',\n    text: `Microsoft Nederland`,\n    attachments: [\n        {\n            contentType: 'application/json',\n            content: {\n                elevation: null,\n                type: 'GeoCoordinates',\n                latitude: 52.3037702,\n                longitude: 4.7501761,\n                name: 'Schiphol'\n            }\n        }\n    ]\n};\n\nawait context.sendActivity(replyWithLocation);\n```\n\n**ChannelData**\n```javascript\nconst replyWithLocation = {\n    type: 'message',\n    text: 'name', // The name of the location being sent (Location must exist in Google maps for the hyperlink to work on Mac/Windows WhatsApp client)\n    channelData: {\n        persistentAction: 'geo:{latitude},{longitude}|{label}'\n    }\n};\n\nawait context.sendActivity(replyWithLocation);\n```\n\n#### Receiving\n```javascript\nif (context.activity.attachments && context.activity.attachments.length > 0) {\n    for (attachment of context.activity.attachments) {\n        if (attachment.contentType === 'application/json' && attachment.content.type === 'GeoCoordinates') {\n            console.log('Received location!');\n            await context.sendActivity('Received a location' +\n            `${attachment.name} (${attachment.content.name}) (${attachment.content.latitude},${attachment.content.longitude})`);\n        }\n    }\n}\n```\n\n### Send proactive notifications\nProactive notifications are supported using the same principles as the Bot Framework SDK. Read more about how to [send proactive notifications to users](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-howto-proactive-message?view=azure-bot-service-4.0&tabs=csharp).\n\nA WhatsApp session begins with a user initiated message to your app. Sessions are valid for 24 hours after the most recently received message, during which time you can communicate with them using free form messages. In order to send a message outside the 24 hour Session window, you must use a pre-approved template (see [Sending Notifications](https://www.twilio.com/docs/sms/whatsapp/api#sending-notifications) section).\n\n**Example**\n```javascript\n// Capture conversation reference\nconversationReference = TurnContext.getConversationReference(context.activity);\n\n// Send pro-active message\nawait whatsAppAdapter.continueConversation(conversationReference, async (turnContext) => {\n    await turnContext.sendActivity(`Proactive message!`);\n});\n```\n\n### Implement channel-specific functionality\nThe Twilio WhatsApp channel is using `whatsapp` as the channel id. Within the TurnContext, you can use the following snippet to detect if the request is coming from the Twilio WhatsApp channel and to implement your custom logic.\n`if (context.activity.channelId === 'whatsapp')`\n\nUsing the `channelData` object on new message activities is currently only supported for passing `persistentAction`, which can be used to send location messages.\n\n### Monitor the status of your WhatsApp outbound message\nIf you configure the `status callback url` in Twilio Configuration, multiple status events will be broadcasted to your bot. You can use this functionality to [monitor the status of your WhatsApp outbound message](https://www.twilio.com/docs/sms/whatsapp/api#monitor-the-status-of-your-whatsapp-outbound-message). Possible values include: 'messageRead', 'messageDelivered', 'messageSent', 'messageQueued', 'messageFailed'.\n\nWithin the TurnContext you are able to differentiate between the events by reading the value of `context.activity.type`. If you are using an `ActivityHandler`, you should use the `onUnrecognizedActivityType` method.\n\n**Example**\n```javascript\nif (context.activity.type === WhatsAppActivityTypes.MessageRead) {}\n```\n\n### User authentication within a conversation\nIt is possible to use the native [Bot Service OAuth functionality](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-concept-authentication?view=azure-bot-service-4.0) by passing in the optional `BotFrameworkAdapterSettings` object. Sample code for adding OAuth to your bot can be found [here](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-authentication?view=azure-bot-service-4.0&tabs=javascript).\n\n```javascript\nconst whatsAppAdapter = new TwilioWhatsAppAdapter({\n    accountSid: '', // Account SID\n    authToken: '', // Auth Token\n    phoneNumber: '', // The From parameter consisting of whatsapp: followed by the sending WhatsApp number (using E.164 formatting)\n    endpointUrl: '' // Endpoint URL you configured in the sandbox, used for validation\n}, {\n    appId: '', // MicrosoftAppId\n    appPassword: '' // MicrosoftAppPassword\n});\n```\n","readmeFilename":"README.md"}