This is an example worker application for Connect webhook notification messages sent via the Google Cloud Pub/Sub service.
This application receives messages from the queue via a Pub/Sub Subscription, and then processes them:
-
If the envelope is complete, the application uses a DocuSign JWT Grant token to retrieve the envelope's combined set of documents, and stores them in the
outputdirectory.The envelope must include an Envelope Custom Field named
Sales order.The Sales order field is used to name the output file. -
Optionally, this worker app can be configured to also change the color of an LIFX bulb (or set of bulbs) to the color set in the envelope's Custom Field
Light color
This figure shows the solution's architecture. This worker application is written in Node.js. But it could be written in a different language.
Google has SDK libraries for Pub/Sub clients for C#, Go, Java, Node.js, PHP, Python, and Ruby.
-
Install the example Connect listener for Google Cloud on Google Cloud. At the end of this step, you will have the
Subscription nameand aService Account credentials file. -
Install the latest Long Term Support version of Node v8.x or v10.x on your system, with the npm package manager.
-
Configure a DocuSign Integration Key for the application. The application uses the OAuth JWT Grant flow.
If consent has not been granted to the application by the user, then the application provides a url that can be used to grant individual consent.
To enable individual consent: either add the URL
https://www.docusign.comas a redirect URI for the Integration Key, or add a different URL and update theoAuthConsentRedirectURIsetting in the ds_configuration.js file. -
Download this repo to a directory.
-
In the directory:
npm install -
Configure
ds_configuration.jsor set the environment variables as indicated in that file. -
Set and export the environment variable
GOOGLE_APPLICATION_CREDENTIALSto the name (and directory) of the service account JSON credentials file. DocuSign suggestsgcloud.json -
Start the listener:
npm start
Configure a DocuSign Connect subscription to send notifications to the Cloud Function. Create / complete a DocuSign envelope. The envelope must include an Envelope Custom Field named "Sales order".
-
Check the Connect logs for feedback.
-
Check the console output of this app for log output.
-
Check the
outputdirectory to see if the envelope's combined documents and CoC were downloaded.By default, the documents will only be downloaded if the envelope is complete and includes a
Sales ordercustom field.
The repo includes a runTest.js file. It conducts an
end-to-end integration test of enqueuing and dequeuing
test messages. See the file for more information.
This repository uses the MIT License. See the LICENSE file for more information.
Pull requests are welcomed. Pull requests will only be considered if their content uses the MIT License.
