Hello!

I am trying to test Redash Webhooks and I have set up an alert from a query that just counts some fields and if is greater than 0, alerts (this condition is always true).

The alert has the notifications send to my personal email, and a mock Webhook. At first I just wanted to see if it works and visualize the payload, so I am using the https://webhook.site to do so.

When I run the query, I receive an email however I do not receive anything in the webhook.site. I do not have access to the logs nor the Redash installation to verify if there is something wrong.

I would like to know if there is anything that could be possibly preventing this alert to send to the Webhook?

Thanks in advance.

1 Like

Thanks for posting here and sorry for the late response. Without the server logs it’s not possible to isolate the exact cause in your situation. I added an item to my list to see if I can reproduce this from what you describe. If I detect a bug I’ll open it against our repository.

Thanks a lot for the reply. Since you have answered I can try to contact the responsible team for the Redash deployment if they could check again for some logs when the alert occurs. Meanwhile, is there any other information I could provide you that might help? The app version, for example…?

Yes, the app version would be useful to know :slight_smile:

I saw the version on the dashboard. It is Redash 4.0.1+b4038

We have found the logs:

[2022-07-21 15:13:15,779][PID:36919][ERROR][Worker-38921] webhook send ERROR.
Traceback (most recent call last):
  File "/opt/redash/redash.4.0.1.b4038/redash/destinations/webhook.py", line 42, in notify
    resp = requests.post(options.get('url'), data=json_dumps(data), auth=auth, headers=headers, verify=False)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 110, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 596, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)
SSLError: bad handshake: Error([('SSL routines', 'SSL3_GET_SERVER_CERTIFICATE', 'certificate verify failed')],)

The problem is with SSL. I searched this error, and I found an issue on GitHub that states:

Support for Redis and SSL was implemented in #3848. Which was after the v7 release.

If we update our Redash, we will be able to send WebHooks?

A couple things:

  • Your version of Redash is very old. Before my time, in fact. So I can’t give much guidance.
  • The SSL error is not a problem with connecting to Redis. It’s actually a bad SSL handshake with the webhook service you’re connected to. i.e. it’s not a problem with Redash but with the other server.

I would recommend updating to the latest version of Redash according to our upgrade guide: https://redash.io/help/open-source/admin-guide/how-to-upgrade-legacy

As I said in the post I was trying to send a webhook to the https://webhook.site , but that was mainly because I have no idea what the payload of a Redash webhook is, and I could not find it in the internet. Send to this site would be an easier way to figure it out.

Our final goal is to send the webhook to New Relic, our main monitoring tool. But to configure a webhook there, we need to know the payload.

Do you have some way to provide us what the Redash webhook payload looks like?

Not for version 4…

You could modify the source to log the contents of the payload and then find it in your server logs. This would not require a successful network request.

Great!
Thanks a lot! :smile:

The problem is that apparently our version of Redash does not support the new format of Let’s Encrypt. But either way, I managed to receive the payload using requestbin.com, that accepts requests http.

The payload is the following:

{
	"url_base": "http://dashboards.com.br/",
	"event": "alert_state_change",
	"alert": {
		"state": "triggered",
		"query_id": 10373,
		"name": "test: diff greater than 0",
		"rearm": 60,
		"updated_at": "2022-07-22T16:27:38.220515+00:00",
		"user_id": 1,
		"created_at": "2022-06-21T18:23:28.400610+00:00",
		"last_triggered_at": "2022-07-22T16:27:40.214690+00:00",
		"id": 110,
		"options": {
			"column": "diff",
			"value": 0,
			"op": "equals"
		}
	}
}

I modified it a bit to secure the received data

But that raised a few more doubts… For newer versions of Redash, the payload or headers of webhooks can be configured?

And if not, could you provide the payload for newer versions of Redash?

For newer versions of Redash, the payload or headers of webhooks can be configured?

The alert destinations system is completely pluggable in Redash. If you want to change the headers for your specific target you can fork the webhook destination code, adjust it to your satisfaction, and mount like any other query runner or alert destination :ok_hand:

1 Like