Data processed differently coming from a webhook and replicated using a function

Hi. I have a workflow that starts with a webhook and sends an HTTP request to Intercom. However, whenever it is a live execution, Intercom returns no data. If I replicate the same using a function node, it works great.
The problem is definitely not on the Intercom side and I’ve been struggling with this for over a week lol

Please share your workflow

Share the output returned by the last node

[
  {
    "headers": {deleted
    },
    "params": {},
    "query": {},
    "body": {
      "user_id": "73c0327c-00ec-4f68-950b-85263fb6982b",
      "work_email": "[email protected]"
    }
  }
]

Information on your n8n setup

  • **n8n version: 0.187.2

Hi @Artego :wave:

I’m trying this out and definitely getting a response from Intercom:

Is this also what you’re seeing?

1 Like

Hi! I get a 200 as well but it doesn’t find any data, the array is empty just like on your screenshot.

Hi @Artego :wave: Looking again, this might be part of a fundamental change in Intercom’s UI from version to version. I switched up the request to an older version of the API (1.2) and a get request to the /users/ endpoint, and got a response as you probably expect:

It also looks like there’s quite a few caveats to searching for contacts as per their documentation :thinking:

Can you share the code you’re using when the request does work?

I use exactly the same code, just the data comes from a Function node instead of a webhook. I just took the output of the Webhook node execution and replicated it. This way it work and I get the expected data. Whenever it is a live data coming from the webhook, the array is empty. So confused lol

1 Like

Hi @Artego :wave:

Was looking into this before I left for the evening yesterday, and one thing I noticed - in that function node in your first post, you’ve not set the body.user_id field. Entirely possible that Intercom simply runs a wildcard search in this case, which is why you’re seeing different results.

You’re also on quite an old version of n8n, and we’ve had many (over 40!) updates to the HTTP Request node since that version :sweat_smile: Can you try to update to a recent version of n8n and see if this issue still persists for you?

If it does, can I get the exact JSON output of both your Webhook and your Function node to compare the two? :+1:

1 Like

Hi. We are in the process of updating n8n right now, but it’s going to take some time

What do you mean by " you’ve not set the body.user_id field"? I’m not a developer and get easily confused with some of the terms :sweat_smile:

1 Like

Hi @Artego :wave: No worries at all! Hope the update goes smoothly for you :slight_smile:

What I had meant was your code node was doing something a little bit different than what you’re doing with the HTTP request node. You didn’t specify body.user_id like in your HTTP Request, so Intercom may be taking this as a wildcard search and returning more results :bowing_man: Does that make sense?

You mean this one, right?

1 Like

You got it :slight_smile:

I’m confused now lol. The screenshot I provided is of the function node and the user_id is there, so I’m guessing, Intercom wouldn’t run a wild card

But as I mentioned, with the function node it works like a charm. For some reason, the data coming from the webhook is processed differently

Hi @Artego :wave: Sorry if I was confusing - essentially, I believe Intercom is always going to return that field, what you circled was the output with the Intercom response :sweat_smile:

I’m glad the function node is working for now, though!

1 Like