Code Samples

See some code samples to integrate your API.

Postman file

Postman is a tool that aims to test RESTful services (Web APIs) by sending HTTP requests and analyzing their feedback. Download Postman App

Production You should use the following URL: https://api.positus.global/v2/whatsapp/numbers/{{chave}}/messages

Once hiring and activating your WhatsApp Business API account, we will provide a media_id by number and you will be able to generate your tokens through the platform.

Development You should use the following URL: https://api.positus.global/v2/sandbox/whatsapp/numbers/{{chave}}/messages

Create your sandbox account through the link https://studio.posit.us/ and generate a token following the instructions on the screen. Navigate to the "webhook" menu and copy the POST URL in it, this one uses "Key". In the development environment you will not be able to send HSM messages, but all other resources are available for sending and receiving.

Code Samples

C# - RestSharp

var client = new RestClient("https://api.positus.global/v2/sandbox/whatsapp/numbers/{{chave}}/messages");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer xxxx");
request.AddParameter("application/json,text/plain", "{\r\n  \"to\": \"+5511999999999\",\r\n  \"type\": \"text\",\r\n  \"text\": {\r\n      \"body\": \"your-message-content\"\r\n  }\r\n}",  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Last updated