©2008-2017 David V Keeney All rights reserved.
RdbHost now supports webhooks. We have long had a proxy that could call webhooks and web-services on other hosts, but you could not, until now, have their webhooks access your RdbHost account.
Now you can, for example, have your github commits logged to your RdbHost database through github's webhooks. You could, in principle, host an email application on RdbHost, using a third party webservice API to send outbound mail, and their webhooks to bring inbound email into your database account.
The path for webhooks is /dbwh, and the syntax is otherwise similar to /db, calling for a q parameter.
Webhooks are generally requested via POST, but you can provide parameters on the url as well. A typical RdbHost webhook would include the query in the url, and the data as post data.
If the service calls the webhook using form-data (as a browser web-form would) the named params will be available as %(name) tokens, to include in the query string, as appropriate.
If the service uses JSON body (or XML, heaven forbid), the complete body is provided as parameter
postbody as in the example above. It can be parsed using PostgreSQL's JSON data type and
These webhook queries should generally be white-listed, as
role queries, but white-listing is not the smoothest thing, yet. You cannot just put the account in
training mode and trigger the webhook, as the webhook is requested (generally speaking) from an IP
address other then the one registered to train. The best approach, for now, is just to copy-paste very
carefully into the white-list directly using rdbadmin. The white-list
is in a table called
If you wish to restrict the webhook from being called by any other than a specific IP address, you can explicitly check the ip in the function. Use a url like:
and then compare the second parameter against a control list of IP embedded in the function, or in a table. Raise an exception or just return if the remote IP is not ok. RdbHost supports both PL/pgSQL and plV8 languages for function definition.