@elimeleth/telegram
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-alpha.3 • Public • Published

Telegram provider for bot-whatsapp

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 { addKeyword, createBot, createFlow, createProvider, EVENTS, MemoryDB } from '@builderbot/bot'
import { TelegramProvider, handleCtx } from '@builderbot-plugins/telegram'

const flowWelcome = addKeyword<TelegramProvider, MemoryDB>(EVENTS.WELCOME)
    .addAnswer("Hola desde telegram provider!")

const main = async () => {
    let provider = createProvider(TelegramProvider, {
        token: process.env.TELEGRAM_TOKEN
    })
        .initHttpServer(3002)

    provider.http?.server.post('/webhook', handleCtx(async (bot, req, res) => {
        return res.end('Hola desde telegram webhook provider!')
    }))


    await createBot({
        database: new MemoryDB(),
        provider,
        flow: createFlow([flowWelcome])
    })
}

main()

Author

Elimeleth Capuano https://github.com/elimeleth

Readme

Keywords

none

Package Sidebar

Install

npm i @elimeleth/telegram

Weekly Downloads

3

Version

1.0.0-alpha.3

License

MIT

Unpacked Size

24.5 kB

Total Files

12

Last publish

Collaborators

  • elimeleth