使用PHP客户端进行Docusign批量发送

时间:2019-05-07 05:58:13

标签: php docusignapi

我已经使用docusign php客户端实现了批量发送。我收到以下错误消息

  

{“ errorCode”:“ UNSPECIFIED_ERROR”,“ message”:“值不能为   空值。参数名称:stream“}

当我运行以下源代码时。

$templateId = 'd756f973-...';
$apiClient  = $this->getDocuSignClient();

// Get Template
$templatesApi = new TemplatesApi($apiClient);
$templateDetails = $templatesApi->get($this->getAccountId(), $templateId);

// Set documents
...

// Receipient
$signer = new Signer();
$signer->setIsBulkRecipient('true');
$signer->setRecipientId('1');

$recipients = new Recipients();
$recipients->setSigners([$signer]);

// Create draft template

$envelopDefinition = new EnvelopeDefinition();
$envelopDefinition->setStatus('created');
$envelopDefinition->setDocuments($documents);
$envelopDefinition->setRecipients($recipients);
$envelopDefinition->setEmailSubject('Sign bulk send');

$envelopeApi = new EnvelopesApi($apiClient);
$envelopSummary = $envelopeApi->createEnvelope($this->getAccountId(), $envelopDefinition);

// Update bulk recipients

$clients = Client::all();
$bulkRecipients = [];

foreach ($clients as $client) {
    $bulkRecipient = new BulkRecipient();
    $bulkRecipient->setEmail($client->email);
    $bulkRecipient->setName($client->first_name);

    $bulkRecipients[] = $bulkRecipient;
}

$bulkRequest = new BulkRecipientsRequest();
$bulkRequest->setBulkRecipients($bulkRecipients);

$bulkEnvelopesApi = new BulkEnvelopesApi($apiClient);
$bulkEnvelopesApi->updateRecipients($this->getAccountId(), $envelopSummary['envelope_id'], '1', $bulkRequest);
// ---------- the error message throws on above line ----------

任何帮助表示赞赏。预先感谢

1 个答案:

答案 0 :(得分:0)

能否请您尝试更新到PHP客户端的版本4(https://github.com/docusign/docusign-php-client/releases/tag/v4.0.0)。这支持我们的新v2.1 API,该API改进了批量发送支持https://developers.docusign.com/esign-rest-api/reference/BulkEnvelopes/BulkEnvelopes/