arazzo: 1.0.1 info: title: DocuSign Send From Template and Poll summary: Create and send an envelope from an existing template by filling its roles, then poll the envelope to completion. description: >- The fastest way to dispatch a standardized agreement. The workflow creates an envelope directly from a server template by supplying templateRoles that bind real recipients to the roles defined in the template, sends it immediately, and then polls the envelope status, looping while the envelope is still in flight and ending once it reaches a terminal status. Every step spells out its request inline so the flow can be read and executed without opening the underlying OpenAPI description. version: 1.0.0 sourceDescriptions: - name: esignatureApi url: ../openapi/docusign-esignature-openapi.yml type: openapi workflows: - workflowId: send-from-template-and-poll summary: Send an envelope from a template by binding a role, then poll to completion. description: >- Creates a sent envelope from an existing template, mapping one recipient to a named template role, then retrieves the envelope status and re-checks it until signing reaches a terminal state. inputs: type: object required: - accountId - templateId - roleName - signerName - signerEmail properties: accountId: type: string description: The DocuSign account ID (GUID or short account number). templateId: type: string description: The ID of the template to base the envelope on. roleName: type: string description: The role name defined in the template to bind the recipient to. signerName: type: string description: The full legal name of the recipient. signerEmail: type: string description: The email address of the recipient. emailSubject: type: string description: Optional override for the email subject line. default: Please sign this document steps: - stepId: createEnvelopeFromTemplate description: >- Create and send an envelope from the named template, binding the supplied recipient to the template role. operationId: Envelopes_CreateEnvelope parameters: - name: accountId in: path value: $inputs.accountId requestBody: contentType: application/json payload: emailSubject: $inputs.emailSubject status: sent templateId: $inputs.templateId templateRoles: - roleName: $inputs.roleName name: $inputs.signerName email: $inputs.signerEmail successCriteria: - condition: $statusCode == 201 outputs: envelopeId: $response.body#/envelopeId status: $response.body#/status - stepId: pollEnvelopeStatus description: >- Retrieve the envelope status and decide whether to keep polling or stop because signing has reached a terminal state. operationId: Envelopes_GetEnvelope parameters: - name: accountId in: path value: $inputs.accountId - name: envelopeId in: path value: $steps.createEnvelopeFromTemplate.outputs.envelopeId successCriteria: - condition: $statusCode == 200 outputs: status: $response.body#/status completedDateTime: $response.body#/completedDateTime onSuccess: - name: keepPolling type: goto stepId: pollEnvelopeStatus criteria: - context: $response.body condition: $.status == 'sent' || $.status == 'delivered' || $.status == 'created' type: jsonpath - name: finished type: end criteria: - context: $response.body condition: $.status == 'completed' || $.status == 'declined' || $.status == 'voided' type: jsonpath outputs: envelopeId: $steps.createEnvelopeFromTemplate.outputs.envelopeId finalStatus: $steps.pollEnvelopeStatus.outputs.status