Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b91aed9

Browse filesBrowse files
committed
cc sms notification
1 parent b809536 commit b91aed9
Copy full SHA for b91aed9

File tree

Expand file treeCollapse file tree

2 files changed

+66
-20
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+66
-20
lines changed
Open diff view settings
Collapse file

‎app/eSignature/examples/eg035_sms_delivery/controller.py‎

Copy file name to clipboardExpand all lines: app/eSignature/examples/eg035_sms_delivery/controller.py
+47-19Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
Collapse file

‎app/templates/eg035_sms_delivery.html‎

Copy file name to clipboardExpand all lines: app/templates/eg035_sms_delivery.html
+19-1Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ <h4>35. Send an envelope via SMS delivery.</h4>
1919

2020

2121
<div class="form-group">
22-
<label for="phone_number">Phone Number</label>
22+
<label for="phone_number">Signer Phone Number</label>
2323
<input type="tel" class="form-control" id="phone_number" name="phone_number"
2424
aria-describedby="accessHelp" placeholder="415-555-1212" required
2525
value="415-555-1212">
@@ -37,6 +37,24 @@ <h4>35. Send an envelope via SMS delivery.</h4>
3737
<input type="text" class="form-control" id="signer_name" placeholder="Pat Johnson" name="signer_name"
3838
value="{{ signer_name }}" required>
3939
</div>
40+
<div class="form-group">
41+
<label for="phone_number">CC Phone Number</label>
42+
<input type="tel" class="form-control" id="cc_phone_number" name="cc_phone_number"
43+
aria-describedby="accessHelp" placeholder="415-555-1212" required
44+
value="415-555-1212">
45+
<small id="accessHelp" class="form-text text-muted">This phone number will receive a notification. We'll never share your phone number with anyone else.</small>
46+
</div>
47+
<div class="form-group">
48+
<label for="cc_email">CC Email</label>
49+
<input type="email" class="form-control" id="cc_email" name="cc_email"
50+
aria-describedby="emailHelp" placeholder="pat@example.com" required />
51+
<small id="emailHelp" class="form-text text-muted">The email for the cc recipient must be different from the signer's email.</small>
52+
</div>
53+
<div class="form-group">
54+
<label for="cc_name">CC Name</label>
55+
<input type="text" class="form-control" id="cc_name" placeholder="Pat Johnson" name="cc_name"
56+
required />
57+
</div>
4058
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
4159
<button type="submit" class="btn btn-docu">Submit</button>
4260
</form>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.