Skip to content
master
Go to file
Code

README.md

DocuSign eSignature Bash Code Examples

Github repo: code-examples-bash

Introduction

This repo includes a bash command line application that use curl to demonstrate:

  1. Embedded Signing Ceremony. Source. This example sends an envelope, and then uses an embedded signing ceremony for the first signer. With embedded signing, the DocuSign signing ceremony is initiated from your website.
  2. Send an envelope with a remote (email) signer and cc recipient. Source. The envelope includes a pdf, Word, and HTML document. Anchor text (AutoPlace) is used to position the signing fields in the documents.
  3. List envelopes in the user's account. Source.
  4. Get an envelope's basic information. Source. The example lists the basic information about an envelope, including its overall status.
  5. List an envelope's recipients Source. Includes current recipient status.
  6. List an envelope's documents. Source.
  7. Download an envelope's documents. Source. The example can download individual documents, the documents concatenated together, or a zip file of the documents.
  8. Programmatically create a template. Source.
  9. Send an envelope using a template. Source.
  10. Send an envelope and upload its documents with multipart binary transfer. Source. Binary transfer is 33% more efficient than using Base64 encoding.
  11. Embedded sending. Source. Embeds the DocuSign web tool (NDSE) in your web app to finalize or update the envelope and documents before they are sent.
  12. Embedded DocuSign web tool (NDSE). Source.
  13. Embedded Signing Ceremony from a template with an added document. Source. This example sends an envelope based on a template. In addition to the template's document(s), the example adds an additional document to the envelope by using the Composite Templates feature.
  14. Payments Example. Source. An order form, with online payment by credit card.
  15. Get the envelope tab data. Retrieve the tab (field) values for all of the envelope's recipients. Source.
  16. Set envelope tab values. The example creates an envelope and sets the initial values for its tabs (fields). Some of the tabs are set to be read-only, others can be updated by the recipient. The example also stores metadata with the envelope. Source.
  17. Set template tab values. The example creates an envelope using a template and sets the initial values for its tabs (fields). The example also stores metadata with the envelope. Source.
  18. Get the envelope custom field data (metadata). The example retrieves the custom metadata (custom data fields) stored with the envelope. Source.
  19. Requiring an Access Code for a Recipient Source. This example sends an envelope using remote (email) signing requiring the recipient to enter an access code.
  20. Send an envelope with a remote (email) signer using SMS authentication. Source. This example sends an envelope using remote (email) signing requiring the recipient to supply a verification code sent to them via SMS.
  21. Send an envelope with a remote (email) signer using Phone authentication. Source. This example sends an envelope using remote (email) signing requiring the recipient to supply a verification code sent to them via a phone call.
  22. Send an envelope with a remote (email) signer using Knowledge-Based authentication. Source. This example sends an envelope using remote (email) signing requiring the recipient to validate their identity via Knowledge-Based authentication.
  23. Send an envelope with a remote (email) signer using Identity Verification. Source. This example sends an envelope using remote (email) signing requiring the recipient to validate their identity via a government-issued ID.
  24. Creating a permission profile Source. This code example demonstrates how to create a permission profile using the Create Permission Profile method.
  25. Setting a permission profile Source. This code example demonstrates how to set a user group’s permission profile using the Update Group method. You must have already created the permissions profile and the group of users.
  26. Updating individual permission settings Source. This code example demonstrates how to edit individual permission settings on a permissions profile using the Update Permission Profile method.
  27. Deleting a permission profile Source. This code example demonstrates how to delete a permission profile using the Delete Permission Profile method.
  28. Creating a brand Source. This example creates brand profile for an account using the Create Brand method.
  29. Applying a brand to an envelope Source. This code example demonstrates how to apply a brand you've created to an envelope using the Create Envelope method. First, creates the envelope and then applies the brand to it. Anchor text (AutoPlace) is used to position the signing fields in the documents.
  30. Applying a brand to a template Source. This code example demonstrates how to apply a brand you've created to a template using the Create Envelope method. You must have already created the template and the brand. Anchor text (AutoPlace) is used to position the signing fields in the documents.
  31. Bulk sending envelopes to multiple recipients Source. This code example demonstrates how to send envelopes in bulk to multiple recipients using these methods: Create Bulk Send List, Create Bulk Send Request. Firstly, creates a bulk send recipients list, and then creates an envelope. After that, initiates bulk envelope sending.

Installation

  • Download or clone this repository to your workstation git clone https://github.com/docusign/code-examples-bash
  • Create a DocuSign developer account if you have not yet done so
  • Once you have a Docusign account created, make a new integration key
  • Add in the following redirect uri http://localhost:8080/authorization-code/callback
  • Signer name and email: Remember to try the DocuSign signing ceremony using both a mobile phone and a regular email client
  • Carbon Copy name and email: Do not use the same email address for the CC and the Signer
  • [JWT - OPTIONAL] create an RSA keypair on your integration key and copy the private_key into the file config/private.key and save it. Use JWT authentication if you intend to run a system account integration or to impersonate a different user.
  • [JWT - CONTINUED] If you intend to use JWT grant authentication, set IMPERSONATION_USER_GUID by using your own user_account_id found on the same page used to set your integration key.
  • Copy the file 'config/settings.example.txt' to 'config/settings.txt'
  • Fill in your API credentials, Signer name/email and CC name/email using the requirements listed above into 'config/settings.txt'

OAuth Details

This launcher is a collection of bash scripts, however the OAuth mechanisms are PHP scripts that setup a small HTTP listener on port 8080 in order to receive the redirect callback from successful authorization with DocuSign servers that include the Authorization code or an access token in the response payload. Please ensure that any other webserver using 8080 are off so that the OAuth mechanism functions properly.

These PHP scripts are integrated into the launcher and hardcode the location for the RSA private key in the case of the JWT PHP scripts.

Do not delete or change the name of the private.key file located in the config directory as this will cause problems with jwt authentication.

Running the examples

You can see each of the various examples in action by running bash launcher.sh and pressing numbers 1 or 2 to login using OAUTH and store an access token. (JWT tokens are good for 1 hour, Authorization Code grant tokens are good for 8 hours.)

On successful login, you will be presented with a menu to run the various examples available. For example: Press "2", to try eg002SigningViaEmail.

The examples have been tested on Windows using the Git-Bash software included with the git for Windows open source application.

The scripts can also be used with MacOS and Linux systems.

The source files for each example are located in the /examples directory.

Note: If your DocuSign account has more than one user associated with it, the first user is selected for subsequent API calls.

Payments code example

To use the payments code example, first create a test payments gateway in your account. Follow the instructions in the PAYMENTS_INSTALLATION.md file.

Then add the payment gateway id to the code example file.

License and additional information

License

This repository uses the MIT License. See the LICENSE file for more information.

Pull Requests

Pull requests are welcomed. Pull requests will only be considered if their content uses the MIT License.

You can’t perform that action at this time.