/chatkit-docusign

Chat that allows users to send messages until the have signed a document. Built with Chatkit, Docusign, React and Node.js

Primary LanguageJavaScriptMIT LicenseMIT

E-signatures in chats with ChatKit and Docusign

Chat build with React and Chatkit that uses a Node.js server to post messages. However, users can only post messages after signing a document using Docusign API. Follow the tutorial here.

Getting Started

  1. Clone this repository.
  2. Create a Chatkit instance if you haven't already.
  3. In the Chatkit dashboard of your instance, in the Instance Inspector section, create one or two users and one chat room.
  4. Follow this guide to:
  • Sign up for a Docusign developer sandbox.
  • Create an integrator key with a Redirect URI and RSA keypair (this will be your only chance to save these keys)
  • Add a template using the document you find in this repo (nda.pdf) or your own.
  1. Grant access to your integration key by visiting this URL (replace your integration key and redirect URI): https://account-d.docusign.com/oauth/auth? response_type=code&scope=signature%20impersonation&client_id=INTEGRATION_KEY&redirect_uri=REDIRECT_URI.
  2. In the file src/App.js enter:
  • Your Chatkit instance locator, something like v1:us1:xxxxxxxxxxxxxxxx
  1. In the file src/ChatScreen.js enter:
  • Your Chatkit room ID
  1. In the file server.js enter:
  • From Docusign:
    • Your Integrator Key
    • Your username API
    • Your template ID and role
    • A subdomain for the public URL of your server (that will be configured using localtunnel)
  • From Chatkit:
    • Your Chatkit instance locator, something like v1:us1:xxxxxxxxxxxxxxxx
    • Your Chatkit secret key, something like 0710e105-5f59-20765:rPejy0yUx3VzI=
  • One or two users's IDs and emails. The ID must match the one registered in Chatkit. In that email the user will receive the document from Docusign.
  1. Create a directory keys and inside of it, the file docusign_private_key.txt and paste the RSA private key from your integrator key.
  2. In a terminal window, execute npm install to install the dependencies of the app.
  3. Execute the server and the chat app with npm start.
  4. In another terminal window, install localtunnel with npm install -g localtunnel and execute lt --subdomain YOUR_SUBDOMAIN --port 3001 to expose your local server to the world so Docusign can call your webhook (the subdomain must match the one entered in server.js).
  5. Enter the username in the first screen of the app to enter the chat.
  6. Try sending a message. You won't be able to do it.
  7. Click on the button Send NDA to receive the document in the user's email and sign it.
  8. Monitor the server console to know when the webhook was called with the completion event.
  9. From that moment, the user will be able to send messages.
  10. Optionally, open the app in another browser to log in as another user, sign the document, and start chatting.

Prerequisites

Built With

  • Pusher Chatkit - Developer-driven chat done simply
  • Docusign - eSignature solutions
  • React.js - A JavaScript library for building interfaces
  • Node.js - A JavaScript runtime built on Chrome's V8 JavaScript engine

Acknowledgments

  • Thanks to Pusher for sponsoring this tutorial.

LICENSE

MIT