Skip to content

cntower/telegraf-session-dynamodb

Repository files navigation

@icntower/telegraf-session-dynamodb

This package provides dynamodb storage adapter for Telegraf v4.12+ sessions.

DynamoDB

Install the official DynamoDB driver alongside this module.

npm i @icntower/telegraf-session-dynamodb @aws-sdk/client-dynamodb

Usage:

import { DynamoDB } from "@icntower/telegraf-session-dynamodb";

const store = DynamoDB({
  config: {
    region: process.env.AWS_DEFAULT_REGEON,
    endpoint: process.env.DOCUMENT_API_ENDPOINT,
    credentials: {
      accessKeyId: process.env.AWS_ACCESS_KEY_ID,
      secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
    },
  },
});

const bot = new Telegraf(token, opts);
bot.use(session({ store }));

// the rest of your bot

To reuse an existing DynamoDB client, use DynamoDB({ client }) instead.

About

DynamoDB storage adapters for Telegraf v4.12+ sessions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published