How to send a signature request through both email and SMS using BoldSign API?

BoldSign offers three options to send the documents to signers:

  1. Email
  2. SMS
  3. Email & SMS

In this article, we will walk through how to request a signature from a signer through both email and SMS using the BoldSign API.

It's important to note that SMS feature will be avilable only for paid plans.

Send document to the signer via Email and SMS

Below are example codes for sending a document to the signer via both Email and SMS:

Code snippet

curl -X 'POST' \ 'https://api.boldsign.com/v1/document/send' \
     -H 'accept: application/json' \
     -H 'X-API-KEY: {your API key}' \
     -H 'Content-Type: multipart/form-data' \
     -F 'Message=' \
     -F 'Signers={
        "name": "Hanky",
        "emailAddress": "hankyWhites@gmail.com",
        "signerType": "Signer",
        "deliveryMode": "EmailAndSMS",
        "phoneNumber": {
            "countryCode": "{Signer country code}",
            "number": "{Signer phone number}"
        },
        "formFields": [
           {
                "id": "signature",
                "name": "signature",
                "fieldType": "Signature",
                "pageNumber": 1,
                "bounds": {
                  "x": 100,
                  "y": 100,
                  "width": 200,
                  "height": 200
                   },
      "isRequired": true
    }
  ],
  "locale": "EN"
}' \
  -F 'Files=@{your file}' \
  -F 'Title={title}' \

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: "sign",
   isRequired: true,
   type: FieldType.Signature,
   pageNumber: 1,
   bounds: new Rectangle(x: 100, y: 100, width: 100, height: 50));

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

var signer = new DocumentSigner(
    signerName: "David",
    signerType: SignerType.Signer,
    signerEmail: "david@cubeflakes.com",
    formFields: formFieldCollections,
    locale: Locales.EN);

signer.DeliveryMode = DeliveryMode.EmailAndSMS;

signer.PhoneNumber = new PhoneNumber(
    countryCode: "{Signer country code}",
    number: "{Signer phone number}"
);

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

var sendForSign = new SendForSign()
{
   Title = "Agreement",
   Signers = documentSigners,
   Files = filesToUpload
};
var documentCreated = documentClient.SendDocument(sendForSign);
import requests
import json

url = "https://api.boldsign.com/v1/document/send"

signer_data = {
    "name": "Hanky",
    "emailAddress": "hankyWhites@gmail.com",
    "signerType": "Signer",
    "signerRole": "Signer",
    "deliveryMode": "EmailAndSMS",
    "phoneNumber": {
        "countryCode": "{Signer country code}",
        "number": "{Signer phone number}"
    },
    "formFields": [
        {
            "id": "signature",
            "name": "signature",
            "fieldType": "Signature",
            "pageNumber": 1,
            "bounds": {
                "x": 100,
                "y": 100,
                "width": 200,
                "height": 200
            },
            "isRequired": True
        }
    ],
    "locale": "EN"
}

payload = {
    'Signers': json.dumps(signer_data),
    'Title': '{title}'
}

files = [
    ('Files', ('{Your file name}', open('{Your file path}', 'rb'), 'application/pdf'))
]

headers = {
    'accept': 'application/json',
    'X-API-KEY': '{Your API Key}'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
let data = new FormData();
data.append('Signers', '{\r\n        "name": "Hanky", \r\n  "emailAddress": "hankyWhites@gmail.com", \r\n        "signerType": "Signer", \r\n  "signerRole": "Signer", \r\n        "deliveryMode": "EmailAndSMS",\r\n                "phoneNumber": {\r\n                  "countryCode": "{Signer country code}",\r\n                  "number": "{Signer phone number}"\r\n                   },\r\n        "formFields": [\r\n           {\r\n                "id": "signature",\r\n                "name": "signature",\r\n                "fieldType": "Signature",\r\n                "pageNumber": 1,\r\n                "bounds": {\r\n                  "x": 100,\r\n                  "y": 100,\r\n                  "width": 200,\r\n                  "height": 200\r\n                   },\r\n      "isRequired": true\r\n    }\r\n  ],\r\n  "locale": "EN"\r\n}');
data.append('Files', fs.createReadStream('{Your file path}'));
data.append('Title', '{title}');

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.boldsign.com/v1/document/send',
  headers: { 
    'accept': 'application/json', 
    'X-API-KEY': '{Your API key}', 
    ...data.getHeaders()
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

Replace the values (Files, Signers, etc.) with the actual values. Set the value for deliveryMode as EmailAndSMS, and provide values for countryCode and number with the signer's country code and phone number.

Upon execution, the document will be created and send to signer via both SMS and Email, and a document ID will be generated.