Introducing the admin intents API

We're excited to introduce admin intents — a transformative API that enhances app interactions with Shopify's admin interface.


This is a companion discussion topic for the original entry at https://shopify.dev/changelog/introducing-the-admin-intents-api
4 Likes

Hi there,
Can we create/edit the metaobjects created from a specific app, or a simpler is my app?

Our docs here outline the conditions on when app created metafields and metaobjects can be updated.

I tried but it show the error

Invalid intent option: value
Invalid intent option: source

my code

const onClickIntent = async() => {
    const activity = await shopify.intents.invoke('edit:shopify/Metaobject', {
      value: 'gid://shopify/Metaobject/140320374962',
    });

    const response = await activity.complete;

    if (response.code === 'ok') {
      console.log('Metaobject updated:', response.data);
    }
  };
1 Like

Can we have this for editing ProductVariant objects too?

Edit: My bad, it seems to be supported, I just didn’t read the more comprehensive documentation. However, I can’t seem to get it to work. It looks like you need to pass the ID for the product along with? But according to the documentation it shouldn’t be necessary:

Update: After some trial and error I got it to work. The other issue is the productId field must only be the numeric ID (when editing variants at least), which also contradicts the documentation.

Also, it doesn’t work if the variant is the only variant (default variant) on the product. It gives a server error. It should just redirect to the product in that case.

The intent API for editing customers always throws an internal server error 500.

const handleEditCustomer = useCallback(async () => {
    if (!!app.intents.invoke) {
      const activity = await app.intents.invoke(`edit:shopify/Customer`, { value: customer.id })
      const res = await activity.complete
      console.log('res', res)
    }
  }, [customer.id])

I think I am doing this correctly but it just seems to not work at all.

Hi @Adam_Jakab

Thanks for flagging - this does look to be a bug on our side, we’re investigating this now.

Hi @Adam_Jakab

We shipped an update that should resolve the issue you were seeing - can you test again?

Hey @Liam-Shopify ,

The issue still persists with the same 500 error page. If I understand correctly, there is no need to update the package version, since it’s already served via the CDN right?

Here are the console logs I am getting.

Hi @Adam_Jakab

It’s possible the fix hasn’t been fully deployed yet - digging into this on my side again

Hey @Adam_Jakab, are you still seeing the errors here?

Hey @KyleG-Shopify

It seems to be working fine now, I’ll let you know if I experience any other issues.

That’s great! As Liam mentioned it should be fixed, but please do let us know if you see anything re-occur!

Hi team :waving_hand:

Loving the new Admin Intents API direction — it’s a great DX improvement for invoking native admin workflows from apps.

Question: Will the Orders resource be added to Intents (and if so, what scope & timeline)?

Thanks!

Hey Andrei, glad to hear you’re living this.

Any additions will be noted in the developer changelog. I don’t have a timeline on that at this point, but will pass on this as feedback and a feature suggestion to our team.

Is there any way to pass in parameters/defaults through admin intents. For example, we’re using admin intents for creating metafield definitions, however the app is expecting a certain type. Being able to pre-populate the definition with the correct type would be a huge win for merchant convenience and minimizing error and confusion.

@KyleG-Shopify would be great if you could pass this on as well since I don’t think it’s possible currnetly

1 Like

Hi All,

Just a quick question. Does admin intents have any plan to support for Orders/ Draft Orders in near future.