0

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 listener I have available is with Microsoft Teams. I have created the webhook listener in Teams and can send information to it 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 Teams.

Next I have tried to send information from an existing Docusign envelope to Teams 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 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.

Could this work or am I wasting my time trying to send the information to Microsoft Teams? Are there any Teams log files that could tell me if the information has at least been received?

(P.S. As a possible alternative I have tried setting up Workflows in Teams but get an error saying it cannot be setup.)

5
  • Is that your actual access-token string? You probably should remove it right-now and contact the mods to have it removed from the edit history too. Commented Sep 25 at 10:39
  • No, that is NOT my actual access-token string, thanks for mentioning. Commented Sep 25 at 10:41
  • What documentation or instructions did you follow to set-up the webhook within your Teams tenant account? I'm seeing a variety of possible approaches with a load of deprecation/obsolete warnings, so it's possible you inadvertently followed outdated instructions. Commented Sep 25 at 10:43
  • I followed the instructions under the heading Create an Incoming Webhook on the website you mention in your comment. I used the New Teams tab part. As mentioned in my question it seems to work because I see the curl commands I send appear as Teams notifications. Commented Sep 25 at 10:49
  • I suggest you contact both DocuSign and MS' Teams support because it sounds like something breaking-down between DocuSign and Teams, and not something you likely have control over. (Irrelevant full-disclosure: I'm not a fan of DocuSign) Commented Sep 25 at 11:17

2 Answers 2

0

This is definitely feasible, but we would need to look at your webhook listener code.

From the Docusign part, please refer to this documentation on how to use and setup Connect notifications.

https://developers.docusign.com/platform/webhooks/

Thank you.

Sign up to request clarification or add additional context in comments.

5 Comments

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
Thanks for the info. The setup of the Connect notifications is given in my question which uses the Docusign Rest API. As for the webhook listener code, I have no access to these as the listeners were created by following instructions from sites learn.microsoft.com/en-us/microsoftteams/platform/… and developers.mattermost.com/integrate/webhooks/incoming which just generated URLs to post to.
I know the listeners work because, as mentioned in my question, I can use the curl command to send messages to them with no problems. To me the problem is coming from Docusign. But, once again, my code is producing a 201 response so I cannot diagnose the problem.
It would be really useful to know what exactly Docusign is sending to the listener. If I knew this I could diagnose the problem. My guess is that it is NOT sending the information in the form that the listener requires i.e. '{"text":"Info to be sent"}'
For info the 201 status code returned by Docusign is returned even if the URL of the webhook does not exist! So it seems that my code is not even attempting to send any information to the webhook!
0

OK, after examining the Docusign Connect logs on my Docusign account I have concluded that, at the time of writing, Webhook listeners from Teams cannot be used with Docusign Connect.

The Teams webhook listener always response with error code 400.

This makes sense as the documentation for the listener requires data to be sent in the format:

'{"text":"Info to be sent"}'

and this is not the format sent by Docusign Connect.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.