Using C# and .NET (Framework)
We have a Production system for processing DocuSign Connect notifications which has been running great for over 2 years. We are currently setup to use the XML (Legacy) payload. I've taken the Connect payload schema (linked here) and generated the hierarchy of C# classes that represents the payload.
We have a Listener (webhook) and a Processor to handle the notifications:
- The Listener does some security checks and a minimal parse (for validation) of the payload before queuing the notification for processing.
- The Processor dequeues the notification and deserializes the XML to the DocuSign classes in order to process it.
As we understand it, in May 2023 we will no longer be able to get Connection notifications in XML, but we will have to be able to handle a JSON payload. In looking at some sample JSON payload data (displayed when setting up a Connect configuration), I'm not seeing any structural similarities to the XML format, so I doubt I'd be able to do what I'm currently doing (or similar):
var serializer = new XmlSerializer(typeof(DocuSignEnvelopeInformation));
var buffer = Encoding.UTF8.GetBytes(request.Content.ReadAsStringAsync().Result);
using (var stream = new MemoryStream(buffer))
{
var envelopeInfo = (DocuSignEnvelopeInformation)serializer.Deserialize(stream);
return envelopeInfo;
}
Question -- Is there a similar schema for the JSON payload that I can use to generate C# classes like I did with the XML payload?
I'm trying to get a rough estimate on how much effort this conversion is going to take. Any suggestions are appreciated.
If you need more information, please let me know.
thanks, randy
UPDATE 01/05/2023: I was interested in seeing what JSON DocuSign would send me so I setup a simple Connect Configuration to use JSON, activated it, and then sent in a DocuSign request. I did not have any listener running, so I expected to see connect failures which was OK as I just wanted to see what DocuSign was sending. I completed signing the documents and then looked at the Connect Logs. There were 2 notifications: (1) was a JSON notification for the "recipient-sent" event and (2) was an XML notification for the envelope complete status. This XML notification is of the same type I'm getting currently and already know how to process. I'm surprised it wasn't a JSON equivalent of envelope complete. Would anyone know why I'm getting a mixture of JSON and XML? Correction: I created a simplified Listener which only does some security checks, saves the payload to disk, and always returns success. I am getting a JSON payload for "envelope-completed" event. It looks like the XML version is being sent to a DocuSign "in-house" listener.
UPDATE #2 01/05/2023: I did run across several references to a handy feature of Visual Studio where you can put the JSON into the copy/paste buffer and then in Visual Studio use Edit -> Paste Special -> Paste JSON as Classes. I haven't tried deserializing any live data into these classes as I know these classes aren't complete -- they only reflect the structure that exists in the data you use at the time. I can already see that it only generated a few of the tab classes (Sign Here, Date Signed, Text, and Checkbox) but it doesn't know about all the other possible tabs. And several properties were just defined as "object" since the JSON I used didn't contain values for them. That's why I was hoping for a definitive schema for the JSON DocuSign intends to use for Connect notifications.