Category / Section
How to send a signature request through both email and SMS using BoldSign API?
Published:
7 mins read
BoldSign offers three options to send the documents to signers:
- SMS
- 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
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}' \
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: "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);
Python
import boldsign
configuration = boldsign.Configuration(
api_key = "YOUR_API_KEY"
)
with boldsign.ApiClient(configuration) as api_client:
document_api = boldsign.DocumentApi(api_client)
send_for_sign = boldsign.SendForSign(
title="Document SDK API",
document_title = "SDK Document Test case",
description="Testing document from SDK integration test case",
files=["YOUR_FILE_PATH"],
signers=[
boldsign.DocumentSigner(
name="Hanky",
emailAddress="hankyWhites@cubeflakes.com",
signerOrder=1,
signerType="Signer",
deliveryMode="EmailAndSMS",
phoneNumber=boldsign.PhoneNumber(
countryCode = "+91",
number = "9876543210"
),
formFields=[
boldsign.FormField(
name="Sign",
fieldType="Signature",
font="Helvetica",
pageNumber=1,
isRequired=True,
bounds=boldsign.Rectangle(x=50, y=50, width=100, height=150)
)
],
privateMessage="This is private message for signer"
)
]
)
send_document_response = document_api.send_document(send_for_sign)
NodeJS
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.