GraphQL Webhook not working

No… I cannot change that url… Can we have 2 different hooks for Purchase Order?

Because we are running 2 different systems

Hey @rohitrajv5!
No, you will only be allowed to have one of each Webhook type per account, so 2 po_update webhooks wont work at the same time

@tomasw I am still not able to receive any response on my URL. Can you please check… This is my piece of code to read the inital response

I just updated my PO couple of times… But did not received any response.

$json = json_encode(file_get_contents(‘php://input’));

$file_handle = fopen(‘my_filename.json’, ‘w’);
fwrite($file_handle, $json);
fclose($file_handle);

I have replaces my webhook now…I have only 1 webhook

https://tryanddo.com/purchase_order.php

But after updating any PO… Webhook doesn’t call

Hi @rohitrajv5
Thanks for the extra information

I researched a bit and it seems like the webhook is triggering correctly but the server receiving the webhook is returning an error:

Reference: https://tryanddo.com/purchase_order.php | Method: POST | Status: 406 | Reason: Not Acceptable | 

Response: <head><title>Not Acceptable!</title></head><body><h1>Not Acceptable!</h1><p>An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.</p></body></html>

I consulted to our engineers and they suggested that in this kind of errors, “generated by Mod_Security” means it was rejected by Apache and the security config

So I guess you should contact the person that is responsible for https://tryanddo.com/purchase_order.php and ask him about this

Let me know if this doesn’t solve the issue
Thanks again!
Tom

Hi @tomasw. Please support me as well on this topic. I registered a webhook for Shipment Update. So I have 2 right now:


The request id for this query is 5f4f9efd35ef0bf976bfd451

But I’m not getting any updates.
My account email is varun@merchraise.com.

Thank you in advance.

Hi @varun!
Are those webhooks registered on the Child account? (not the 3PL)
Those webhooks need to be registered on the Child account (customer account)
I apologize we did not have that noted on our documentation, I added it for future reference.
Let me know if that still doesn’t solve the issue
Thanks in advance!
Tom

@tomasw I’m not sure I understand what do you mean by customer account. Can you please explain.
What details do you need in order to give me an example of the customer account that I might be able to use

sure!
For example, in my 3PL account if I do the following query:

query {
  account {
    request_id
    complexity
    data {
      id
      legacy_id
      username
      customers {
        edges {
          node {
            id
            legacy_id
            username
          }
        }
      }
    }
  }
}

I get a response back containing the information about a Customer account from the 3PL, this is:

{
  "data": {
    "account": {
      "request_id": "5f4face1b54775c983f4fb9f",
      "complexity": 101,
      "data": {
        "id": "QWNjb3VudDo2MzM3",
        "legacy_id": 6337,
        "username": null,
        "customers": {
          "edges": [
            {
              "node": {
                "id": "QWNjb3VudDo3NTU0",
                "legacy_id": 7554,
                "username": null
              }
            },

So then I want to request all the webhooks this account has (Customer Account ID 7554) by doing:

query {
  webhooks(customer_account_id: "7554") {
    request_id
    complexity
    data(first: 10) {
      edges {
        node {
          id
          legacy_id
          account_id
          shop_name
          name
          url
          source
        }
      }
    }
  }
}

And then you are able to see what webhooks are set up for customer account 7554
If you will be setting up a NEW webhook then the mutation you should be doing is something like this:

mutation {
  webhook_create(
    data: { customer_account_id: "7554", url: "<url>", name: "<name>" }
  ) {
    request_id
    complexity
  }
}

So that way it gets registered to the customer account instead of the 3PL account.

Let me know if that helps or if I could explain better.
Thanks again!
Tom

Is there a way to register webhook for all customers?
We Don’t have just one customer (request_id: 5f4fbc5bfcb58bd1ba5763fd) and it will be annoying to create/delete/update webhook for each one,
Even if we will setup the webhooks for those customers, this mean that when we will add a new customer we will have to comeback to webhooks…

Hi @varun
We don’t have that feature at the moment, webhooks need to be registered on one account at a time.
I will submit a Feature Request for this to be added, but for now it should be done on each of the customers.
The reason it was implemented that way is because most 3PLs need their customer’s webhook to get trigger into their respective Stores, and not one specific store. Also, webhooks trigger at the Customer’s account level because in that account is where products and orders are created.
What I could request is to have the ability to subscribe ALL the child accounts to a specific webhook.
Let me know if this will work for you.
Thanks again!
Tom

Hi @varun @tomasw

From all these conversions what I found is we need to have a 3PL account !! Correct

I have the same issue of webhooks, These are not being triggered. :thinking:

Hi @tomasw , thanks for helping me, I was able to register webhooks for customers and looks like it works.

1 Like

Hi @varun

which account do you have? are you using 3PL account ?

Hi @khungersumit!
In case it helps, you could check your account type (and the customers) with this Query:

query {
  account {
    request_id
    complexity
    data {
      id
      legacy_id
      is_3pl
      customers {
        edges {
          node {
            id
            legacy_id
          }
        }
      }
    }
  }
}

If you see some customers or if you get “is_3pl”: true, then your user is on a 3PL account
Let me know if there is anything else I could help with
Thanks again!
Tom

@tomasw sorry to bring up this old thread but did you happen to create a Feature Request to subscribe ALL child accounts to a webhook for 3PLs? That would be really helpful for us right now.

Thanks!

Hi @afroznissar
No problem at all!. I did, but it was rejected actually.
Are there a lot of accounts you need to set it up for? Do you want me to re-open the request?
Thanks in advance!
Tom

Hi @tomasw

Well, we need to enable it for all our active clients. We probably have around 15-20 of them right now. We would then also need to set it up for all new accounts moving forward. If we happen to forget or miss one due to human error, we wouldn’t easily know that it was missed.

So yeah, it would be great if we could re-open the request.

Thank you!

Afroz

Hi @afroznissar!
Thanks for that info.

Is it common practice to change webhooks on your accounts? or you subscribe to them once and rarely change them?

(I already made the request but to get more information in the meantime)

Thanks again!
Tom

Hi @tomasw!

No, until now, we’ve never needed to change webhooks after subscribing to them. Even if that needs to happen in the future, it will be rare. However, it will be common for us to need to subscribe to them in bulk across all our active customer accounts.

And if it helps, here’s our business case: we are integrating Shiphero with our internal invoice management systems as well our internal mini-ERP. So we need to track all shipments for all our clients. We can’t use Shiphero’s billing module for various reasons so this integration will save us a LOT of time and human error.

Thanks Tomas!