Cross-Provider Workflow

SendGrid Validate then Send Email

Version 1.0.0

Validate a recipient email, then send the message only if it is valid.

1 workflow 2 source APIs 1 provider
View Spec View on GitHub ArazzoWorkflowsCross-Provider

Providers Orchestrated

sendgrid

Workflows

validate-then-send
Validate a recipient email, then send the message if valid.
Validates a recipient email address with SendGrid and, on a valid verdict, sends the message to that address through SendGrid Mail Send.
2 steps inputs: messageBody, recipientEmail, subject outputs: emailStatus, verdict
1
validate-email
$sourceDescriptions.sendgridValidationApi.ValidateEmail
Validate the recipient email address with SendGrid.
2
send-email
$sourceDescriptions.sendgridMailApi.SendMail
Send the message to the validated recipient via SendGrid.

Source API Descriptions

Arazzo Workflow Specification

msg-sendgrid-validate-then-send-email.yml Raw ↑
arazzo: 1.0.1
info:
  title: SendGrid Validate then Send Email
  summary: Validate a recipient email, then send the message only if it is valid.
  description: >-
    A workflow that first validates a recipient address through SendGrid's Email
    Address Validation API and then, on a valid verdict, sends the message to
    that address through SendGrid's Mail Send API. Demonstrates gating an email
    send behind a deliverability check across two SendGrid APIs in a single
    Arazzo workflow.
  version: 1.0.0
sourceDescriptions:
  - name: sendgridValidationApi
    url: https://raw.githubusercontent.com/api-evangelist/sendgrid/refs/heads/main/openapi/tsg_email_validation_v3.yaml
    type: openapi
  - name: sendgridMailApi
    url: https://raw.githubusercontent.com/api-evangelist/sendgrid/refs/heads/main/openapi/tsg_mail_v3.yaml
    type: openapi
workflows:
  - workflowId: validate-then-send
    summary: Validate a recipient email, then send the message if valid.
    description: >-
      Validates a recipient email address with SendGrid and, on a valid verdict,
      sends the message to that address through SendGrid Mail Send.
    inputs:
      type: object
      properties:
        recipientEmail:
          type: string
        subject:
          type: string
        messageBody:
          type: string
    steps:
      - stepId: validate-email
        description: Validate the recipient email address with SendGrid.
        operationId: $sourceDescriptions.sendgridValidationApi.ValidateEmail
        requestBody:
          contentType: application/json
          payload:
            email: $inputs.recipientEmail
            source: workflow
        successCriteria:
          - condition: $statusCode == 200
          - condition: $response.body#/result/verdict == "Valid"
        outputs:
          verdict: $response.body#/result/verdict
          score: $response.body#/result/score
      - stepId: send-email
        description: Send the message to the validated recipient via SendGrid.
        operationId: $sourceDescriptions.sendgridMailApi.SendMail
        requestBody:
          contentType: application/json
          payload:
            personalizations:
              - to:
                  - email: $inputs.recipientEmail
                subject: $inputs.subject
            from:
              email: [email protected]
            content:
              - type: text/plain
                value: $inputs.messageBody
        successCriteria:
          - condition: $statusCode == 202
        outputs:
          emailStatus: $statusCode
    outputs:
      verdict: $steps.validate-email.outputs.verdict
      emailStatus: $steps.send-email.outputs.emailStatus