Flow frontmatter API
Overview​
Flows are just markdown files, with this comes the use of Content, MDX components and also front-matter.
Here is an example of of a basic flow.
/events/InventoryOutOfStock/index.mdx (example)
---
# id of the flow
id: "CancelSubscriptionFlow"
# Display name of the flow, rendered in EventCatalog
name: "User Cancels Subscription"
# version for your flow
version: "0.0.1"
# Short summary of your event
summary: "Flow for when a user has cancelled a subscription"
# A list of steps for your flow
steps:
# id of your step, required for linking between stages in your flow
- id: "cancel_subscription_initiated"
# rendered title of your step
title: "Cancels Subscription"
# Short summary of a step
summary: "User cancels their subscription"
# Defining an actor will render an actor node in the graph.
actor:
name: "User"
# What happens next? Define the next step
next_step:
id: "cancel_subscription_request"
label: "Initiate subscription cancellation"
- id: "cancel_subscription_request"
title: "Cancel Subscription"
# This step is a message, include the message and version
message:
id: "CancelSubscription"
version: "0.0.1"
next_step:
id: "subscription_service"
label: "Proceed to subscription service"
- id: "stripe_integration"
title: "Stripe"
# This is an external system (e.g Stripe)
externalSystem:
name: "Stripe"
summary: "3rd party payment system"
url: "https://stripe.com/"
next_step:
id: "subscription_service"
label: "Return to subscription service"
- id: "subscription_service"
title: "Subscription Service"
# This node is a service, include that.
service:
id: "SubscriptionService"
version: "0.0.1"
# Define multiple steps
next_steps:
- id: "stripe_integration"
label: "Cancel subscription via Stripe"
- id: "subscription_cancelled"
label: "Successful cancellation"
- id: "subscription_rejected"
label: "Failed cancellation"
- id: "subscription_cancelled"
title: "Subscription has been Cancelled"
message:
id: "UserSubscriptionCancelled"
version: "0.0.1"
next_step:
id: "notification_service"
label: "Email customer"
- id: "subscription_rejected"
title: "Subscription cancellation has been rejected"
- id: "notification_service"
title: "Notifications Service"
service:
id: "NotificationService"
version: "0.0.2"
---
This flow documents what happens when a User Cancels Subscription in our system.
<NodeGraph />
<!-- Add any markdown you want, the workflow will also render in its own page /docs/flows/{Flow}/{version} -->
Required fields​
id​
- Type:
CancelSubscriptionFlow
Unqiue id of the flow. EventCatalog uses this for references and slugs.
Example
---
id: InventoryOutOfStock
---
name​
- Type:
string
Name of the flow this is used to display the name on the UI.
Example
---
name: User Cancels Subscription
---
version​
- Type:
string
Version of the flow.
Example
---
version: 0.0.1
---
steps​
- Type:
Step[]
List of steps for your flow.
Example
---
steps:
- id: "cancel_subscription_initiated"
title: "Cancels Subscription"
summary: "User cancels their subscription"
# Define a single step that happens next
next_step:
id: "cancel_subscription_request"
label: "Initiate subscription cancellation"
# OR define a multiple next steps
next_steps:
- id: "stripe_integration"
label: "Cancel subscription via Stripe"
- id: "subscription_cancelled"
label: "Successful cancellation"
- id: "subscription_rejected"
label: "Failed cancellation"
---