DocuSign Connect with AWS S3 -Part One

DocuSign Connect with AWS S3

Before Starting


But I wanted more than that. I needed to store signed documents in AWS S3 bucket. By default (2019–01) DocuSign does not support AWS S3 bucket in the current version. But they have provided a custom option which we can give a Webhook URL then whatever the configured event that happened, DocuSign will involve our URL. So we can get the real-time notification from DocuSign.

Let’s Start

  1. Creating a Lambda Function
    We need some logic execution when DocuSign calls our webhook (API). So we are going to use Node.js for serverside execution. To create Lambda, go to AWS Lambda Homepage and let’s create a new function from the top right corner.
Creating Lambda Function

I gave the function name as docusing-lambda-v1, (you can have your own name). Select Runtime to Node.js (I used the highest version here). Create a new Role form the template and give a name for the role. Select Basic Edge Lambda Permissions” from policy templates. That’s it. In the next step, we need some trigger to execute this function. In this tutorial, I will be using API Gateway as a trigger.

2. Creating new API Gateway
Let’s create a new API in AWS. This endpoint going to call form the DocuSign side when the event happens. Simply we can create a new API in the AWS Console. To do this, go to API Gateway Homepage and create a new API.

Creating new API Gateway

You are free to have a name as you wish, but I named it as docusign-webhook-v1 and kept Endpoint Type as Regional. After that, we need to create a method for API.

I created a method as a post method. DocuSign will call this endpoint (webhook) method as POST request with a notification XML file. Next, it is required setup POST method.

Post method setup

Select integration type as Lambda Function.

Check Lambda Proxy Integration.

Choose the Lambda function which we created previously.

Check default Timeout and Save. Then it will ask to give Permission to Lambda Function click OK. That’s it.

Finally, we need to deploy our API. If you make any changes to the API don’t forget to deploy. When deploying the API, you need to select the Deployment stage, so I created a new stage as dev-stage. Then click OK, now it will generate API endpoint URL.

Every time when you update an API, which includes modification of routes, methods, integrations, authorizes, and anything else other than stage settings, you must redeploy the API to an existing stage or to a new stage.
— AWS Documentation —

Now you can go to the AWS Lambda Homepage and select Function which was created previously (docusing-lambda-v1). You can see the API Gateway connect with Lambda function.

All right. That’s all for now. Let’s test our API using postman. API endpoint URL you can get it by clicking on API Gateway, at the bottom you will see Invoke URL

3. Testing API
To test our API we will send a POST request to the endpoint and according to our current Lambda function, it will respond as Hello from Lambda!. This message is coming from our node .js file which was auto-generated with our Lambda function creation.

Default Generated Function
Test API using Postman

If you see the response Hello from Lambda!. we have successfully completed part one. In the second part of this tutorial, we are going to create AWS S3 bucket and store documents in them which are sending by the DocuSign application.

Click here for go to the Part Two.

If you really enjoy this post, Please don’t forget to share and follow.

Software Engineer