Make changes to a list of things when Webhook requested Data comes in

Hi all
@NigelG @jcindy81 @J805
@whoever can help me out here!

I am struggeling to get following scenario working:

I was setting up a webhook to shopify to inform my app when an order ist fulfilled. The wwebhook is tested, data is coming in.
The goal is quite simple:

  • Each Order can contain one or more products.
  • Each product has a unique_id, the products are stored in shopify and also in my bubble app, the link is made with this unique_id.
  • Also each product has a fulfillment status, wich must be “fulfilled”.
  • In 99% cases an order will not contain more than 1 - 10 products.

I was triying for hours now to “make changes to a list of things”, in my case the products.
This is how i try it: (See Screenshot below)

The API Workflow for the webhook looks like this (i am using the “Shopify Custom Apps”-Plugin by @ZeroqodeSupport)

The action looks like this: i am searching for products where the Bubble-Product has the shopify_id = Request Data’s line_items product_id … therefore the same ID as the Shopify-Product wich was sold. (See Screenshot below)

i need some little help, i am totally stuck. I tried many diffrent ways, forth and back. Allways running in the same problem:

When i place an test-order in Shopify with only one product then it works. But somehow there’s a problem with the :each item’s product_id

From what i understand this expressions returns a list of Products from all my products i have wich have the same ID as one of the products from the Requested Data’s products… Or am i wrong?

The Requested Test Data looks as following (i deleted many lines as there are many i am not using)… but the things that i am referencing is there, just for showing purpose.

ORDER FULFILLMENT

{
    "id": 820982911946154500,
    "fulfillment_status": "fulfilled",
    "line_items": [
        {
            "fulfillment_service": "manual",
            "fulfillment_status": fulfilled,
            "product_id": 8200133751192,
        }
        {
            "fulfillment_service": "manual",
            "fulfillment_status": fulfilled,
            "product_id": 7608528653982,
        }
    ]
}

Thanks for any help!!

Try changing “=” to “is in” in Search for Products search constraints.
Request Data’s line_items.each item’s product_id gets list of product ids. So you need to test for inclusion, not for equility.

hi and thanks!

Bt then wwhat at the end?

Cheers;
pino

datatpyes are probably mismatch.
What type has shopfy_id in Product thing? And what type of product_id in request data?

Ok i’ll quickly read that in the shopify Doc.

Just a moment

No, that’s not about shopify… You have initialized your endpoint, see its datatype here:


Shopy sends you a number in product_id. If your shopify_id is a number, then change product_id’s type to number.

Ahaaa… most likely you’re right. Sure you’re right. In Request data it’s a number. In bubble it’s a text.

Just a moment i’ll change that

Yuuuuhuuuuii!! Man i was going crazy… Thank you very very much!

1 Like