Best answer

REST Hook not performing action and apparently doesn't accept the data pushed to hookUrl? But no error message.

  • 8 January 2021
  • 6 replies
  • 355 views

Userlevel 2

Some background:

I have got everything set up to use REST Hooks except the last part.

I have the subscription and delete subscription API endpoints set up and working.

I receive the hookUrl parameter upon subscription.

If I post to hookUrl without any data I get an action triggered (though with blank data, so no use there).

The problem:

If I post to hookUrl with data in the body of the request, the response still says OK but no action is triggered.  There must some error going on but I’m not being told about it. 

Can someone give me insight into exactly what my POST data should look like?  The documentation doesn’t quite say it.  It says an array, but I am providing an array in “body”, just like the array I was using previously for “polling” mode but still getting this silent error.

icon

Best answer by Randall Coding 8 January 2021, 20:39

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

6 replies

Userlevel 7
Badge +12

@Randall Coding - When you post to hookUrl, Zapier will acknowledge the request before running the actual function that handles it. So, in order to see what’s going wrong, I suggest you take a look at the Monitoring section.

Userlevel 2

SOLVED

I solved the issue by sending just a single object in body instead of an array to the hookUrl provided by Zapier.

Userlevel 2

@Randall Coding - When you post to hookUrl, Zapier will acknowledge the request before running the actual function that handles it. So, in order to see what’s going wrong, I suggest you take a look at the Monitoring section.

Hi @ikbelkirasan .  Thanks, but all I saw in the monitoring section was graph that I could barely read.  I couldn’t glean any request / response details from it. 

Looks like I solved this though.  Instead of posting an array to the hookUrl, I’m now posting a single JSON object as the POST “body”.  That worked.

Userlevel 7
Badge +12

Oh awesome! Glad you figured it out :)

Userlevel 2

Oh awesome! Glad you figured it out :)

Thanks.  I would add a fix it note here for the documentation.  It seems really ambiguous or misleading on this point to a new user. 

It says the following

You may need to put the response inside an array. We expect that the perform function returns a bare array of objects.

https://platform.zapier.com/docs/faq#how-do-i-define-rest-hooks-and-use-the-embedded-tester-with-them

That lead me to believe I should have posted an array rather than a single object (similar to what polling wants).

I also didn’t see anywhere explaining what type of data the hookUrl expects to be posted to it besides that blurb.  Making that more explicit will help future users incorporate this feature, along with having some helpful response messages saying if the format is incorrect.

Hello!

I ran into the same issue. My question is really related to yours that is why I am posting here instead of opening a new thread. Let me know if I am wrong.

I understood that hookUrl is expecting a single object and no array. But how can I send multiple objects?

I tried with something like:

{
object-1: {
id: 1,
content: "blablabla"
},
object-2: {
id: 2,
content: "blublublu"
}
}

But it doesn’t work either.

Does it mean that I need to send the objects one by one?

Thank you!