1.0.2 • Published 5 years ago

@wati.io/botbuilder-adapter-whatsapp v1.0.2

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

ClareAI WhatsApp Adapter (beta)

This WhatsApp adapter allows you to add an additional endpoint to your bot for connect to the Whatsapp channel with the microsoft bot framework.

Prerequisites

Installation

  • To run the package, run npm install with the full path to your package directory:
    npm install @wati.io/botbuilder-adapter-whatsapp

Usage

const WhatsAppAdapter = require('@wati.io/botbuilder-adapter-whatsapp');
const wsAdapter = new WhatsAppAdapter({
    endpoint: 'https://whatsapp-apixxxxxx',// whatsapp endpoint
    password: 'Basic xxxxxxxxxxx', //Basic base64(username:password)
    to: '852xxxxxx' // phone number
});

// WhatsApp endpoint
server.post('/api/whatsapp/messages', (req, res) => {
    wsAdapter.processActivity(req, res).then(async (context) => {
        await bot.run(context);
    });
});

build a bot for testing

Create a bot with the Bot Framework SDK for JavaScript

Testing the bot using Bot Framework Emulator

Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.

  • Install the Bot Framework Emulator version 4.9.0 or greater from here

Connect to the bot using Bot Framework Emulator

  • Launch Bot Framework Emulator
  • File -> Open Bot
  • Enter a Bot URL of http://localhost:3978/api/messages

Further reading