Send PDF

Legacy APIs - WhatsApp
Legacy WhatsApp API We only offer this type of WhatsApp API to customers who specifically request it. We have now moved to the official WhatsApp. To use official WhatsApp, contact us on WhatsApp +265992026866.
Starting a new integration? This is a legacy API. It stays available for existing integrations, but new integrations should use the SMS V3 APIs.

Send a PDF file on WhatsApp.

POSThttp://HOST:PORT/base64/pdf

Send a JSON body.

Parameters

Parameter Required Description
recipient YES The phone number to send to.
file YES The file, base64 encoded.
caption NO A caption for the file.
name YES The name of the file, for example PDF_File.pdf.
password YES The password for your WhatsApp app. Ask us for it.

Example request

curl --location --request POST 'http://HOST:PORT/base64/pdf' \
  --header 'Content-Type: application/json' \
  --data '{
  "recipient": "recipient",
  "file": "base64_encoded_file_content",
  "caption": "Your caption here",
  "name": "PDF_File.pdf",
  "password": "Ask_for_the_password"
}'
curl --location --request POST "http://HOST:PORT/base64/pdf" ^
  --header "Content-Type: application/json" ^
  --data "{\"recipient\":\"recipient\",\"file\":\"base64_encoded_file_content\",\"caption\":\"Your caption here\",\"name\":\"PDF_File.pdf\",\"password\":\"Ask_for_the_password\"}"
<?php

$headers = [
    'Content-Type: application/json',
];

$data = [
    'recipient' => 'recipient',
    'file' => 'base64_encoded_file_content',
    'caption' => 'Your caption here',
    'name' => 'PDF_File.pdf',
    'password' => 'Ask_for_the_password'
];

$ch = curl_init('http://HOST:PORT/base64/pdf');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

print_r(json_decode($response, true));
const axios = require('axios');

axios.request({
  method: 'post',
  url: 'http://HOST:PORT/base64/pdf',
  headers: {
    'Content-Type': 'application/json'
  },
  data: {
    "recipient": "recipient",
    "file": "base64_encoded_file_content",
    "caption": "Your caption here",
    "name": "PDF_File.pdf",
    "password": "Ask_for_the_password"
  }
}).then((res) => console.log(res.data))
  .catch((err) => console.error(err.response ? err.response.data : err.message));
import requests

headers = {
    'Content-Type': 'application/json'
}
payload = {
    'recipient': 'recipient',
    'file': 'base64_encoded_file_content',
    'caption': 'Your caption here',
    'name': 'PDF_File.pdf',
    'password': 'Ask_for_the_password'
}

response = requests.request('POST', 'http://HOST:PORT/base64/pdf', headers=headers, json=payload)
print(response.json())

Good to know

  • Your WhatsApp app has its own address (host and port), which we give you when the app is set up. Replace HOST:PORT with it.