Boldsign Elixir Client

Unofficial Elixir client for BoldSign.

Built with Req.

Quick Start with LiveBook

The easiest way to get started is through our interactive LiveBook examples:

Embedded Signing

Complete working demonstration of BoldSign embedded signing:

Run in Livebook

Installation

The package can be installed by adding boldsign to your list of dependencies in mix.exs:

def deps do
  [
    {:boldsign, "~> 0.1.0"}
  ]
end

Usage

Configuration

client = Boldsign.new(api_key: "your_api_key")
# or for EU region
client = Boldsign.new(api_key: "your_api_key", region: :eu)

Documents

Send a Document with Text Tags

Text tags are the best way to place fields in generated PDFs without using coordinates.

params = %{
  title: "Agreement",
  useTextTags: true,
  textTagDefinitions: [
    %{
      definitionId: "SignHere",
      signerIndex: 1,
      type: "Signature"
    }
  ],
  signers: [%{name: "John Doe", email: "john@example.com"}]
}

Boldsign.Document.send(client, params)

List Documents

documents = Boldsign.Document.list(client, page: 1, pageSize: 10)

Templates

Send Document from Template

Boldsign.Template.send(client, "template_id", %{
  roles: [%{roleIndex: 1, name: "John Doe", email: "john@example.com"}]
})

Users & Teams

users = Boldsign.User.list(client)
teams = Boldsign.Team.list(client)

Webhooks

Verify Signature

# In your Phoenix controller
payload = conn.assigns[:raw_body]
signature = get_req_header(conn, "x-boldsign-signature") |> List.first()
secret = "your_webhook_secret"

if Boldsign.Webhook.verify_signature(payload, signature, secret) do
  # Valid
else
  # Invalid
end

Credits

This project is inspired by the Dashbit blog post on building SDKs with Req. Formatting and CI structure borrowed from docusign_elixir. Uses Quokka for formatting.