I am new to DocuSign and trying to use embedded signing with a local document and not a template. I am using PHP and a Sandbox developer account. I am able to successfully negotiate part one (Login API) and part two (Create and Send Envelope) but part three (Request Signing URL) fails with a UNKNOWN_ENVELOPE_RECIPIENT errorCode.
The code I am using looks like this (sensitive info redacted):
$integratorKey = "XXX-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
$accountEmail = "[email protected]";
$accountPassword = "xxxxxxxxxxx";
$recipientName = "Recipient Name";
$recipientEmail = "[email protected]";
$documentName = "DocumentName.pdf";
$clientUserId = "1234";
// Construct the authentication header:
$header = "<DocuSignCredentials><Username>" . $accountEmail . "</Username><Password>" . $accountPassword . "</Password><IntegratorKey>" . $integratorKey . "</IntegratorKey></DocuSignCredentials>";
// Skipping code for parts one and two as they work fine.
// By this point I have the value of EnvelopId in $envelopeId
// STEP 3 - Get the Embedded Singing View
$data = array(
"returnUrl" => "http://unform.com/",
"authenticationMethod" => "None",
"email" => $accountEmail,
"userName" => $recipientName,
"clientUserId" => $clientUserId
);
$data_string = json_encode($data);
$curl = curl_init($baseUrl . "/envelopes/$envelopeId/views/recipient" );
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string),
"X-DocuSign-Authentication: $header" )
);
$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
After these calls the $status = 400 And the full $json_response I get is:
{ "errorCode": "UNKNOWN_ENVELOPE_RECIPIENT", "message": "The recipient you have identified is not a valid recipient of the specified envelope." }
I do have clientUserId defined and the $recipientName is the same that is used in step 2 in the signers array, however the field names are different, i.e. "name" => "$recipientName" in step two's signers array and "userName" => $recipientName in step 3.
For the sake of completeness here is the data array used in step two:
$data = array(
"accountId" => $accountId,
"emailSubject" => "DocuSign API Sample - Please Sign This Document!",
"documents" => array(
array(
"documentId" => "1",
"name" => "$documentName"
),
),
"recipients" => array(
"signers" => array(
array(
"email" => "$accountEmail",
"name" => "$recipientName",
"recipientId" => "1",
"tabs" => array(
"signHereTabs" => array(
array(
"xPosition" => "100",
"yPosition" => "150",
"documentId" => "1",
"pageNumber" => "1"
)
)
),
"routingOrder" => "1",
"recipientId" => "1",
"clientUserId" => $clientUserId,
"name" => "Daryl Williams",
"email" => "[email protected]"
),
),
),
"status" => "sent"
);
Any help would be much appreciated. If I can provide any further details please let me know.
Thanks,
Daryl