@builderbot-plugins/wali
v1.0.2
Published
plugin for @builderbot/bot for wali onnichannel
Downloads
93
Readme
Wali provider for Builderbot
The provider using a polka server Polka for bot-whatsapp bot. You can apply this provider into your createProvider function.
Usage
import "dotenv/config"
import { createBot, createProvider, MemoryDB } from '@builderbot/bot'
import { WaliProvider } from "@builderbot-plugins/wali"
const main = async () => {
const welcome = addKeywork(EVENTS.WELCOME).addAnswer('hello!')
const provider = createProvider(WaliProvider, {
name: "shurupitos",
port: proccess.env?.PORT || 9000,
token: 'YOUR_TOKEN_HERE',
deviceId: 'YOUR_DEVICE_ID_HERE'
})
const { handleCtx, httpServer } = await createBot({
flow: [welcome],
provider,
database: new MemoryDB(),
})
httpServer(+PORT)
provider.server.post(
'/v1/messages',
handleCtx(async (bot, req, res) => {
const { number, message, urlMedia } = req.body
await provider.sendMessage(number, message, { media: urlMedia ?? null })
res.statusCode = 201
return res.end('ok')
})
)
}
main()
Author
Elimeleth Capuano https://github.com/elimeleth