Implementation notes
The message will be added to the queue for sending and delivered even if the phone is disconnected from the Internet or authorization is not passed.
Only one of two parameters is needed to determine the destination - chatId or phone.
This method is available in both synchronous and asynchronous implementations
Parameter |
Description |
The data type of the parameter |
Required parameter |
---|---|---|---|
Body |
HTTP or HTTPS link. Example: "https://wikimedia.org" |
String |
|
Text |
Text containing the link. | String |
|
Title |
Title for send link. | String |
|
Phone |
A phone number starting with the country code. You do not need to add your number. USA example: 17472822486. |
String |
|
ChatId |
Chat ID from the message list. Examples: 17633123456@c.us for private messages and 17680561234-1479621234@g.us for the group. |
String |
|
Description |
Description for send link. | String |
|
previewBase64 |
Base64-encoded file with mime data. Example: "data:image/jpeg;base64,/9j/4AAQSkZJRgAbAQ..." |
String |
|
MentionedPhones |
Phone numbers of the mentioned contacts in an array or in a comma-separated string. Example: ["78005553535","78005553536"] |
MentionedPhonesCollection |
|
QuotedMessageId |
Quoted message ID from the message list. Example: false_17472822486@c.us_DF38E6A25B42CC8CCE57EC40F |
String |
Parameter |
Description |
The data type of the parameter |
---|---|---|
Id |
Unique message id Example: false_17472822486@c.us_DF38E6A25B42CC8CCE57EC40F |
String |
Sent |
Success flag for sending a message to the server | Boolean |
Message |
Posting status message | String |
using System;
using ChatApi.Core.Connect;
using ChatApi.Core.Connect.Interfaces;
using ChatApi.WA.Messages;
using ChatApi.WA.Messages.Collections;
using ChatApi.WA.Messages.Requests;
using ChatApi.WA.Messages.Requests.Interfaces;
using ChatApiClient.Properties;
namespace ChatApiClient
{
internal class Program
{
internal static IWhatsAppConnect Connect { get; set; }
internal static void Main()
{
// put your chat-api's data
Connect = new WhatsAppConnect(WhatsApp_Server, WhatsApp_Instance, WhatsApp_Token);
IMessagesOperation messageOperation = new MessagesOperation(Connect);
ILinkMessageRequest request = new LinkMessageRequest
{
Phone = "79001111111",
Title = "TestFile",
Body = "https://upload.wikimedia.org/wikipedia/ru/3/33/NatureCover2001.jpg",
PreviewBase64 = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQ..."
};
var chatApiResponse = messageOperation.SendLinkMessage(request);
if (!chatApiResponse.IsSuccess) throw chatApiResponse.Exception!;
var response = chatApiResponse.GetResult();
Console.WriteLine(response?.PrintMembers());
}
}
}