Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

telegraf-aws

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

telegraf-aws

AWS Lambda helper for Telegraf bot framework

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by12.5%
Maintainers
1
Weekly downloads
 
Created
Source

Telegraf-aws

Small lib to ease use of AWS Lambda with Telegraf in webhook mode

Example

Small example of serverless Telegraf bot:

import Telegraf from 'telegraf'
import telegrafAws from 'telegraf-aws'

// Create telegraf instance for handle updates
const bot = new Telegraf(process.env.BOT_TOKEN, {
  webhookReply: true
})

// Create webhook handler
const updateHandler = telegrafAws(bot, {
  timeout: 1000 // Optional parameter, after timeout, empty response will be sent to AWS and function execution will be stopped
})

// Optional - set webhook url on start
bot.telegram.setWebhook(process.env.BOT_WEBHOOK_URL)

// Register bot commands
bot.command('help', ctx => ctx.reply('Try send a sticker!'))
bot.hears('hi', ctx => {
  ctx.reply('Hey there!')
})
bot.hears(/buy/i, ctx => ctx.reply('Buy-buy!'))
bot.on('sticker', ctx => ctx.reply('👍'))

// Now use hello as your lambda function and done!
export const hello = updateHandler

FAQs

Package last updated on 31 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc