bot-framework-mutant-whats-adapter

0.1.3 • Public • Published

Mutant Whats Adapter to Microsoft Bot Framework

Mutant Whats é a solução da Mutant de integração com o WhatsApp Business API. Este pacote é um adapter para integração do botframework e o MutantWhats.

Para usá, é necessário apenas importá-la no arquivo principal

const { MutantWhatsAdapter } = require('bot-framework-mutant-whats-adapter')

// [...]

const mutantWhatsAdapter = new MutantWhatsAdapter({
    id: 'ID do bot',
    name: 'Nome do bot'
})

// [...]

const router = express.Router()

router.post('/start-conversation', async (req, res) => {
    log.info('/start-conversation', { request_body: req.body })

    try {
        await mutantWhatsAdapter.processActivity(req, res, "start-conversation", async (context) => {
            await bot.run(context)
        })
    } catch (e) {
        log.error(e)
    }
})

router.post('/message', async (req, res) => {
    log.info('/message', { request_body: req.body })

    try {
        await mutantWhatsAdapter.processActivity(req, res, "message", async (context) => {
            await bot.run(context)
        })
    } catch (e) {
        log.error(e)
    }
})

Package Sidebar

Install

npm i bot-framework-mutant-whats-adapter

Weekly Downloads

4

Version

0.1.3

License

ISC

Unpacked Size

10.7 kB

Total Files

5

Last publish

Collaborators

  • ozscosta