How to display UI fields from your API?

To get the string value for custom UI field, we make POST request to your server. Such requests will go to your API from app.tgtaps.com or *.tgtaps.com (any subdomain) URL.

In this request we pass the following properties:

  • User Telegram ID (userTelegramId);

  • User points amount (userPoints);

  • User friends count (userFriendsCount);

  • User levels total count (userTotalLevels);

  • User current level (userLevel);

  • TON address (friendly formatted and raw-formatted);

Additional fields will be added soon.

Example of the request:

curl -X POST https://your-domain.com/api/users/get-custom-value \
     -H "Content-Type: application/json" \
     -d '{
           "userTelegramId": 12314332, 
           "userPoints": 1000000, 
           "userFriendsCount": 5, 
           "userTotalLevels": 20, 
           "userLevel": 2,
           "tonFriendlyAddress": "dfdsFDEDddsDFsddfsd",
           "tonRawAddress": "dfdsFDEDddsDFsddfsd"
         }'

Requirements for your endpoint:

  1. HTTPS-only protocol is supported, because requests will go directly from users’ Telegram Mini Apps;

  2. CORs should allow hosts app.tgtaps.com and *.tgtaps.com;

  3. Response should be raw string or number that will be processed as string. JSON responses not supported (or they will be rendered entirely in UI);

❌ Wrong data response:

{
  "data": "some_value"
}

✅Valid response:

"some_value"

How to add custom API UI field on UI?

  1. Insert property name you want to access:

  1. Insert your API URL:

  1. Access property in UI:


Something unclear in docs or you know how to improve article? Message us or ask community! We will answer you and then promise to improve the article within 3 days.

Last updated