(Deprecated) SendLink#
The method is deprecated. Please use SendMessage.
The method is aimed for sending a message with a link, by which an image preview, title and description will be added. Linked device not required when sending. Messages will be kept for 24 hours in the queue until instance will be authorized Image, title and description are obtained from Open Graph page template being linked to. The message will be added to the send queue. The rate at which messages are sent from the queue is managed by Messages sending delay parameter.
Request#
To send a link message, you have to execute a request at:
{{apiUrl}}/waInstance{{idInstance}}/sendLink/{{apiTokenInstance}}
For apiUrl
, idInstance
and apiTokenInstance
request parameters, refer to Before you start section.
Request parameters#
Parameter | Type | Mandatory | Description |
---|---|---|---|
chatId | string | Yes | Chat Id |
urlLink | string | Yes | Link address |
quotedMessageId | string | No | Quoted message ID. If present, the message will be sent quoting the specified chat message |
It is recommended that the page referred to with
urlLink
contains Open Graph template. In this case, the message will be supplemented with an image, a title and a short description.
Request body example#
Sending a message to a personal chat:
{
"chatId": "11001234567@c.us",
"urlLink": "https://green-api.com"
}
Sending a message to a group chat:
{
"chatId": "11001234567-1581234048@g.us",
"urlLink": "https://green-api.com"
}
Sending a message to a personal chat:
{
"chatId": "11001234567@c.us",
"urlLink": "https://green-api.com",
"quotedMessageId": "361B0E63F2FDF95903B6A9C9A102F34B"
}
Response#
Response parameters#
Parameter | Type | Description |
---|---|---|
idMessage | string | Outgoing message Id |
Response body example#
{
"idMessage": "3EB0C767D097B7C7C030"
}
SendLink errors#
For a list of errors common to all methods, refer to Common errors section
Python request example#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/sendLink/{{apiTokenInstance}}"
payload = "{\r\n\t\"chatId\": \"11001234567@c.us\",\r\n\t\"urlLink\": \"https://green-api.com\"\r\n}\r\n"
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, json=payload)
print(response.text.encode('utf8'))