SendGrid · Arazzo Workflow

SendGrid Single Send Stats

Version 1.0.0

List Single Sends, branch on whether any exist, and pull aggregate stats for one.

1 workflow 2 source APIs 1 provider
View Spec View on GitHub EmailEmail APIMarketing EmailSMTPT1Transactional EmailArazzoWorkflows

Provider

sendgrid

Workflows

single-send-stats
List Single Sends and pull aggregate stats for one when present.
Lists Single Sends and branches: when any exist, retrieves aggregate stats for the supplied Single Send ID.
2 steps inputs: apiKey, singleSendId outputs: singleSends, stats
1
listSingleSends
ListSingleSend
List the account's Single Sends and branch on whether any were returned.
2
getSingleSendStat
GetSingleSendStat
Retrieve aggregate stats for the supplied Single Send ID.

Source API Descriptions

Arazzo Workflow Specification

sendgrid-singlesend-stats-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: SendGrid Single Send Stats
  summary: List Single Sends, branch on whether any exist, and pull aggregate stats for one.
  description: >-
    A reporting flow over Single Send performance. The workflow lists the
    account's Single Sends, branches on whether any were returned, and when at
    least one exists retrieves the aggregate stats for the supplied Single Send
    ID. Both calls return 200. Each step inlines its request and bearer token so
    the flow can be read and run without consulting the OpenAPI files.
  version: 1.0.0
sourceDescriptions:
- name: singleSendsApi
  url: ../openapi/tsg_mc_singlesends_v3.yaml
  type: openapi
- name: statsApi
  url: ../openapi/tsg_mc_stats_v3.yaml
  type: openapi
workflows:
- workflowId: single-send-stats
  summary: List Single Sends and pull aggregate stats for one when present.
  description: >-
    Lists Single Sends and branches: when any exist, retrieves aggregate stats
    for the supplied Single Send ID.
  inputs:
    type: object
    required:
    - apiKey
    - singleSendId
    properties:
      apiKey:
        type: string
        description: SendGrid API key sent as a bearer token.
      singleSendId:
        type: string
        description: The Single Send ID to pull aggregate stats for.
  steps:
  - stepId: listSingleSends
    description: >-
      List the account's Single Sends and branch on whether any were returned.
    operationId: ListSingleSend
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.apiKey"
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      result: $response.body#/result
    onSuccess:
    - name: hasSingleSends
      type: goto
      stepId: getSingleSendStat
      criteria:
      - context: $response.body
        condition: $.result.length > 0
        type: jsonpath
    - name: noSingleSends
      type: end
      criteria:
      - context: $response.body
        condition: $.result.length == 0
        type: jsonpath
  - stepId: getSingleSendStat
    description: Retrieve aggregate stats for the supplied Single Send ID.
    operationId: GetSingleSendStat
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.apiKey"
    - name: id
      in: path
      value: $inputs.singleSendId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      results: $response.body#/results
  outputs:
    singleSends: $steps.listSingleSends.outputs.result
    stats: $steps.getSingleSendStat.outputs.results