Articles in this section
Category / Section

How to Send Document Signature Requests via WhatsApp Using API

Published:

BoldSign enables you to send signature requests and document notifications through WhatsApp, offering a quick and convenient option for recipients who prefer this messaging platform.

This article explains how to send a document for signing via WhatsApp using the BoldSign API.

Requirements to use WhatsApp delivery

To utilize the WhatsApp delivery feature, the following conditions must be fulfilled:

  • A BoldSign Business Plan (or higher): This plan is required to access the feature. It is available for $15/month, allowing easy activation of WhatsApp delivery for your signature requests.
  • WhatsApp notification add-on: Each notification incurs a cost of $0.10, which is a minimal fee for immediate delivery.
  • Recipient’s phone number: Signers must have an active WhatsApp account linked to a valid mobile number with the appropriate country code.

Step 1: Activate WhatsApp delivery

  • Go to Settings in your BoldSign dashboard. Select Integration.
    image.png

  • Select WhatsApp.

  • Select Enable. If you’re on a free or lower-tier plan, a prompt will guide you to upgrade to a Business or higher-tier plan.

    image.png

  • If needed, follow the upgrade prompts to switch plans. It’s quick, and you’ll be back in action fast.

    image.png

  • Review the details and select Enableto turn on WhatsApp delivery.

  • Once enabled, the WhatsApp delivery feature can be used when sending documents. If needed, you can disable it later by clicking the Disable button on the WhatsApp card.
    image.png.

Step 2: Send document to the signer via WhatsApp signature request

Code Snippets:

Curl:

curl -X POST "https://api.boldsign.com/v1/document/send" \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
 "title": "Send document with Whatsapp",
 "message": "Please sign this",
 "signers": [
   {
     "name": "David",
     "deliveryMode": "Whatsapp",
     "phoneNumber": {
       "countryCode": "{signer country code}",
       "number": "{signer phone number}"
     },
     "signerType": "Signer",
     "signerRole": "Signer",
     "formFields": [
       {
         "id": "signer",
         "fieldType": "Signature",
         "pageNumber": 1,
         "bounds": {
           "x": 50,
           "y": 100,
           "width": 100,
           "height": 60
         },
         "isRequired": true
       }
     ]
   }
 ]
}' 

.NET:

var apiClient = new ApiClient("https://api.boldsign.com", "{Your API key}");
var documentClient = new DocumentClient(apiClient);

var documentFilePath = new DocumentFilePath
{
   ContentType = "application/pdf",
   FilePath = "{Your File path}"
};

var filesToUpload = new List<IDocumentFile>
{
   documentFilePath,
};

var signatureField = new FormField(
                       id: "signature",
                       isRequired: true,
                       type: FieldType.Signature,
                       pageNumber: 1,
                       bounds: new BoldSign.Model.Rectangle(x: 100, y: 100, width: 125, height: 25));

var formFieldCollections = new List<FormField>()
{
   signatureField
};

       var signer = new DocumentSigner(
           signerName: "David",
           phoneNumber: new PhoneNumber(
           countryCode: "{signer country code}",
           number: "{signer phone number}"),
           formFields: formFieldCollections,
           locale: Locales.EN);

       signer.DeliveryMode = DeliveryMode.Whatsapp;

       var documentSigners = new List<DocumentSigner>()
{
   signer
};

       var sendForSign = new SendForSign()
       {
           Signers = documentSigners,
           Title = "Send document with whatspp",
           Message="Please sign this",
           Files = filesToUpload
       };

       var documentCreated = documentClient.SendDocument(sendForSign);
       Console.WriteLine(documentCreated.DocumentId.ToString()); 

Python:

import boldsign

configuration = boldsign.Configuration(
   api_key = "Your API Key",
   host= "https://api.boldsign.com"
)

with boldsign.ApiClient(configuration) as api_client:

   document_api = boldsign.DocumentApi(api_client)

   form_fields = [
       boldsign.FormField(
           id="Signature",
           name="Signature",
           fieldType="Signature",
           pageNumber=1,
           font="Helvetica",
           bounds=boldsign.Rectangle(
               x=50,
               y=50,
               width=200,
               height=25
           ),
           isRequired=True
       )
   ]

   phone_number = boldsign.PhoneNumber(
       countryCode= "Signer Country Code",
       number="Signer Phone Number"
   )

   document_signer = boldsign.DocumentSigner(
       name="David",
       deliveryMode="WhatsApp",
       phoneNumber=phone_number,
       signerOrder=1,
       signerType="Signer",
       formFields=form_fields,
       locale="EN"
   )

   send_for_sign = boldsign.SendForSign(
       document_title = "SDK Document Test case",
       description="Testing document from SDK integration test case",
       files=["Your_File_Path"],
       message='Please sign this.',
       signers=[document_signer],
       title="Document SDK API"
   )

   send_document_response = document_api.send_document(send_for_sign) 

