BoldSign Embedded Signing with Elixir
Setup
This Livebook demonstrates how to use the BoldSign Elixir client for embedded signing. It supports either an API key or an OAuth access token and uses a public sample PDF URL by default so you can run it immediately.
Mix.install([
{:boldsign, "~> 0.7.0"},
{:kino, "~> 0.12.0"}
])
Configuration
Choose your auth method, enter the credential, and select the target region.
auth_mode_input =
Kino.Input.select("Auth Method", [
api_key: "API Key",
access_token: "OAuth Access Token"
])
credential_input = Kino.Input.password("Credential")
region_input =
Kino.Input.select("Region", [
us: "US (api.boldsign.com)",
eu: "EU (eu-api.boldsign.com)",
ca: "CA (ca-api.boldsign.com)",
au: "AU (au-api.boldsign.com)"
])
[Kino.render(auth_mode_input), Kino.render(credential_input), Kino.render(region_input)]
|> Kino.Layout.grid(columns: 3)
auth_mode = Kino.Input.read(auth_mode_input)
credential = Kino.Input.read(credential_input)
region = Kino.Input.read(region_input)
client =
case auth_mode do
:api_key -> Boldsign.new(api_key: credential, region: region)
:access_token -> Boldsign.new(access_token: credential, region: region)
end
IO.puts("Client configured for #{region} region using #{auth_mode}")
Step 1: Prepare Document
We’ll send a simple document request first using a hosted PDF.
signer_name = Kino.Input.text("Signer Name", default: "John Doe")
signer_email = Kino.Input.text("Signer Email", default: "john@example.com")
file_url = Kino.Input.text(
"PDF URL",
default: "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
)
[Kino.render(signer_name), Kino.render(signer_email), Kino.render(file_url)]
|> Kino.Layout.grid(columns: 3)
params = %{
title: "Livebook Agreement",
message: "Please sign this document from Livebook.",
fileUrls: [Kino.Input.read(file_url)],
signers: [
%{
name: Kino.Input.read(signer_name),
emailAddress: Kino.Input.read(signer_email),
signerOrder: 1
}
]
}
response = Boldsign.Document.send(client, params)
document_id = response["documentId"]
IO.puts("✅ Document created with ID: #{document_id}")
Step 2: Get Embedded Signing Link
Now we generate the link that the user will use to sign.
# We need the email of the signer we just created
email = Kino.Input.read(signer_email)
# Get the link
link_response =
Boldsign.Document.get_embedded_sign_link(client, document_id, %{
"SignerEmail" => email
})
sign_link = link_response["signLink"]
Kino.Markdown.new("""
### [Click here to sign the document](#{sign_link})
Or copy this URL:
`#{sign_link}`
""")
Step 3: Check Status
After signing, you can check the document properties.
properties = Boldsign.Document.get_properties(client, document_id)
status = properties["status"]
IO.puts("Current Document Status: #{status}")
Kino.Tree.new(properties)