Connecting a Bot via API
Graspil offers different methods to connect a bot to the system. This article describes the method of connecting using the API. In your personal account, when connecting a bot, you can review all the connection options.
There are two methods for sending data to Graspil via the API:
Batch Data Sending — the preferred method
Graspil needs to receive the exact time when your bot (code) received the Update, accurate to milliseconds. Therefore, we recommend using the batch data sending method:
You can provide the exact time of data receipt.
If you delay data transmission, for example, sending it once a minute, it will positively affect the performance of all systems.
Authorization
Graspil API expects the API key to be included in all API requests in the header, formatted as follows:
Api-Key
meowmeowmeow
For more details on authorization and how to obtain the authorization key, see the authorization section.
Verifying the Update Structure
In both methods, the system expects to receive Updates that fully comply with the Telegram Bot API structure. To speed up the process, the system checks only the basic parts of the data upon receipt. Full verification, including compliance with the Telegram Bot API structure, occurs later. If errors occur, they will be listed in the "Bot Errors" section.
Batch Data Sending
POST https://api.graspil.com/v1/send-batch-update
This method is for batch sending Updates. You can send up to 1,000 updates with the receipt date specified. To send data, you need to send an array of data.
Headers
Content-Type
application/json
Api-Key
meowmeowmeow
Body
The method accepts up to 1,000 Updates per request.
Code examples
Response
Real-Time Data Sending
POST https://api.graspil.com/v1/send-update
When you receive data from the Telegram Bot API, you need to send this data to our platform. The data should be sent in its original form, matching the Telegram Bot API data structure.
The data received from Telegram can contain two different structures, depending on the update delivery method: webhook or getUpdates. This method supports both structures.
Headers
Content-Type
application/json
Api-Key
meowmeowmeow
Body
Code examples
Response
For Developers
Develop an SDK in your programming language to integrate with Graspil. Publish the repository on GitHub and let us know at [email protected].
We’ll add a link to your repository in our documentation, bringing additional visitors to your page. Additionally, we can provide free access to a premium plan for several months and early access to our referral program.
Last updated