Skip to main content

Intents

The Intents API provides a way to invoke existing admin workflows for creating, editing, and managing Shopify resources.

The invoke API is a function that accepts either a string query or an options object describing the intent to invoke and returns a Promise that resolves to an activity handle for the workflow.

Intent Format

Intents are invoked using a string query format: ${action}:${type},${value}

Where:

  • action - The operation to perform (create or edit)
  • type - The resource type (e.g., shopify/Product)
  • value - The resource identifier (only for edit actions)

Supported Resources

Article

ActionTypeValueData
createshopify/Article——
editshopify/Articlegid://shopify/Article/{id}—

Catalog

ActionTypeValueData
createshopify/Catalog——
editshopify/Cataloggid://shopify/Catalog/{id}—

Collection

ActionTypeValueData
createshopify/Collection——
editshopify/Collectiongid://shopify/Collection/{id}—

Customer

ActionTypeValueData
createshopify/Customer——
editshopify/Customergid://shopify/Customer/{id}—

Discount

ActionTypeValueData
createshopify/Discount—{ type: 'amount-off-product' | 'amount-off-order' | 'buy-x-get-y' | 'free-shipping' }
editshopify/Discountgid://shopify/Discount/{id}—

Market

ActionTypeValueData
createshopify/Market——
editshopify/Marketgid://shopify/Market/{id}—

Menu

ActionTypeValueData
createshopify/Menu——
editshopify/Menugid://shopify/Menu/{id}—

Metafield Definition

ActionTypeValueData
createshopify/MetafieldDefinition—{ ownerType: 'product' }
editshopify/MetafieldDefinitiongid://shopify/MetafieldDefinition/{id}{ ownerType: 'product' }

Metaobject

ActionTypeValueData
createshopify/Metaobject—{ type: 'shopify--color-pattern' }
editshopify/Metaobjectgid://shopify/Metaobject/{id}{ type: 'shopify--color-pattern' }

Metaobject Definition

ActionTypeValueData
createshopify/MetaobjectDefinition——
editshopify/MetaobjectDefinition—{ type: 'my_metaobject_definition_type' }

Page

ActionTypeValueData
createshopify/Page——
editshopify/Pagegid://shopify/Page/{id}—

Product

ActionTypeValueData
createshopify/Product——
editshopify/Productgid://shopify/Product/{id}—

Product Variant

ActionTypeValueData
createshopify/ProductVariant—{ productId: 'gid://shopify/Product/{id}' }
editshopify/ProductVariantgid://shopify/ProductVariant/{id}{ productId: 'gid://shopify/Product/{id}' }

Note: To determine whether to use the shopify/ProductVariant edit intent or the shopify/Product edit intent, query the product.hasOnlyDefaultVariant field. If the product has only the default variant (hasOnlyDefaultVariant is true), use the shopify/Product edit intent.

Anchor to invoke
invoke
{ (query: ): Promise<>; (intentURL: string, options?: ): Promise<>; }

Invoke an intent using the object syntax.

Invoke an intent using the URL syntax.

URL format: action:type[,value][?params].

Supported actions that can be performed on resources.

  • create: Opens a creation workflow for a new resource
  • edit: Opens an editing workflow for an existing resource (requires value parameter)
'create' | 'edit'

Supported resource types that can be targeted by intents.

'shopify/Article' | 'shopify/Catalog' | 'shopify/Collection' | 'shopify/Customer' | 'shopify/Discount' | 'shopify/Market' | 'shopify/Menu' | 'shopify/MetafieldDefinition' | 'shopify/Metaobject' | 'shopify/MetaobjectDefinition' | 'shopify/Page' | 'shopify/Product' | 'shopify/ProductVariant'

Options for invoking intents when using the query string format.

{ [key: string]: unknown; }

Additional data required for certain intent types. For example:

  • Discount creation requires { type: 'amount-off-product' | 'amount-off-order' | 'buy-x-get-y' | 'free-shipping' }
  • ProductVariant creation requires { productId: 'gid://shopify/Product/123' }
  • Metaobject creation requires { type: 'shopify--color-pattern' }
Anchor to value
value
string

The resource identifier for edit actions (e.g., 'gid://shopify/Product/123').

Response object returned when the intent workflow completes.

Anchor to ClosedIntentResponse

ClosedIntentResponse

'closed'
'error'
Anchor to issues
issues
Issue[]
Anchor to message
message
string
Anchor to SuccessIntentResponse

SuccessIntentResponse

'ok'
{ [key: string]: unknown; }
Examples
const activity = await shopify.intents.invoke('create:shopify/Collection');

const response = await activity.complete;

if (response.code === 'ok') {
console.log('Collection created:', response.data);
}

Preview

Was this page helpful?