Request an eSignature via SMS when sending a document from a template

This article guides you on how to send a document from a template and notify the signer via SMS. If you frequently need to send the same documents, you can create a template and use it to streamline the signing process. For more information, please refer to the Create Template article.

BoldSign offers three options for sending documents to signers:

  1. Email
  2. SMS
  3. Email & SMS

Below are example codes for sending a document using a template to the signer via SMS:

Code snippet

curl -X 'POST' \ 'https://api.boldsign.com/v1/template/send?templateId=44adfcc0-xxxx-xxxx-8ae3-4a7fbcdfa5c3' \
     -H 'accept: application/json' \
     -H 'X-API-KEY: {Your API Key}' \
     -H 'Content-Type: application/json;odata.metadata=minimal;odata.streaming=true' \
     -d '{
       "title": "Sample document",
       "message": "Kindly review and sign this.",
       "roles": [
    {
      "roleIndex": 1,
      "signerName": "Richard",
      "signerType": "Signer",
      "signerRole": "Manager",
      "phoneNumber": {
        "countryCode": "{Signer country code}",
        "number": "{Signer phone number}"
      },
      "deliveryMode": "SMS",

      "locale": "EN"
    }
  ],
  
 }'


using BoldSign.Api;
using BoldSign.Model;

var apiClient = new ApiClient("https://api.boldsign.com", "{Your API Key}");
var templateClient = new TemplateClient(apiClient);

var templateRole = new Roles()
{
    SignerName = "Richard",
    SignerRole = "Manager",
    SignerType = SignerType.Signer,
    RoleIndex = 1,
    DeliveryMode = DeliveryMode.SMS,
    PhoneNumber = new PhoneNumber() { CountryCode="{signer country code}",Number = "{signer phone number}"},
};

var roles = new List<Roles>
{
    templateRole,
};

var sendForSignFromTemplate = new SendForSignFromTemplate()
{
    TemplateId = "44adfcc0-xxxx-xxxx-8ae3-4a7fbcdfa5c3",
    Roles = roles,
    Title = "Sample document"
};

var documentCreated = templateClient.SendUsingTemplate(sendForSignFromTemplate);
Console.WriteLine(documentCreated.DocumentId);
import requests
import json

url = "https://api.boldsign.com/v1/template/send?templateId=44adfcc0-xxxx-xxxx-8ae3-4a7fbcdfa5c3"
payload = {
    "title": "Sample document",
    "message": "Kindly review and sign this.",
    "roles": [
        {
            "roleIndex": 1,
            "signerName": "Richard",
            "phoneNumber": {
                "countryCode": "{Signer country code}",
                "number": "{Signer phone number}"
            },
            "deliveryMode": "SMS",
            "signerType": "Signer",
            "signerRole": "Manager"
        }
    ],
}
headers = {
    'accept': 'application/json',
    'X-API-KEY': '{Your API Key}',
    'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.text)

const axios = require('axios');

async function GetData(){
try{
 
const response = await axios.post(
    'https://api.boldsign.com/v1/template/send',
    {
        'roles': [
            {
                'roleIndex': 1,
                'signerName': 'Richard',
                "phoneNumber": {
                    "countryCode": "{Signer Country Code}",
                    "number": "{Signer Phone number}"
                  },
                  "deliveryMode": "SMS",
                
          },
           
        ],
      
        title: "Sample document",
	    message: "Kindly review and sign this.",
    },
    {

        params: {
            'templateId': '44adfcc0-xxxx-xxxx-8ae3-4a7fbcdfa5c3',
        },
        headers: {
            'accept': 'application/json',
            'X-API-KEY':'{Your API Key}',
            'Content-Type': 'application/json;odata.metadata=minimal;odata.streaming=true'
        }
    }

);
  console.log(JSON.stringify(response.data));
  return response;
  }
  catch (error) {
    console.error('Error:', error.message);
    throw error; 
  } 
}
  GetData();

In the above examples, update the deliveryMode as SMS and replace SignerName with the name of the signer. Replace templateId with the ID of the existing template to be used for sending the document, and update the CountryCode and Number with the signer's country code and phone number.

After executing the above code, the document will be created, and an SMS will be sent to the signer's phone number. The signer can then sign the document by clicking the link in the SMS.