pascalallen
pascalallen

Reputation: 336

Need DocuSign envelope to be emailed to multiple recipients for signatures

As stated in the title, I am using the DocuSign REST API in PHP to develop a web app that will take information from a form(POST) to build a DocuSign envelope that will ultimately need to be signed by the recipients whose emails are specified in the form. Except for the user who is using the app currently, this user will be signing it right away.

Building request:

    $data = array (
        'emailSubject' => 'DocuSign REST API Quickstart Sample',
        'emailBlurb' => 'Shows how to create and send an envelope from a document.',
        'recipients' => array (
            'signers' => array (
                0 => array (
                    'email' => $recipientEmail1,
                    'name' => $recipientName1,
                    'clientUserId' => '1234',
                    'recipientId' => '1',
                    'routingOrder' => '1',
                    'tabs' => array (
                        'signHereTabs' => array (
                            0 => array (
                                'xPosition' => '100',
                                'yPosition' => '600',
                                'documentId' => '1',
                                'pageNumber' => '1',
                                'value' => $recipientName1
                            )
                        ), 
                        'dateSignedTabs' => array (
                            0 => array (
                                'xPosition' => '250',
                                'yPosition' => '600',
                                'documentId' => '1',
                                'pageNumber' => '1'
                            )
                        ),
                        "textTabs" => array(
                            0 => array(
                                'xPosition' => '200',
                                'yPosition' => '300',
                                'documentId' => '1',
                                'pageNumber' => '1',
                                "tabLabel"=> "animal",
                                "value" => $animal
                            ),
                            1 => array(
                                'xPosition' => '200',
                                'yPosition' => '400',
                                'documentId' => '1',
                                'pageNumber' => '1',
                                "tabLabel"=> "color",
                                "value" => $color
                            ),
                            2 => array(
                                'xPosition' => '200',
                                'yPosition' => '500',
                                'documentId' => '1',
                                'pageNumber' => '1',
                                "tabLabel"=> "number",
                                "value" => $number
                            )
                        )
                    )   
                ),
                1 => array (
                    'email' => $recipientEmail2,
                    'name' => $recipientName2,
                    'clientUserId' => '2345',
                    'recipientId' => '2',
                    'routingOrder' => '2',
                    'tabs' => array (
                        'signHereTabs' => array (
                            0 => array (
                                'xPosition' => '200',
                                'yPosition' => '600',
                                'documentId' => '1',
                                'pageNumber' => '1',
                                'value' => $recipientName2
                            )
                        ), 
                        'dateSignedTabs' => array (
                            0 => array (
                                'xPosition' => '250',
                                'yPosition' => '600',
                                'documentId' => '1',
                                'pageNumber' => '1'
                            )
                        ),
                        "textTabs" => array(
                            0 => array(
                                'xPosition' => '200',
                                'yPosition' => '300',
                                'documentId' => '1',
                                'pageNumber' => '1',
                                "tabLabel"=> "animal",
                                "value" => $animal
                            ),
                            1 => array(
                                'xPosition' => '200',
                                'yPosition' => '400',
                                'documentId' => '1',
                                'pageNumber' => '1',
                                "tabLabel"=> "color",
                                "value" => $color
                            ),
                            2 => array(
                                'xPosition' => '200',
                                'yPosition' => '500',
                                'documentId' => '1',
                                'pageNumber' => '1',
                                "tabLabel"=> "number",
                                "value" => $number
                            )
                        )
                    )   
                )
            )
        ),'documents' => array (
            0 => array (
                'documentId' => '1',
                'name' => 'test.pdf',
                'documentBase64' => base64_encode(file_get_contents($documentName)),
            )
        ),'status' => 'sent',
    );

Signing view:

    $data = array(
        "returnUrl" => "http://www.docusign.com/devcenter",
        "authenticationMethod" => "None",
        "userName" => $recipientName1,
        'clientUserId' => '1234',
        "email" => $recipientEmail1
    ); 

Upvotes: 0

Views: 521

Answers (2)

Ergin
Ergin

Reputation: 9356

So you have multiple recipients to sign an envelope, and you want the first recipient to sign immediately using Embedded Signing in your website or app, then the rest will be remote recipients who initiate signing through email yeah?

If so, you just need to set the clientUserId to a non-null value for the first recipient (like you are now), then don't set or even include the property for subsequent recipients who will sign through email.

Setting the clientUserId property tells the DocuSign platform the recipient will sign through embedded signing and do not send them an email. Once the recipient has been added to the envelope and the envelope has been sent, you then need to make a unique API call per recipient who will sign in embedded fashion, but since it's only one in your case you just need to make one additional API call (to generate the recipient view).

So your API call flow should be basically be:

  1. Create and send envelope with first recipient embedded, remaining remote.
  2. Generate the Embedded Signing (recipient view) for the first recipient and load through a re-direct, webview, or dreaded iFrame.
  3. DONE

If you have configured the routingOrder for subsequent recipients, which I do see in your code, then the platform will take care of the remaining recipients (i.e. will generate signing links and email them the notifications when it's their turn in the routing order.)

For more info: DocuSign Developer Center

Upvotes: 0

Luis
Luis

Reputation: 2702

If you are specifying a clientUserID for a recipient then you will be creating an envelope using embedded signing. If you want DocuSign to generate an email to your recipients in order to notify them to start the signing experience, you should explore remote signing. If you remove the clientUserID parameter from each signer you will get a remote signing experience.

Upvotes: 1

Related Questions