The production-ready Medusa DTC Starter is outRead the announcement
T

Telegram

[Medusa v2](https://github.com/medusajs/medusa) plugin that provides Telegram integration.

npm install @nxmad/medusa-telegram
Built by
Version
0.2.0
Last updated
2 years ago
Monthly downloads
Loading downloads

Medusa Telegram

Medusa v2 plugin that provides Telegram integration.

Installation

Add the plugin to your project

Add your telegram bot token to file

Add auth provider in

Built-in Medusa auth routes usage example

TMA auth provider verifies that init data is not tampered or malformed. To receive auth identity you need to pass stringified in the body of the request, e.g.:

Note that should be installed separately

Workflow usage example

However, the idea behind TMA assumes that user doesn't not need neither to login nor to register since Telegram account already acts as an identity. So, this package provides that:

  • creates auth identity from init data if it doesn't exist;
  • creates customer and links it to the identity if it doesn't exist;
  • generates Medusa JWT token for existing or newly created customer.

You'll need a custom route to run this workflow, for example:

Note that should match with provider id registered in

workflow returns Medusa JWT token for the customer. You can use it for subsequent API calls from your storefront.

Roadmap

  • TMA auth provider
  • Telegram OAuth2 provider
  • Telegram notifications provider