A Step-by-Step Guide to Sharing Documents with WhatsApp Contacts Using Wassenger
Sharing important documents like PDFs, DOCX files, or XLSX spreadsheets with your WhatsApp contacts can significantly improve collaboration and efficiency. However manually managing these tasks can be time-consuming, especially for companies dealing with multiple contacts and clients.
Enter Wassenger, a powerful CRM designed specifically for WhatsApp messaging. With Wassenger, businesses can effortlessly share documents, automate messaging, and stay connected with their teams and clients in a more organized way. This guide will show you how to leverage Wassenger to send documents seamlessly to WhatsApp contacts, saving you time and enhancing productivity.
🤩 🤖 Wassenger is a complete communication platform and API solution for WhatsApp. Explore more than 100+ API use cases and automate anything on WhatsApp by signing up for a free trial and get started in minutes!
Requirements
- Having a WhatsApp number already linked to the platform and online.
- Message recipient phone number with international prefix in E164 format. Example:
+12345678909. You can validate the phone number here.
Prepare the request
Target API URL using the POST method
https://api.wassenger.com/v1/messages
Required HTTPS headers > Obtain your API key here
Content-Type: application/json
Token: $API_TOKEN
Use body in JSON format
{ "phone": "+12345678909", "media": { "url": "https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611\_sample\_explain.pdf", "expiration": "30d" } }
Congrats! You can now send automatic messages using the API to groups on WhatsApp.
🤩 🤖 Wassenger is a complete API solution for WhatsApp. Sign up for a 7-day free trial and get started in minutes!
Are you a developer?
Explore how to use the code in your browser without installing any software.
Also, you can find different languages you can test on Replit.com:
# Examples requires to have installed requests Python package. # Install it by running: pip install requests
import requests url = "https://api.wassenger.com/v1/messages" payload = { "phone": "+12345667890", "media": { "url": "https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611\_sample\_explain.pdf", "expiration": "30d" } } headers = { "Content-Type": "application/json", "Token": "API TOKEN GOES HERE" } response = requests.post(url, json=payload, headers=headers) print(response.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.wassenger.com/v1/messages',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'phone' => '+1234567890',
'media' => [
'url' =>
'https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf',
'expiration' => '30d',
],
]),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Token: API TOKEN GOES HERE',
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo 'cURL Error #:' . $err;
} else {
echo $response;
}
// This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP. // Install it by running: pecl install pecl_http // More information: https://mdref.m6w6.name/http
append(json\_encode(\[ 'phone' => '+1234567890', 'media' => \[ 'url' => 'https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611\_sample\_explain.pdf', 'expiration' => '30d' \] \])); $request\->setRequestUrl('https://api.wassenger.com/v1/messages'); $request\->setRequestMethod('POST'); $request\->setBody($body); $request\->setHeaders(\[ 'Content-Type' => 'application/json', 'Token' => 'API TOKEN GOES HERE' \]); $client\->enqueue($request)->send(); $response = $client\->getResponse(); echo $response\->getBody(); - [C#](https://replit.com/new) (RestClient) // This code requires you to have installed RestSharp package. // Documentation: https://restsharp.dev // Installation: https://www.nuget.org/packages/RestSharp var client = new RestClient("https://api.wassenger.com/v1/messages"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddHeader("Token", "API TOKEN GOES HERE"); request.AddParameter("application/json", "{\\"phone\\":\\"+12345678909\\",\\"media\\":{\\"url\\":\\"https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611\_sample\_explain.pdf\\",\\"expiration\\":\\"30d\\"}}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); - [C#](https://replit.com/new) (HttpClient) // This code uses the built-in HttpClient package in the .NET framework. // Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0 using System.Net.Http.Headers; var client = new HttpClient(); var request = new HttpRequestMessage { Method = HttpMethod.Post, RequestUri = new Uri("https://api.wassenger.com/v1/messages"), Headers = { { "Token", "API TOKEN GOES HERE" }, }, Content = new StringContent("{\\"phone\\":\\"+12345678909\\",\\"media\\":{\\"url\\":\\"https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611\_sample\_explain.pdf\\",\\"expiration\\":\\"30d\\"}}") { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } } }; using (var response = await client.SendAsync(request)) { response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body); } - [Java](https://replit.com/new) // This code requires you to have installed Unirest package. // Documentation: https://kong.github.io/unirest-java/#requests // Installation: http://kong.github.io/unirest-java/ HttpResponse





