Re: Cannot activate custom triggers for testing (flowTriggerReceive)

Cannot activate custom triggers for testing (flowTriggerReceive)

alicianu
Shopify Partner
4 0 0

I can easily create a custom trigger but I can't figure out how to test it once it has been created. I have tried multiple variations of using the flowTriggerReceive mutation on the GraphQL API but nothing is working.

 

Following the documentation, I tried the unstable API version where you pass in handle and payload. But I received an error saying that the handle was invalid. Then I tried the 2023-07 API version where you pass the trigger_id and properties. But then I got an error saying that the trigger_id was invalid. Additionally, if I create the extension using the CLI, it seems that I don't have access to the trigger_id. I have doubled checked the handles and trigger_id (where available). I have also published the extensions and made them available in my development store. I can't think of anything else to try.

 

I have been going in circles for days over this and I can't seem to find consistent documentation. Can someone please help?

Replies 14 (14)

paul_n
Shopify Staff
1314 148 300

Hi, sorry about that. I would stick with the newer API as it's the path going forward anyway. 

 

For the trigger to work, I think you need the following to be true:

  • Trigger has handle correctly defined
  • App with trigger is deployed/published 
  • App is installed on your test store
  • Workflow is built using that trigger and active
  • Mutation is called for that shop and for that specific trigger - sometimes partners grab the wrong API key here and it doesn't have access to the specific shop.

You may have also run into a current limitation with handles in that you cannot change them after a certain point. 

 

Any thoughts based on that? If not, it might help to share your TOML file with us, as well as the API mutation you are sending. You can also use flow-connectors-dev@shopify.com if you need to keep some details private. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
alicianu
Shopify Partner
4 0 0

Thank you for your response. If I created the app in the Shopify Partner Site, and I ALSO have an API key from the store Admin, can I use the Admin API? Or do I have to use oauth to validate? 

alicianu
Shopify Partner
4 0 0

Hello,

 

Can you confirm that the following is true?

  • I create the app using the CLI template which includes authentication
  • I need HMAC and access token in order to make calls to Shopify API
  • The only way to get that info is to do a redirect to my web server after the user installs the app. At that time, I can capture the required HMAC + token.

Do I have that right?

 

Thank you!

 

 

ryan_i
Shopify Staff
22 5 8

Hi there - sorry for the late reply. What you have there is right - you can then call the Admin API with the access token sent to your server during app installation. 

 

Thanks,

Ryan

- Finding Flow useful? Leave us a review.
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
DatLe
Shopify Partner
6 0 1

I call from postman mutation flowTriggerReceive($body: String!) but return 

Invalid trigger_id, where can i get the trigger_id?
DatLe_1-1693392118790.png

 

DatLe_0-1693392004732.png

 

paul_n
Shopify Staff
1314 148 300

If you are calling from Postman and got that error most likely you have the right trigger_id but the wrong API key.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
DatLe
Shopify Partner
6 0 1

Do you mean X-Shopify-Access-Token? I have used this access-token for other apis and it still works fine.

sakshigupta
Shopify Partner
6 0 0

Any luck with this - getting the same error

sakshigupta
Shopify Partner
6 0 0

I get the same error for our app and  we have used the correct API key and trigger id

ryan_i
Shopify Staff
22 5 8

Just to confirm, you are using the result of OAuth authentication as the value for the `X-Shopify-Access-Token` key for both 1. the app that the Flow trigger extension belongs to and 2. the shop that the token was generated for?

- Finding Flow useful? Leave us a review.
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
alicianu
Shopify Partner
4 0 0

In my case, the issue was that the client that I was working with did not have Shopify plus. So even though it worked in my test store, it did not work on the live store due to the client not having a shopify plus account. I did not get any error message. I just eventually figured it out after several days of trying.

DatLe
Shopify Partner
6 0 1

I fixed it, you have to use token from partner (custom app) instead token shopify.

sakshigupta
Shopify Partner
6 0 0

Yes, I am using the admin API access token. What I found out is that the flow created via extensions doesn't work yet. We need to make this via the app portal only, and once we release them seems to work.

paul_n
Shopify Staff
1314 148 300

In order to build a Flow trigger you must call the API with the token provided to your app via OAuth and not another token. For example, if you are working with a merchant, you cannot create merchant custom app and use that token. 

 

Assuming you have the right token, to 's point, to create a Trigger or Action for all merchant plans you must use a listed or unlisted public app. If your app is a partner "custom" (meant for 1:1 partner to merchant), it is currently only enabled for Plus merchants. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.