Introduction¶
CodeMeet provides a standard set of Bot APIs for developers to create, configure, and manage intelligent bots, automated services, and interactive chatbots. Follow the steps below to start using the API.
Steps to Get Started¶
-
Create a bot using BotFather at @BotFather in CodeMeet.
-
Save the received token securely to authenticate your API requests.
-
Using the token from the previous step and your desired method, create a
URLwith the following format and send your request usingPOST(orGET):
Receiving Updates¶
After creating your bot in BotFather, there are two standard methods for your bot to receive notifications regarding user actions (incoming messages, button clicks, etc.):
Method 1: Calling getUpdates (Long Polling)
In this method, your bot periodically polls the CodeMeet server to check if new events or messages have arrived.
To implement polling, call the getUpdates method in a loop passing the offset parameter (the highest update_id processed + 1).
This method is ideal for local development without requiring a public IP or SSL certificate.
Method 2: Setting a Webhook via setWebhook (Webhook)
In this method, you register your server's endpoint using setWebhook. As soon as an event occurs, CodeMeet sends an HTTP POST request containing an Update object to your webhook URL.
/// note | Webhook Requirements
- This method requires a public server with a valid SSL (HTTPS) certificate.
- If your server encounters temporary downtime, events remain staged in the durable update queue.
///
Incoming Update Structures (Update)¶
In both polling and webhook modes, events are delivered in standard Update objects:
1. New Message Event (message)¶
Whenever a user sends a text message, media, /start command, or document:
Sample JSON Body:
{
"update_id": 1042,
"message": {
"message_id": 25,
"date": 1724419200,
"chat": {
"id": "e9b2a1c0-4411-4fa3-9f88-d4508671b122",
"type": "private"
},
"from": {
"id": "c1f72b9a-1122-3344-5566-778899aabbcc",
"is_bot": false,
"first_name": "Sara",
"username": "sara_dev"
},
"text": "Hello Bot"
}
}
2. Inline Button Click Event (callback_query)¶
Whenever a user clicks an inline keyboard button attached to a message:
Sample JSON Body:
{
"update_id": 1043,
"callback_query": {
"id": "a90f12d83b4c",
"from": {
"id": "c1f72b9a-1122-3344-5566-778899aabbcc",
"is_bot": false,
"first_name": "Sara",
"username": "sara_dev"
},
"message": {
"message_id": 24,
"chat": {
"id": "e9b2a1c0-4411-4fa3-9f88-d4508671b122",
"type": "private"
},
"text": "Please choose an option:"
},
"data": "menu_settings"
}
}
Choosing Between Polling and Webhook¶
- getUpdates (Long Polling): Best for quick starts, local development, and environments without a public domain or SSL certificate.
- setWebhook (Webhook): Recommended for scalable, high-concurrency production deployments.
Once you receive and process an incoming update, respond to the user using Messaging Methods or Callback Answers.