Skip to main content

After working for some time with Docusign's API I thought it would be a good idea to look into the API's 'Connect' feature (https://developers.docusign.com/docs/esign-rest-api/reference/connect/).

This allows the sending of information to an application via webhooks when an event occurs for the envelope in question.

Currently the only webhook listeners I have available are with Microsoft Teams and Mattermost. I have created the webhook listener in both and can send information to them using the following command:

 curl -H 'Content-Type:application/json' -d '{"text":"Test text 1"}' <endpoint>

where `<endpoint>` is the URL of the webhook listener in either Teams or Mattermost.

Next I have tried to send information from an existing Docusign envelope to Teams/Mattermost using the following perl code:

 

use strict;
use warnings;
use LWP::UserAgent
use HTTP::Request::Common;
use JSON;
my $EnvelopeID='"92f294ba-a5a0-4a4d-ac85-f08ad5b6a09a"';
my $webhookURL=q{https://site.webhook.office.com/webhookb2/4052-83a-4e7-8a9-ed1};
my $account_ID="1234";
my $access_token="9IORKG390U89H9GH38389GH3GJ30G3J3G309J09GJ039GJ3JGG";
my $base_path="base_path_value";

my $dataX=qq/
{
"envelopes": [$EnvelopeID],
"config": {
"configurationType":"custom",
"name": "Test",
"urlToPublishTo":"$webhookURL",
"allowEnvelopePublish": "true",
"enableLog": "true",
"requiresAcknowledgement": "true",
"deliveryMode": "SIM",
"events":[
"envelope-sent",
"envelope-resent",
"envelope-delivered",
"envelope-completed",
"envelope-declined",
"envelope-voided",
"recipient-authenticationfailed",
"recipient-autoresponded",
"recipient-declined",
"recipient-delivered",
"recipient-completed",
"recipient-sent",
"recipient-resent",
"envelope-corrected",
"envelope-purge",
"envelope-deleted",
"recipient-reassign",
"recipient-finish-later",
"recipient-delegate"
],
"eventData": {
"version": "restv2.1",
"format": "json",
"includedata": ["recipients"]
}
}
}/;
my $mode = 'POST';
my $site=qq{$base_path/restapi/v2.1/accounts/$account_ID/connect/envelopes/publish/historical};
my $ua = LWP::UserAgent->new;
$ua->timeout($timeout);
#
my $headerVal=HTTP::Headers->new('Authorization' => 'Bearer '.$access_token, 'Accept' => 'application/json');
my $wsrequest = HTTP::Request->new($mode => $site, $headerVal, $dataX) ;
$wsrequest->content_type('application/json') ;
my $res=$ua->request($wsrequest);
print Dumper(decode_json($res->content))."\n" if !$res->is_success;
print "Docusign response : ".$res->status_line."\n";

The code returns result `201 Created`. However, I get no Teams or Mattermost message!

I have checked the logs on my Docusign account using the method outlined at https://support.docusign.com/s/document-item?language=en_US&bundleId=pik1583277475390&topicId=nvf1648497452396.html&_LANG=enus

These logs show that the information was sent by Docusign.

 

Hi,
 

Thanks for reaching out to Docusign Support.

When the Require Acknowledgment option is enabled for a Connect configuration, Connect waits for an acknowledgment from your listener after sending a message. This acknowledgment is an HTTP 200 - OK status code. The Connect Logs tab in the admin account Connect section lists the sent notifications and, in case of failures, the listeners response message.

Docusign does not assist on listeners configuration, but please note that the URL to Publish must use the HTTPS protocol and SSL/TLS connections. The SSL/TLS certificate for your web server must chain to a certificate authority on Microsoft's trust list. Self-signed certificates do not work. You may use free certificates from Let’s Encrypt.

Connect uses port 443 for HTTPS by default. You can specify port 1443, 2443, 3443, 4443, 5443, 6443, 7443, 8443, or 9443 in the URL instead.

Please do not share account information here in the Community, as this is an open channel.

Best regards,