@@ -712,6 +712,15 @@ public class Script : ScriptBase
712712 var uriLogicAppsBase64 = Convert . ToBase64String ( Encoding . UTF8 . GetBytes ( uriLogicApps ?? string . Empty ) ) ;
713713 var notificationProxyUri = this . Context . CreateNotificationUri ( $ "/webhook_response?logicAppsUri={ uriLogicAppsBase64 } ") ;
714714
715+ // TODO: This map is added for backward compatibility. This will be removed once old events are deprecated
716+ var envelopeEventMap = new Dictionary < string , string > ( ) {
717+ { "Sent" , "envelope-sent" } ,
718+ { "Delivered" , "envelope-delivered" } ,
719+ { "Completed" , "envelope-completed" } ,
720+ { "Declined" , "envelope-declined" } ,
721+ { "Voided" , "envelope-voided" }
722+ } ;
723+
715724 body [ "allUsers" ] = "true" ;
716725 body [ "allowEnvelopePublish" ] = "true" ;
717726 body [ "includeDocumentFields" ] = "true" ;
@@ -720,9 +729,11 @@ public class Script : ScriptBase
720729 body [ "name" ] = original [ "name" ] ? . ToString ( ) ;
721730
722731 var envelopeEvent = original [ "envelopeEvents" ] ? . ToString ( ) ;
723- var envelopeEventsArray = new JArray ( ) ;
724- envelopeEventsArray . Add ( envelopeEvent ) ;
725- body [ "envelopeEvents" ] = envelopeEventsArray ;
732+ var webhookEvent = envelopeEventMap . ContainsKey ( envelopeEvent ) ? envelopeEventMap [ envelopeEvent ] : envelopeEvent ;
733+
734+ var webhookEventsArray = new JArray ( ) ;
735+ webhookEventsArray . Add ( webhookEvent ) ;
736+ body [ "events" ] = webhookEventsArray ;
726737 body [ "configurationType" ] = "custom" ;
727738 body [ "deliveryMode" ] = "sim" ;
728739
@@ -743,7 +754,6 @@ public class Script : ScriptBase
743754 var uriBuilder = new UriBuilder ( this . Context . Request . RequestUri ) ;
744755 uriBuilder . Path = uriBuilder . Path . Replace ( "connectV2" , "connect" ) ;
745756 this . Context . Request . RequestUri = uriBuilder . Uri ;
746-
747757 return body ;
748758 }
749759
0 commit comments