Articles in this section
Category / Section

How to request eSignature via SMS (Text Messages) using BoldSign API?

Published:
5 mins read

BoldSign offers options to send the documents to signers via SMS. This article guides you on how to send a document for signing via SMS using the BoldSign API.

Send document to the signer via SMS(Text messages)

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

Code snippet

cURL

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=Please sign this' \
  -F 'Signers={
  "name": "David",
  "deliveryMode":"SMS",
  "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
   }
 ]
}' \
  -F 'Files=@{your file path}' \

C#

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.SMS;

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

        var sendForSign = new SendForSign()
        {
            Signers = documentSigners,
            Title = "Sample Document",
            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")

with boldsign.ApiClient(configuration) as api_client:
    document_api = boldsign.DocumentApi(api_client)

    form_fields = [
        boldsign.FormField(
            fieldType="Signature",
            pageNumber=1,
            bounds=boldsign.Rectangle(x=100, y=100, width=200, height=100),
            isRequired=True
        )
    ]

    document_signer = boldsign.DocumentSigner(
        name="David",
        phoneNumber=boldsign.PhoneNumber(
            countryCode="{signer country code}",
            number="{signer phone number}"
        ),
        signerType="Signer",
        deliveryMode="SMS",
        signerRole="Signer",
        formFields=form_fields,
        locale="EN"
    )

    send_for_sign = boldsign.SendForSign(
        title="Sample Document",
        message="Please sign this",
        files=["Your_File_Path"],
        signers=[document_signer]
    )

    send_document_response = document_api.send_document(send_for_sign)

print(send_document_response)

NodeJS

const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
 
const form = new FormData();

form.append('Message', 'Please sign this.');
form.append('Signers', '{\n  "name": "David",\n "deliveryMode":"SMS",\n "phoneNumber":{"countryCode":"{signer country code}","number":"{signer phone number}"},\n  "formFields": [\n    {\n      "fieldType": "Signature",\n      "pageNumber": 1,\n      "bounds": {\n        "x": 100,\n        "y": 100,\n        "width": 100,\n        "height": 50\n      },\n      "isRequired": true\n    }\n  ]\n}');
form.append('Files', fs.createReadStream('{your file path}'));
form.append('Title', 'Sample document');
 
let config = {
    method: 'post',
    maxBodyLength: Infinity,
    url: 'https://api.boldsign.com/v1/document/send',
    headers: {
      'accept': 'application/json',
      'X-API-KEY': '{Your API key}',
      ...form.getHeaders()
    },
    data : form
  };
   
  axios.request(config)
  .then((response) => {
    console.log(JSON.stringify(response.data));
  })
  .catch((error) => {
    console.log(error);
  });

In the above examples, update the phonenumber with the phone number(along with country code) of the signer. Update the deliveryMode as SMS. 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 an SMS(Text Messages) will be sent to the signer. Now, the signer can sign the document by clicking the link in the SMS(Text Messages).

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