Solved

Email alert for WebHook errors?

  • 28 February 2017
  • 6 replies
  • 18 views

Is there a way to set up WebHook integrations so that any errors are sent to a specified email address?

It looks like there was a post about this way back in 2014, so I’m hoping something like this has been implemented by now, but I haven’t been able to find a setting for it.

Thanks!

icon

Best answer by Hristian 2 March 2017, 09:11

View original

6 replies

Userlevel 7
Badge +3

Hi @leah.ann,

There is no way currently to set up such notifications from inside Unbounce.

However, most 3rd party APIs would return some kind of error if the information doesn’t get passed properly.

You can adjust your webhook script in those cases to fire off an email.

Best,
Hristian

Hey @Hristian,

Unfortunately the problem tends to happen when the Webhook endpoint fails (e.g. the API server goes down), so there would be no way to integrate some kind of email alert into our script as it wouldn’t even know that anything is trying to post to it.

For the error handling to work, it would need to happen on Unbounce’s end, as Unbounce is the only point of contact that would know whether or not it was able to reach the webhook URL.

Userlevel 7
Badge +3

Hi @leah.ann,

Actually when you are using webhooks, Unbounce only knows and shows what the webhook returns as a response.

If the webhook passes the form’s data successfully the API usually returns a 200 response (successful execution). This is what Unbounce displays.

If the webhook submission is unsuccessful, the API similarly returns an “error” response. Only this time it’s not a 200 but some other response, depending on how these responses are setup on the API side.

There is no way for Unbounce to know whether the API is functioning unless your webhook reports back.

So going back to your original question… You should adjust your webhook to fire off an email each time the response is anything other than 200.

Best,
Hristian

Hm, maybe I’m not quite understanding what you’re saying.

I’m using Unbounce’s webhook feature to post our form data to our API. As far as I’m aware, the only control I have over the webhook is to provide it with the URL to post to, and to adjust the field mapping.

Is there some way that I can modify the webhook script itself?

Userlevel 7
Badge +3

So you are posting straight to the API? No intermediate webhook script that would authenticate with the API and post the data?

I assumed you have a script between the webhook post from Unbounce and your API. Most APIs require some kind of token authentication before allowing you to work with it.

Just write a simple webhook script and point your Unbounce webhook to it. Everything else would be as described above. If the API returns an error, the webhook script would fire off an email.

Here is the official Unbounce documentation for webhooks, including a sample PHP code. You would need to modify it but it would give you a good starting point.

Best,
Hristian

Yes, that’s correct. The API we’re posting to is actually connected with our internal custom-built CRM, so no intermediate authentication is necessary in our case. Totally valid misunderstanding, probably should have mentioned that. 😓

We’ve now written an intermediate script to fire an email in the event of failure.

Thanks for the help!

Reply