I have a shopify app store app, which allows merchants to create customers inside shopify based on the form submissions received in my app.
I have created a flow trigger extension, that sends all the data to shopify so that store owners can create shopify flows on top of this trigger. But I am facing an issue with the flow trigger payload
My shopify.extension.toml for this flow trigger is as below
[[extensions]]
name = “Customer approved”
handle = “customer-approved”
type = “flow_trigger”
description = “Trigger for customer approved event”
schema = “./schema.graphql”
[settings]
[[settings.fields]]
type = “customer_reference”
[[settings.fields]]
type = “single_line_text_field”
key = “firstName”
[[settings.fields]]
type = “single_line_text_field”
key = “lastName”
[[settings.fields]]
type = “single_line_text_field”
key = “email”
[[settings.fields]]
type = “single_line_text_field”
key = “phone”
[[settings.fields]]
type = “schema.formData”
key = “formData”
In this I am using customer_reference field which is provided by shopify to connect to a particular customer but when I pass the customer_id in the payload, either in the gid format or numeric format it throws error
curl -X POST “https://greydaisy.myshopify.com/admin/api/2025-04/graphql.json”
-H “X-Shopify-Access-Token: {accessToken}”
-H “Content-Type: application/json”
-d ‘{
“query”: “mutation flowTriggerReceive($handle: String, $payload: JSON) { flowTriggerReceive(handle: $handle, payload: $payload) { userErrors { message field } } }”,
“variables”: {
“handle”: “customer-approved”,
“payload”: {
“customer_id”: “gid://shopify/Customer/7409702928495”,
“firstName”: “John”,
“lastName”: “Doe”,
“email”: “john.doe@gmail.com”,
“phone”: “+919999999999”,
“formData”:{“fields”:[{“label”:“First Name”,“value”:“John”}]}
}
}
}’
{“data”:{“flowTriggerReceive”:{“userErrors”:[{“message”:“Errors validating schema:\n Type error for field ‘customer_id’: gid://shopify/Customer/7409702928495 is not a Customer.\n”,“field”:[“body”]}]}},“extensions”:{“cost”:{“requestedQueryCost”:1,“actualQueryCost”:1,“throttleStatus”:{“maximumAvailable”:2000.0,“currentlyAvailable”:1999,“restoreRate”:100.0}}}}%
curl -X POST “https://greydaisy.myshopify.com/admin/api/2025-04/graphql.json”
-H “X-Shopify-Access-Token: {accessToken}”
-H “Content-Type: application/json”
-d ‘{
“query”: “mutation flowTriggerReceive($handle: String, $payload: JSON) { flowTriggerReceive(handle: $handle, payload: $payload) { userErrors { message field } } }”,
“variables”: {
“handle”: “customer-approved”,
“payload”: {
“customer_id”: “7409702928495”,
“firstName”: “John”,
“lastName”: “Doe”,
“email”: “john.doe@gmail.com”,
“phone”: “+919999999999”,
“formData”:{“fields”:[{“label”:“First Name”,“value”:“John”}]}
}
}
}’
{“data”:{“flowTriggerReceive”:{“userErrors”:[{“message”:“Errors validating schema:\n Type error for field ‘customer_id’: 7409702928495 is not a Customer.\n”,“field”:[“body”]}]}},“extensions”:{“cost”:{“requestedQueryCost”:1,“actualQueryCost”:1,“throttleStatus”:{“maximumAvailable”:2000.0,“currentlyAvailable”:1999,“restoreRate”:100.0}}}}%
I am unable to understand what is the right way of passing customer_id in the flow trigger payload. I am referring to these docs - Create a Flow trigger