Hi
My Shopify app extends Flow with more triggers and actions and currently processes hundreds of thousands of webhooks, triggers and actions each day — new installs from large stores have sometimes doubled or tripled our traffic overnight, which is really exciting to see, but the lack of insights into Flow is starting to feel limiting.
To continue improving my app it’d be really useful to have some insights into Flow workflows and runs as currently the API is a bit of a black box with a single mutation for triggering workflows. For my purposes the insights could be limited to workflows and runs that include triggers or actions from my app — not all workflows and runs.
Below are some features I think would help, I appreciate some of these things can already be inferred to an extent and that my examples aren’t entirely cohesive but I think you’ll get the gist.
GraphQL objects and queries
For starters, some sort of object to represent a Flow workflow and run, preferably with the ability to query them using the GraphQL Admin API.
type Task {
handle: String!
}
enum TaskType {
TRIGGER
ACTION
CONDITION
}
type Step {
id: ID!
task: Task!
taskType: TaskType!
}
type Workflow {
id: ID!
active: Boolean!
steps: [Step!]!
}
type WorkflowRun {
id: ID!
status: WorkflowRunStatus!
workflow: Workflow!
}
Related queries are below, these can be limited to workflows that contain triggers and actions from my app.
query {
workflows(first: 50) { ... }
workflow(id: "gid://shopify/Workflow/123") { ... }
workflowRuns(workflowId: "gid://shopify/Workflow/123", first: 50) { ... }
workflowRun(id: "gid://shopify/WorkflowRun/123") { ... }
}
Insights for flowTriggerReceive
Simply knowing if any workflows were triggered would be a massive improvement, and returning both the workflow
and the workflowRun
would be awesome too.
flowTriggerReceive(handle: $handle, payload: $payload) {
workflow {
id
steps
}
workflowRun {
id
}
userErrors {
field
message
}
}
Lifecycle webhooks for workflows and runs
If a store saves or deletes a workflow using my apps triggers or actions it’d be great to know about it, for example
flow_workflow/create
flow_workflow/update
flow_workflow/delete
flow_workflow/run_start # maybe too noisy
flow_workflow/run_complete # maybe too noisy
# maybe even more exotic webhooks like
flow_workflow/action_added
Run completion
It’s already covered by the webhooks but I want to reiterate how useful it would be to know when a run completes, especially when a run fails in a step that isn’t controlled by my app.
Deferrable actions
Currently actions must return immediately, there’s no API for actions to defer a runs execution to a later date. The built-in Wait action can do this but it’s limited to relative time value and doesn’t support variables, preferably we could use the same API to defer with our actions as well.
For some context, my app provides support for natural language timing (along with it’s own less-than-ideal solution deferring runs), so stores can say next monday at 9am
or 3 days before {{resource.date}}
.
Simply adding support for variables in the Wait action would be a great improvement, although with the 90 day maximum it won’t be robust.
That’s all for now, I know these suggestions would involve a lot of time and work to implement but I’m still interested to hear everyones thoughts and if there are any plans related to these features in the pipeline.
Thanks for reading!