From DocuSign, this is Developing with DocuSign. This video is the first of a multipart
instructional series on how to deploy a DocuSign Connect listener on different cloud providers.
My name is Nima Poulad, a developer advocate with DocuSign.
Let's quickly recap what DocuSign Connect is and why we need it.
If you need to receive notifications on the status of your envelope, to be notified when
an envelope is completed, for example, you have two options available to you. First,
you can simply poll our endpoints to get the status. This option, however, is very expensive.
And as a matter of fact, we won't let you poll us for a status more than once every 15 minutes.
To address this issue, DocuSign Connect was introduced-- don't call us, let us call you.
By specifying an endpoint, you can help us deliver notifications to your app when they are available.
The endpoint needs to be public, and we should be able to call it from our side. This means you'll
need to make firewall changes on your side to allow us to call your notification endpoint.
Opening a hole in your firewall to receive DocuSign Connect notification
poses security challenges. It is difficult to secure that firewall hole properly.
As such, we propose an architecture that allows you to receive the correct notification
without making any changes to your firewall settings.
In this setup, you have a listener that is running as a Serverless function in your preferred cloud
provider. DocuSign will deliver the notification to this listener, and the listener is responsible
for queuing the events inside your preferred queuing system-- in this case, Service Bus.
On the other side of the firewall, you can use existing SDKs for your chosen queuing system
to simply read the Connect notifications available.
As you can see, there are no firewall changes needed here, and hence, this is a good practice.
In this video, I'll walk you through how you can set up the listener using Microsoft Azure.
The first thing that you want to do is to navigate to our Git repository
and clone this repo. I'm going to have a link in the description below.
You then want to navigate to the Serverless framework's website
and go ahead and download the open-source version of Serverless.
There are really good instructions on the website on how we can install it based on your platform,
so please follow the instruction for your platform to install the Serverless framework.
Next, you want to navigate to where you cloned the repository and install all the dependencies. This
process is going to take a little while, as we're going to need the Azure Functions Core Tools,
and that package takes a little while to install.
Next off, you're going to want to define some of your environmental variables.
The first thing we want to define is the subscription ID of your Azure subscription.
And you also will need to define where you want this Serverless function to be deployed.
In this case, we're going to specify East US, but it could be any location in your subscription.
And then we want to define the authentication name that we obtained from our Connect
configuration. Then we're going to also define the authentication password that we also obtained from
our Connect configuration. And last but not least, we're going to define our HMAC.
After you've defined the environmental variables, now you're able to deploy the
Serverless function. Simply type sls deploy, and the Serverless framework will automatically start
the deployment process. Please be patient, as this process is going to take a few minutes. The thing
to keep in mind is that the Serverless is now creating the ARM templates that are necessary for
its deployment, and it is going to go ahead and deploy those ARM templates for you automatically.
At this stage, Serverless is going to zip all the source files and is going to upload them
inside of Blob storage, and then you will use the Blob storage to set up your Azure function.
When your deployment succeeds, you're going to be able to see the endpoint for our listener,
highlighted here. Let's go to the Azure Portal and check out the resources that were created for us.
Perfect. As you can see, the Serverless has created the Blob storage for us,
as well as a consumption plan, an Azure function, and also something called Application Insights.
The Application Insights allows you to get logging from an Azure function directly.
As you can see, the only thing missing here is our Service Bus, which is going to be used
to store the Connect notifications. So let's go ahead and create that now.
Navigate back to your terminal and log in to your Azure CLI by typing az login.
Then go ahead and run the posted sh script. This script is going to ask you a few questions,
namely your resource group name. You can obtain this variable from your Azure Portal.
It will also ask you for your function app name. You can also obtain that from your Azure Portal.
Now the script is going to do two things for you. First of all, is it going to create the Service
Bus. And secondly, it is going to create the environment variable inside your Azure function
that has the connection string through the Service Bus. This is to make sure that the Azure function
can queue the notification on your Service Bus.
When the script succeeds, you are going to see the information about the Service Bus
on the screen, which I have to blur because it's sensitive information.
The very last step is to navigate to your Connect configuration
and put in the URL that you just obtained from deploying the Serverless function.
Lastly, after sending an event to the Azure function, now we can see that the HMAC is
verified and the Connect notification is successfully queued onto the Service Bus.
And that's it. Thank you so much for joining us today. In the next episode,
I'm going to show you how you can deploy a Connect listener on Google Cloud Platform.