@@ -18,12 +18,18 @@ def get_args():
1818 # Strip anything other than characters listed
1919 signer_email = pattern .sub ("" , request .form .get ("signer_email" ))
2020 signer_name = pattern .sub ("" , request .form .get ("signer_name" ))
21+ cc_email = pattern .sub ("" , request .form .get ("cc_email" ))
22+ cc_name = pattern .sub ("" , request .form .get ("cc_name" ))
23+ cc_phone_number = request .form .get ("cc_phone_number" )
2124 phone_number = request .form .get ("phone_number" )
2225 envelope_args = {
2326 "signer_email" : signer_email ,
2427 "signer_name" : signer_name ,
2528 "status" : "sent" ,
26- "phone_number" : phone_number
29+ "cc_email" : cc_email ,
30+ "cc_name" : cc_name ,
31+ "phone_number" : phone_number ,
32+ "cc_phone_number" : cc_phone_number
2733 }
2834 args = {
2935 "account_id" : session ["ds_account_id" ],
@@ -74,12 +80,12 @@ def make_envelope(cls, args):
7480 # The envelope will be sent first to the signer.
7581 # After it is signed, a copy is sent to the cc person.
7682
77- # create the envelope definition
83+ # Create the envelope definition
7884 env = EnvelopeDefinition (
7985 email_subject = "Please sign this document set"
8086 )
8187 doc1_b64 = base64 .b64encode (bytes (cls .create_document1 (args ), "utf-8" )).decode ("ascii" )
82- # read files 2 and 3 from a local directory
88+ # Read files 2 and 3 from a local directory
8389 # The reads could raise an exception if the file is not available!
8490 with open (path .join (demo_docs_path , DS_CONFIG ["doc_docx" ]), "rb" ) as file :
8591 doc2_docx_bytes = file .read ()
@@ -89,23 +95,23 @@ def make_envelope(cls, args):
8995 doc3_b64 = base64 .b64encode (doc3_pdf_bytes ).decode ("ascii" )
9096
9197 # Create the document models
92- document1 = Document ( # create the DocuSign document object
98+ document1 = Document ( # Create the DocuSign document object
9399 document_base64 = doc1_b64 ,
94- name = "Order acknowledgement" , # can be different from actual file name
95- file_extension = "html" , # many different document types are accepted
96- document_id = "1" # a label used to reference the doc
100+ name = "Order acknowledgement" , # Can be different from actual file name
101+ file_extension = "html" , # Many different document types are accepted
102+ document_id = "1" # A label used to reference the doc
97103 )
98- document2 = Document ( # create the DocuSign document object
104+ document2 = Document ( # Create the DocuSign document object
99105 document_base64 = doc2_b64 ,
100- name = "Battle Plan" , # can be different from actual file name
101- file_extension = "docx" , # many different document types are accepted
102- document_id = "2" # a label used to reference the doc
106+ name = "Battle Plan" , # Can be different from actual file name
107+ file_extension = "docx" , # Many different document types are accepted
108+ document_id = "2" # A label used to reference the doc
103109 )
104- document3 = Document ( # create the DocuSign document object
110+ document3 = Document ( # Create the DocuSign document object
105111 document_base64 = doc3_b64 ,
106- name = "Lorem Ipsum" , # can be different from actual file name
107- file_extension = "pdf" , # many different document types are accepted
108- document_id = "3" # a label used to reference the doc
112+ name = "Lorem Ipsum" , # Can be different from actual file name
113+ file_extension = "pdf" , # Many different document types are accepted
114+ document_id = "3" # A label used to reference the doc
109115 )
110116 # The order in the docs array determines the order in the envelope
111117 env .documents = [document1 , document2 , document3 ]
@@ -128,14 +134,35 @@ def make_envelope(cls, args):
128134 routing_order = "1" ,
129135 additional_notifications = [sms_notification ]
130136 )
137+
138+ # Create a RecipientPhoneNumber and add it to the additional SMS notfication
139+ ccPhoneNumber = RecipientPhoneNumber (
140+ country_code = "1" ,
141+ number = args ["cc_phone_number" ]
142+ )
143+
144+ cc_sms_notification = RecipientAdditionalNotification (
145+ phone_number = ccPhoneNumber
146+ )
147+ cc_sms_notification .secondary_delivery_method = "SMS"
148+
149+ # Create a cc recipient to receive a copy of the documents
150+ cc1 = CarbonCopy (
151+ email = args ["cc_email" ],
152+ name = args ["cc_name" ],
153+ recipient_id = "2" ,
154+ routing_order = "2" ,
155+ additional_notifications = [cc_sms_notification ]
156+ )
157+
131158 # routingOrder (lower means earlier) determines the order of deliveries
132159 # to the recipients. Parallel routing order is supported by using the
133160 # same integer as the order for two or more recipients.
134161
135- #signer1.additional_notifications = [sms_notification]
162+ # signer1.additional_notifications = [sms_notification]
136163
137164 # Create signHere fields (also known as tabs) on the documents,
138- # We" re using anchor (autoPlace) positioning
165+ # We' re using anchor (autoPlace) positioning
139166 #
140167 # The DocuSign platform searches throughout your envelope"s
141168 # documents for matching anchor strings. So the
@@ -160,10 +187,10 @@ def make_envelope(cls, args):
160187 signer1 .tabs = Tabs (sign_here_tabs = [sign_here1 , sign_here2 ])
161188
162189 # Add the recipients to the envelope object
163- recipients = Recipients (signers = [signer1 ])
190+ recipients = Recipients (signers = [signer1 ], carbon_copies = [ cc1 ] )
164191 env .recipients = recipients
165192
166- # Request that the envelope be sent by setting | status| to "sent".
193+ # Request that the envelope be sent by setting status to "sent".
167194 # To request that the envelope be created as a draft, set to "created"
168195 env .status = args ["status" ]
169196
@@ -187,6 +214,7 @@ def create_document1(cls, args):
187214 color: darkblue;">Order Processing Division</h2>
188215 <h4>Ordered by { args ["signer_name" ]} </h4>
189216 <p style="margin-top:0em; margin-bottom:0em;">Email: { args ["signer_email" ]} </p>
217+ <p style="margin-top:0em; margin-bottom:0em;">Copy to: { args ["cc_name" ]} , { args ["cc_email" ]} </p>
190218 <p style="margin-top:3em;">
191219 Candy bonbon pastry jujubes lollipop wafer biscuit biscuit. Topping brownie sesame snaps sweet roll pie.
192220 Croissant danish biscuit soufflé caramels jujubes jelly. Dragée danish caramels lemon drops dragée.
0 commit comments