When a request is made with the token received, it is a method that allows the message to be sent to the Whatsapp account of the given phone number. You need to make a request in JSON format in the body with the “PhoneNumber” and “Message” parameters.

¬†Authorization header should be entered as “token_type” value returned as a result of token request, space character, “Access_token” value.

¬†As a result of the request, a message that the sending has been made is received. When you make a request to the “GetConversationByMobile” method, you can see the record of the message you sent.

private static IRestResponse SendWhatsappMessage()
     RestClient client = new RestClient("http://api.flexxii.com/");
     RestRequest request = new RestRequest("api/Inbox/SendWhatsappMessage", Method.POST);
     request.AddHeader("Content-Type", "application/json; charset=utf-8");
     request.AddHeader("Authorization", content_type + " " + access_token);
     request.AddJsonBody(new {PhoneNumber= phoneNumber, Message= "API Test Message"});
     IRestResponse response = client.Execute(request);
     return response;

Was this helpful?

0 / 0