Node:

import { PhoneNumber } from 'boldsign';
import { DocumentApi } from '../api/documentApi';
import { DocumentSigner, FormField, Rectangle, RequestDetailedFile, SendForSign } from '../model';
import * as fs from 'fs';

const baseUrl:string = "https://api.boldsign.com"
const documentApi = new DocumentApi(baseUrl);
documentApi.setApiKey("Your API Key");

const bounds = new Rectangle();
bounds.x = 100;
bounds.y = 50;
bounds.width = 100;
bounds.height = 100;

var formField = new FormField();
formField.fieldType = FormField.FieldTypeEnum.Signature;
formField.pageNumber = 1;
formField.bounds = bounds;

const documentSigner = new DocumentSigner();
documentSigner.name = "Alex";
documentSigner.deliveryMode = DocumentSigner.DeliveryModeEnum.WhatsApp;
documentSigner1.formFields = [formField];

const phoneNumber = new PhoneNumber();
phoneNumber.countryCode = "Signer Country Code";
phoneNumber.number = "Signer Phone Number";

documentSigner1.phoneNumber = phoneNumber;



var sendForSign = new SendForSign();
sendForSign.title = "Agreement";
sendForSign.signers = [documentSigner];
var files = fs.createReadStream("examples/documents/agreement.pdf");
sendForSign.files = [files];

async function sendDocument() {
   try {
       var sendDocumentResponse = await documentApi.sendDocument(sendForSign);
       console.log("Document sent successfully:", sendDocumentResponse.documentId);
   } catch (error:any) {
       console.error("Error occurred while calling the API:", error.message);
   }
}

sendDocument(); 

PHP:

<?php
require_once(__DIR__ . '/../vendor/autoload.php');

use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\{SendForSign, FileInfo, DocumentInfo, FormField, Rectangle, DocumentSigner, PhoneNumber};

$config = new Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('Your API Key');

$apiInstance = new DocumentApi($config);

// Prepare SendForSign object
$sendForSign = new SendForSign();

// Set document info
$documentInfo = new DocumentInfo();
$documentInfo->setTitle('The Blueprint');
$documentInfo->setDescription('Please sign this document');
$sendForSign->setDocumentInfo($documentInfo);

// Set file info
$pdfFilePath = 'D:\BRUNO\BoldSign\doc.pdf';
if (!file_exists($pdfFilePath)) {
   die("Error: PDF file does not exist at the specified path: $pdfFilePath");
}


$sendForSign->setFiles([$pdfFilePath]);

// Set expiry and options
$sendForSign->setExpiryDateType('Days');
$sendForSign->setExpiryValue(60);
$sendForSign->setDisableEmails(false);
$sendForSign->setDisableSMS(false);
$sendForSign->setDocumentDownloadOption('Individually');

// Create signature field
$bounds = new Rectangle([100, 100, 100, 50]);
$signatureField = new FormField();
$signatureField->setFieldType('Signature');
$signatureField->setPageNumber(1);
$signatureField->setBounds($bounds);

// Create signer
$signer = new DocumentSigner();
$signer->setName("Alex");
$signer->setDeliveryMode('WhatsApp');

// Set phone number
$phoneNumber = new PhoneNumber();
$phoneNumber->setCountryCode("Signer Country Code");
$phoneNumber->setNumber("Signer phone number");
$signer->setPhoneNumber($phoneNumber);

$signer->setSignerType("Signer");
$signer->setFormFields([$signatureField]);

// Attach signer to request
$sendForSign->setSigners([$signer]);

// Send document
try {
   $result = $apiInstance->sendDocument($sendForSign);
   print_r($result);
} catch (Exception $e) {
   echo 'Exception when calling DocumentApi->sendDocument: ', $e->getMessage(), PHP_EOL;
} 

In the above examples, update the phonenumber with the phone number (along with country code) of the signer. Update the deliveryMode as WhatsApp. Additionally, replace the Files and Title properties with the appropriate document you want to send and its title. Also, provide form fields for the document in the formFields array.

After executing the above code, the document will be created, and a WhatsApp message will be sent to the signer. Now, the signer can sign the document by clicking the link in WhatsApp.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Access denied
Access denied