DocuSign Custom Connect - How to make a listener i

2019-08-06 13:10发布

问题:

I am new to DocuSign and a novice php programmer looking to setup a DocuSign custom connect with my application.

I am not an expert by any means (taught myself php from reading online), but I can reverse engineer things and figure out how to make things work. So the short of it is that I would like to see an example of a php listener for DocuSign Connect.

The long story is that I signed for DocuSign primarily so that I can integrate it with my CRM (not natively supported in Docusign). I was told that the API was the way to go and I dove in to that. I have been able to setup a DocuSign API page with powerforms, and then use the API to output the results to my satisfaction.

Then the issue was how to trigger that automatically when a contact completed an envelope so that my CRM can take the information in the envelope (textTabs, dateTabs, checkBoxTabs, etc.) and push them into my CRM, along with the document itself.

That is when I came across the Docusign Connect feature. After reading some of the documentation, it seemed like I was approaching my problem all wrong. The API seems to be more for pushing information into Docusign, and perhaps outputting it on a website. Where the Docusign Connect is designed to react to events and automatically perform actions from the listener - which is exactly what I am looking for.

So I am bit puzzled as to why I was pushed to go for the API solution by the sales team and their tech consultant when the Connect seems to be the way to go (at least from my understanding).

I have already contacted them about this, and they are going to get back to me, but it seems everyone is out of town that would normally deal with this. I am a bit anxious, so I am hoping someone here could help out. Thanks for reading this novel.:)

回答1:

Here is a opensource SDK that you can look at to get you started: DocuSign SDK - PHP Connect on GitHub

Does your CRM have an accessible endpoint that you'll be able to recieve the notifications at? Depending on what data you want back, you may still have to use the API. But Connect is the best way to tell you when things have been completed (close to real time), instead of polling the API for status updates constantly.



回答2:

Create a php file in your root directory and tell this php file into the docusign connect URL

// get the docusign connect event
    $postedXml = file_get_contents('php://input');

    $xml = simplexml_load_string($postedXml);

    $filename = "finaname.pdf"
    $path = 'your directory path'. $filename;
    
    // convert byte to base64
    $contents = $xml->DocumentPDFs->DocumentPDF->PDFBytes;
    $base_64 = base64_decode($contents);	
    	
    echo file_put_contents($path, $base_64);
   	chmod("$path", 0777);