John Davidson

docusignapi - Bulk sending to multiple recipients docusign php

0 comments
Message:


Good morning, I'm trying to send a document to multiple recipients, but it's only sending to one, and it doesn't generate any error!


$signers = [];
# Create the signer recipient model
$signer1 = new \DocuSign\eSign\Model\Signer([
'email' => $this->email_signatario, 'name' => $this->nome_signatario,
'recipient_id' => "1", 'routing_order' => "5"]);

array_push( $signers, $signer1 );

$routing_order_count = 6;

foreach ( $this->emails_adicionais as $endereco_adicional ) {
$signer = new \DocuSign\eSign\Model\Signer([
'email' => $endereco_adicional, 'name' => $this->nome_signatario . "_$routing_order_count",
'recipient_id' => $routing_order_count, 'routing_order' => $routing_order_count]);

array_push( $signers, $signer );
$routing_order_count++;
}$sign_here1 = new \DocuSign\eSign\Model\SignHere([
'anchor_string' => '*signature_1*', 'anchor_units' => 'pixels',
'anchor_y_offset' => '10', 'anchor_x_offset' => '20']);
$sign_here2 = new \DocuSign\eSign\Model\SignHere([
'anchor_string' => '/sn1/', 'anchor_units' => 'pixels',
'anchor_y_offset' => '10', 'anchor_x_offset' => '20']);

# Add the tabs model (including the sign_here tabs) to the signer
# The Tabs object wants arrays of the different field/tab types
foreach ( $signers as $signer ) {
$signer->setTabs( new \DocuSign\eSign\Model\Tabs([
'sign_here_tabs' => [$sign_here1, $sign_here2]]));
}



# Add the recipients to the envelope object
$recipients = new \DocuSign\eSign\Model\Recipients([
'signers' => $signers, 'recipient_count' => count( $signers ), 'carbon_copies' => [$cc1,$cc2,$cc3,$cc4]]);
$envelope_definition->setRecipients($recipients);

This is the code I use to add signers and copies.


If anyone has an example of multiple submissions, please send them, thank you!



My Answer:
foreach ($recipients as $recipient) {
$signer = new \DocuSign\eSign\Model\Signer([
'email' => $recipient['email'],
'name' => $recipient['name'],
'recipientId' => $recipient['recipientId'],
'routingOrder' => $recipient['routingOrder']
]);
$signers[] = $signer;
}

$envelopeDefinition = new \DocuSign\eSign\Model\EnvelopeDefinition([
'emailSubject' => 'Please sign this document',
'status' => 'sent',
'documents' => $documents,
'recipients' => new \DocuSign\eSign\Model\Recipients(['signers' => $signers])
]);

$envelopeApi = new \DocuSign\eSign\Api\EnvelopesApi($apiClient);
$results = $envelopeApi->createEnvelope($accountId, $envelopeDefinition);

This code snippet should help you send a document to multiple recipients using the DocuSign API in PHP. Make sure to populate the $recipients array with the necessary recipient information before running this code. Let me know if you need any further assistance!

Rate this post

5 of 5 based on 4958 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us