Skip to main content

telegram bot wrapper with webhook for aws lambda

Project description

# lambdagram

lambdagram is the library to help who want to create telegram bot with [official telegram bot api](https://core.telegram.org/bots/api) using webhook on AWS lambda.

## Introduction

Main target of this library is who want to create telegram bot using webhook simply and easily. Especially for AWS lambda platform. Because AWS lambda do not allow to use polling mechanism for infinite loops. Just sending and receiving message through webhook. Not a big deal. But I believe this pretty helpful for someone who telegram and AWS lambda newbies.

## Installing

~~~
pip install lamdbgram
~~~

## Telegram API support

- getMe
- setWebhook
- getWebhookInfo
- deleteWebhook

## Key function the lambdagram support

- send_message(self, event, msg, options...) - Efficient way, but you must set webhook before use this method using web browser.
(https://api.telegram.org/bot{TOKEN}/setWebhook?url={WEBHOOKURL}, remove '{' and '}')
- send_message(self, event, msg, webhook_url, options...) - Inefficient way, but it's useful for beginners.

## How to use

~~~
from lambdagram.bot import Bot


TOKEN = "THE TOKEN YOU GOT FROM @BotFather"

def lambda_handler(event, context): # Basic function signature on AWS lambda

bot = Bot(TOKEN)
bot.send_message(event, "THE MESSAGE YOU WANT TO SEND")
~~~

or

~~~
from lambdagram.bot import Bot


WEBHOOK = "https://YOUR-WEBHOOK-URL"
TOKEN = "THE TOKEN YOU GOT FROM @BotFather"

def lambda_handler(event, context): # Basic function signature on AWS lambda

bot = Bot(TOKEN)
bot.send_message(event, "THE MESSAGE YOU WANT TO SEND", WEBHOOK)
~~~



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

lambdagram-0.9.4-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file lambdagram-0.9.4-py3-none-any.whl.

File metadata

File hashes

Hashes for lambdagram-0.9.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8f90719f204c3bc4e6607cfff5f50a19b57c8a1f3fca0d86c55af54f8a734c84
MD5 1e9a54842e85b660a24ab6ebf075eda7
BLAKE2b-256 ce1637117c757c9e5d3a7ead01bdde271f762e93278341309a21f983411f8c19

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page