Telegram bot monetization API: paid tasks in your own interface
If your bot has its own flow and a standard subscription screen doesn't fit, embed tasks via API — at the moment and in the design you choose. Here is how the MGRAM Tasks API works.
In short.POST /tasksreturns tasks with their reward,POST /tasks/checkor a webhook tells you a task is done. The owner gets 70% of the task price: from 0.77 ₽ per subscription, from 0.70 ₽ per launch.
What you need
- A bot connected to MGRAM.
- A Bot API key — «My bots» → your bot → «Settings» → «API key».
- A bot server that can make HTTPS requests with JSON.
Flow
- Get tasks:
POST https://api.mgram.biz/taskswithAuthorization: Bearer BOT_API_KEYand body{"user_id": 123456789}. The response hastaskswithtitle,link,button_textandreward. 3 tasks by default, 1 to 10 on request. - Show them as buttons — the link and the button text are already in the response.
- Check with
POST /tasks/check, or receive a webhook. - Let the user through when the response has
skip: true.
Webhook
POST /tasks/webhook with your url turns on events for completions and unsubscribes. Each event is signed: X-MGRAM-Signature is HMAC-SHA256 of timestamp.body.
Where to place tasks
- Instead of payment for a premium feature.
- For a bonus: extra attempts, coins, limits.
- On a rewards screen in your Mini App.
Full reference: api.mgram.biz.