Skip to content

Commit 726781d

Browse files
committed
2 parents 438d373 + 2f10791 commit 726781d

3 files changed

Lines changed: 25 additions & 8 deletions

File tree

app/eSignature/examples/eg031_bulk_send/controller.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,34 +58,42 @@ def worker(cls, args):
5858
"""
5959

6060
# Construct your API headers
61+
# Step 2 start
6162
api_client = create_api_client(base_path=args["base_path"], access_token=args["access_token"])
63+
# Step 2 end
6264

6365
# Submit a bulk list
66+
# Step 3-1 start
6467
bulk_envelopes_api = BulkEnvelopesApi(api_client)
6568
bulk_sending_list = cls.create_bulk_sending_list(args["signers"])
6669
bulk_list = bulk_envelopes_api.create_bulk_send_list(
6770
account_id=args["account_id"],
6871
bulk_sending_list=bulk_sending_list
6972
)
7073
bulk_list_id = bulk_list.list_id
74+
# Step 3-1 end
7175

7276
# Create an envelope
77+
# Step 4-1 start
7378
envelope_api = EnvelopesApi(api_client)
7479
envelope_definition = cls.make_draft_envelope()
7580
envelope = envelope_api.create_envelope(account_id=args["account_id"], envelope_definition=envelope_definition)
7681
envelope_id = envelope.envelope_id
82+
# Step 4-1 end
7783

7884
# Attach your bulk list id to the envelope
85+
# Step 5 start
7986
text_custom_fields = TextCustomField(name="mailingListId", required="false", show="false", value=bulk_list_id)
8087
custom_fields = CustomFields(list_custom_fields=[], text_custom_fields=[text_custom_fields])
8188
envelope_api.create_custom_fields(
8289
account_id=args["account_id"],
8390
envelope_id=envelope_id,
8491
custom_fields=custom_fields
8592
)
93+
# Step 5 end
8694

8795
# Add placeholder tabs
88-
96+
# Step 6 start
8997
recipient_sign_here = SignHere(
9098
anchor_string="/sn1/",
9199
anchor_units="pixels",
@@ -126,21 +134,28 @@ def worker(cls, args):
126134
envelope_id=envelope_id,
127135
recipients=Recipients(signers=[signer, cc])
128136
)
137+
# Step 6 end
129138

130139
# Initiate bulk send
140+
# Step 7 start
131141
bulk_send_request = BulkSendRequest(envelope_or_template_id=envelope_id)
132142
batch = bulk_envelopes_api.create_bulk_send_request(
133143
account_id=args["account_id"],
134144
bulk_send_list_id=bulk_list_id,
135145
bulk_send_request=bulk_send_request
136146
)
137147
batch_id = batch.batch_id
148+
# Step 7 end
138149

139150
# Confirm successful batch send
151+
# Step 8 start
140152
response = bulk_envelopes_api.get_bulk_send_batch_status(account_id=args["account_id"], bulk_send_batch_id=batch_id)
153+
# Step 8 end
154+
print(response)
141155

142156
return response
143157

158+
# Step 3-2 start
144159
@classmethod
145160
def create_bulk_sending_list(cls, args):
146161
"""
@@ -179,7 +194,9 @@ def create_bulk_sending_list(cls, args):
179194
)
180195

181196
return bulk_sending_list
197+
# Step 3-2 end
182198

199+
# Step 4-2 start
183200
@classmethod
184201
def make_draft_envelope(cls):
185202
"""
@@ -245,4 +262,5 @@ def make_draft_envelope(cls):
245262

246263
envelope_definition.recipients = Recipients(signers=[signer], carbon_copies=[cc])
247264

248-
return envelope_definition
265+
return envelope_definition
266+
# Step 4-2 end

app/eSignature/examples/eg031_bulk_send/views.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@ def bulk_send():
2626
try:
2727
# 2. Call the worker method for bulk sending
2828
response = Eg031Controller.worker(args)
29-
batch_id = response.batch_id
29+
queued = response.queued
3030
app.logger.info(f"The envelope has been sent to multiple recipients.")
3131

3232
# 3. Render the response
3333
return render_template("example_done.html",
34-
title="Bulk sending envelopes to multiple recipients",
35-
h1="Bulk sending envelopes to multiple recipients",
36-
message=f"""The envelope has been sent to recipients!<br/>
37-
Batch id: {batch_id}."""
34+
title="Bulk send envelope was successfully performed!",
35+
h1="Bulk send envelope was successfully performed!",
36+
message=f"""Bulk request queued to {queued} user lists.<br/>"""
3837
)
3938

4039
except ApiException as err:

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cffi==1.14.3
44
chardet==3.0.4
55
Click
66
cryptography==3.3.2
7-
docusign-esign==3.10.0rc1
7+
docusign-esign==3.12.0
88
docusign-rooms==1.1.0
99
docusign-monitor==1.0.0
1010
docusign-click==1.0.0

0 commit comments

Comments
 (0)