Links

API

Get Started

As a member of the TGmembership family, you can use the API to automate your memberships' management. For example, you can connect your Telegram bot directly to your website and give your customers access to your Telegram chats automatically.
Before you can use the TGmembership API, you must have a bot and an API key created. If you don't have one yet, create your Telegram bot and connect it to TGmembership.

Generate API Endpoint

Authentication

The TGmembership API uses API keys to authenticate requests. You can view and manage your API key from your bot's settings menu.
All queries to the TGmembership API must be served over HTTPS, using GET, POST or DELETE HTTP methods, and need to be presented in this form: https://api.tgmembership.com/bot{{BOT_ID}}/{{API_KEY}}/{{METHOD_NAME}}
Calls made over plain HTTP will fail. API requests without authentication will also fail. All methods in the TGmembership API are case-insensitive.
The response contains a JSON object, which always has a Boolean field "ok", Integer field "code" and may have an optional String field "description" with a human-readable description of the result. If "ok" equals true, the request was successful and the result of the query can be found in the "result" field. In case of an unsuccessful request, "ok" equals false and the error is explained in the "description".
post
https://api.tgmembership.com/bot{{BOT_ID}}/{{API_KEY}}
/addMember
/addMember
post
https://api.tgmembership.com/bot{{BOT_ID}}/{{API_KEY}}
affiliate
/affiliate
get
https://api.tgmembership.com/bot{{BOT_ID}}/{{API_KEY}}
countOrders
/countOrders
get
https://api.tgmembership.com/bot{{BOT_ID}}/{{API_KEY}}
countUsers
/countUsers
get
https://api.tgmembership.com/bot{{BOT_ID}}/{{API_KEY}}
/getPlans
/getPlans
get
https://api.tgmembership.com/bot{{BOT_ID}}/{{API_KEY}}
/getRevenue
/getRevenue
get
https://api.tgmembership.com/bot{{BOT_ID}}/{{API_KEY}}
/getSubscribers
/getSubscribers
get
https://api.tgmembership.com/bot{{BOT_ID}}/{{API_KEY}}
/mostPopularPaymentMethods
/mostPopularPaymentMethods
post
https://api.tgmembership.com/bot{{BOT_ID}}/{{API_KEY}}
/order
/order
get
https://api.tgmembership.com/bot{{BOT_ID}}/{{API_KEY}}
/paymentMethods
/paymentMethods
get
https://api.tgmembership.com/bot{{BOT_ID}}/{{API_KEY}}
/plansPerformance
/plansPerformance
post
https://api.tgmembership.com/bot{{BOT_ID}}/{{API_KEY}}/
webhook
/webhook
delete
https://api.tgmembership.com/bot{{BOT_ID}}/{{API_KEY}}/
webhook
/webhook