Welcome to the Leave Message API

This API allows you to send messages via Telegram Bot. Use the POST endpoint to submit your message as well as your chat ID, and the API will handle the rest.

Starting the Telegram Bot

To start using the Telegram bot, follow these steps:

  1. Open Telegram and search for @baoopn_msg_bot.
  2. Start a chat with the bot by clicking on the Start button or sending the /start command.
  3. Use the /chatid command to get your chat ID.

Sample reply from the bot:

Your chat ID is: [CHAT_ID]

Make sure to copy your chat ID as you will need it to send messages using the API.

Example Use Case

An example of using this API is in a contact form on a website. When a user submits the form, the details are sent to the API, and you get notified in your Telegram chat.

Sample JSON
{
    "name": "Sender Name",
    "email": "Sender Email",
    "subject": "Test Subject",
    "message": "This is a test message for Telegram.",
    "chatId": "your-telegram-chat-id"
}

Endpoints

POST /msg/telegram
Send a message via Telegram

Method: POST
Path: /msg/telegram
Description: Send a message via Telegram

Request Body
  • subject (string, optional): The subject of the message. If not provided, '(No Subject)' will be used.
  • message (string, required): The content of the message to be sent.
  • name (string, required): The name of the sender.
  • chatId (string, required): The chat ID of the recipient.
Example Request
{
    "subject": "Test Subject",
    "message": "This is a test message for Telegram.",
    "name": "Sender Name",
    "chatId": "your-telegram-chat-id"
}
Example Response
{
    "success": "Telegram message sent successfully"
}
Error Responses
  • 400 Bad Request
    • Missing required fields: One or more required fields are missing from the request body.
  • 500 Internal Server Error: Failed to send Telegram message. There was an error while attempting to send the Telegram message.

Contact me at my website if you need more information or have any suggestions.