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
🤩 🤖 Wassenger is a complete API solution for WhatsApp. Sign up for a 7-day free trial and get started in minutes!
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:
Send Documents from URL:
// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP. // Install it first following these instructions: // https://docs.guzzlephp.org/en/stable/overview.html#installation
request('POST', 'https://api.wassenger.com/v1/messages', \[ 'body' => '{"phone":"+12345678909","media":{"url":"https://www.africau.edu/images/default/sample.pdf","expiration":"30d"}}', 'headers' => \[ 'Content-Type' => 'application/json', 'Token' => 'API TOKEN GOES HERE', \], \]); echo $response->getBody(); - [PHP (Http2)](https://replit.com/new) // 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.africau.edu/images/default/sample.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(); - [PHP (curl)](https://replit.com/new) "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' => '+12345678909', 'media' => \[ 'url' => 'https://www.africau.edu/images/default/sample.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; } Send Documents from an uploaded file: **Replace this expression with the specific value:** `{{UPLOADED FILE ID}}` - [PHP (Guzzle)](https://replit.com/new) // This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP. // Install it first following these instructions: // https://docs.guzzlephp.org/en/stable/overview.html#installation request('POST', 'https://api.wassenger.com/v1/messages', \[ 'body' => '{"phone":"+12345678909","message":"This is a caption for an image message","media":{"file":"{{UPLOADED FILE ID}}"}}', 'headers' => \[ 'Content-Type' => 'application/json', 'Token' => 'API TOKEN GOES HERE', \], \]); echo $response->getBody(); - [PHP (Http2)](https://replit.com/new) // 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' => '+12345678909', 'message' => 'This is a caption for an image message', 'media' => \[ 'file' => '{{UPLOADED FILE ID}}' \] \])); $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(); - [PHP (curl)](https://replit.com/new) "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' => '+12345678909', 'message' => 'This is a caption for an image message', 'media' => \[ 'file' => '{{UPLOADED FILE ID}}' \] \]), 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; } > *🤩 🤖* [***Wassenger***](https://wassenger.com/) *is a complete communication platform and API solution for WhatsApp.* [***Explore more than 100+ API use cases and automate anything on WhatsApp***](https://wassenger.com/) *by signing up* [*for a free trial and getting started in minutes****!***](https://wassenger.com/register) #### Live testing to send a message to a group via API  [Try the Wassenger’s API live tester](https://app.wassenger.com/help/api-tester) ### FAQs #### How to send messages to multiple contacts You have to send multiple API requests, one per target contact. For instance, to send a message to 10 groups, you should send 10 independent HTTPS requests to the API. There is no option to send multiple messages in a single API request. #### What type of messages can be sent? You can send different messages, including text, images, videos, emojis, audio, gifs, geographic locations and file documents via API. Check out [other tutorials](https://app.wassenger.com/help/category/tutorials) for more information. #### Can I schedule bulk messages for a specific time? Yes, Wassenger allows you to [schedule campaigns](https://wassenger.com/campaigns) in advance to send messages at the most convenient time for your audience. #### Further useful resources [API Documentation](https://wassenger.com/docs) For more details about the endpoint API, please check our documentation. You will find all the details about the accepted request parameters, possible success or error responses, and ready-to-use code examples in multiple programming languages. [https://app.wassenger.com/docs/#tag/Messages](https://app.wassenger.com/docs/#tag/Messages)





