I'm attempting to create a Docusign envelope from a template using the PHP sdk e-sign client:
$apiClient = new ApiClient($config);
// Create an Envelope from a template
$templateId = env('TEMPLATE_ID');
$accountId = env('API_ACCOUNT_ID');
$envelopeApi = new EnvelopesApi($apiClient);
$templateRole = new TemplateRole((
'email' => 'john@example.com', // recipient's email
'name' => 'John Doe', // recipient's name
'roleName' => 'User', // The role name as defined in the template
]);
$envelopeDefinition = new EnvelopeDefinition((
'status' => 'sent',
'templateId' => $templateId,
'templateRoles' => $templateRole]
]);
$envelopeSummary = $envelopeApi->createEnvelope($accountId, $envelopeDefinition);
Produces: Error while requesting server, received a non successful HTTP code 400] with response: RECIPIENTS_NOT_PROVIDED - No recipients were found in the request
From the logs I can see this uses the endpoint POST /restapi/v2.1/accounts/{accountId}/envelopes
and seems to contain all necessary parameters according to the docs. The parameters also seem to be consistent with those expected in other languages/sdks.
I'm expecting $envelopeSummary (on a successful call) to include the envelopeId, status, statusDateTime, and uri which I'll then use to create the embedded signing ceremony.
I've verified that the roleName is set to 'User' on the template.
Here’s what I have for recipients: i.imgur.com/lCOEiNG.png
Here’s what I get from the API (from the get templates request) for the template: https://i.imgur.com/qseg6cq.png