Cross-Provider Workflow

Stripe Meter Summary to SendGrid Report

Version 1.0.0

Read a Stripe billing meter event summary and email the usage report via SendGrid.

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

Providers Orchestrated

stripe sendgrid

Workflows

meter-summary-to-email
Read a Stripe meter event summary, then email a usage report.
Reads a customer's Stripe billing meter event summaries and emails the usage report to the customer via SendGrid.
2 steps inputs: customer, customerEmail, endTime, fromEmail, meterId, startTime outputs: emailStatus, summaries
1
get-meter-summary
$sourceDescriptions.stripeBillingMetersApi.GetBillingMetersIdEventSummaries
Read the Stripe billing meter event summaries for the customer.
2
email-report
$sourceDescriptions.sendgridApi.SendMail
Email the metered usage report to the customer via SendGrid.

Source API Descriptions

Arazzo Workflow Specification

fin-stripe-meter-summary-to-sendgrid.yml Raw ↑
arazzo: 1.0.1
info:
  title: Stripe Meter Summary to SendGrid Report
  summary: Read a Stripe billing meter event summary and email the usage report via SendGrid.
  description: >-
    A usage-reporting workflow that reads a customer's event summaries from a
    Stripe billing meter and emails the metered usage report to the customer
    through SendGrid. Demonstrates turning Stripe usage-based metering data into
    a customer-facing email report.
  version: 1.0.0
sourceDescriptions:
  - name: stripeBillingMetersApi
    url: https://raw.githubusercontent.com/api-evangelist/stripe/refs/heads/main/openapi/stripe-billing-meters-api-openapi.yml
    type: openapi
  - name: sendgridApi
    url: https://raw.githubusercontent.com/api-evangelist/sendgrid/refs/heads/main/openapi/tsg_mail_v3.yaml
    type: openapi
workflows:
  - workflowId: meter-summary-to-email
    summary: Read a Stripe meter event summary, then email a usage report.
    description: >-
      Reads a customer's Stripe billing meter event summaries and emails the
      usage report to the customer via SendGrid.
    inputs:
      type: object
      properties:
        meterId:
          type: string
        customer:
          type: string
        startTime:
          type: integer
        endTime:
          type: integer
        customerEmail:
          type: string
        fromEmail:
          type: string
    steps:
      - stepId: get-meter-summary
        description: Read the Stripe billing meter event summaries for the customer.
        operationId: $sourceDescriptions.stripeBillingMetersApi.GetBillingMetersIdEventSummaries
        parameters:
          - name: id
            in: path
            value: $inputs.meterId
          - name: customer
            in: query
            value: $inputs.customer
          - name: start_time
            in: query
            value: $inputs.startTime
          - name: end_time
            in: query
            value: $inputs.endTime
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          summaries: $response.body#/data
      - stepId: email-report
        description: Email the metered usage report to the customer via SendGrid.
        operationId: $sourceDescriptions.sendgridApi.SendMail
        requestBody:
          contentType: application/json
          payload:
            personalizations:
              - to:
                  - email: $inputs.customerEmail
                subject: Your metered usage report
            from:
              email: $inputs.fromEmail
            content:
              - type: text/plain
                value: Your metered usage summary for the period is attached below.
        successCriteria:
          - condition: $statusCode == 202
        outputs:
          emailStatus: $statusCode
    outputs:
      summaries: $steps.get-meter-summary.outputs.summaries
      emailStatus: $steps.email-report.outputs.emailStatus