Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Getting webhook response body using node.js

Getting webhook response body using node.js

zk-ant
Shopify Partner
7 0 1

I've registered an 'orders/create' webhook in my app and it fires correctly, but I'm having trouble getting the order data from the response. I've tried multiple ways that I've seen here and there, I've tried using express'  json and bodyParser method, but without the documentation providing an example I'm a bit lost.

 

app.post("/api/foobar", async (req, res) => {
    try {
        console.log('response:', req.body);
        ...
        res.json({requestBody: req.body});
        ...

 

 

Also tried just dumping both `req` and `res` but they don't seem to contain any of the order info.

 

My fields registered to the webhook are the following:

 

webhook.fields = [
            "id",
            "email",
            "closed_at",
            "created_at",
            "updated_at",
            "number",
            "note",
            "token",
            "gateway",
            "test",
        ];

 

Reply 1 (1)

comet_tech
Shopify Partner
1 0 0

I'm looking for the same information, did you figure it out?