This method allows sending text messages to recipients via available communication channels (WhatsApp, Telegram, MAX, etc.). Messages can include links, emojis, and formatting. The method is convenient for sending notifications, informational messages, and for direct communication with clients.
When sending, the system automatically checks for the existence of a messenger account based on the specified phone number or chat ID, nickname, depending on the messenger.
Supported Messengers
The API method for sending text messages is available for the following messengers: WhatsApp, MAX Personal, Telegram Personal, Telegram Bot.
Request Example:
GET https://wamm.chat/api2/msg_to/{token}/?phone={phone}&text={text} or
GET https://wamm.chat/api2/msg_to/{token}/{phone}/{text} Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| token | string | Yes | API token obtained in the settings |
| phone | string | Yes | Phone number in international format (e.g., 79001234567). For Telegram, you can specify a chat ID or nickname instead of a number; for MAX - a chat ID |
| text | string | Yes | Message text up to 4500 characters in UTF-8 encoding, encoded using the urlencode function. To insert a line break in the text, use "%0A" |
| delay | integer | No | Interval between messages in seconds. Allowed values: 15, 20, 30, 45, 60, 120, 180 |
| quote_msg_id | integer | No | ID of the message being replied to |
When sending multiple messages via the API simultaneously, they are queued for sending with an interval of several seconds between messages, or the interval can be increased by explicitly setting it via the "delay" parameter. For test accounts, there is a limit - no more than 30 messages sent via API per day.
Success Response
{"err":0,"msg_id":1234567} Possible Errors
| Error Code, "err" value | Description |
|---|---|
| token fail | Token error |
| acc not authorized | Connection not authorized |
| phone fail | Phone number error |
| no WhatsApp on the number | No account with this number for WhatsApp |
| no Account on the number | No account with this number for other channels (Telegram, MAX...) |
| phone not checked for WhatsApp, please retry | Number not checked for existence (WhatsApp), please retry the request |
| phone not checked, please retry | Number not checked for existence (for other channels), please retry the request |
| text fail | Empty text |
| text fail, more 4500 | Text is too large, exceeds 4500 characters |
| quote_msg_id fail, not found | Message for reply not found |
Usage Examples
curl -X GET "https://wamm.chat/api2/msg_to/YOUR_TOKEN/?phone=79001234567&text=Test%20message"
function sendMessage($token, $phone, $text) {
// Prepare the request URL
$url = "https://wamm.chat/api2/msg_to/$token/?phone=$phone&text=" . urlencode($text);
// Execute the request
$response = file_get_contents($url);
// Process the response
if ($response !== false) {
// Convert the response to an array
$json_response = json_decode($response, true);
// Check for errors
if (isset($json_response['err'])) {
if ($json_response['err'] == 0 && isset($json_response['msg_id'])) {
echo "Message sent successfully, message ID: " . $json_response['msg_id'];
} else {
echo "Error: " . $json_response['err'];
}
} else {
echo "Failed to process the server response";
}
} else {
echo "Failed to execute the request to the server";
}
}
// Use the function to send a message
$token = "YOUR_TOKEN";
$phone = "79001234567";
$text = "Test message";
sendMessage($token, $phone, $text);