Webhook integration

A Webhook is an HTTP callback: an HTTP POST that occurs when something happens; a simple event-notification via HTTP POST. A web application implementing WebHooks will POST a message to a URL when certain things happen.

Integrating Slack with VGS, we can show how to set up webhooks on the real example.

First of all, we need to have or create a Slack account. Then we should create an app within Slack to use incoming webhooks in order to post messages into Slack. Follow this guide to set it up.

Once Slack application is created, we will have webhook URL to send messages in JSON as the body of an application/json POST request.

In order for us to set up integration with VGS, we need to create inbound route to Redact the message by using Upstream Host: hooks.slack.com. We will use ContentType as application/json and PathInfo should contain webhook URL path.

webhooks_inbound.png

Once we have inbound route set up, we can send the curl request with the text message, using the following shortcut:

curl https://tntsfeqzp4a.sandbox.verygoodproxy.com/URL_PATH \n
-H "Content-type: application/json" \n
-d '{"text": "message"}'

The message will be redacted into the alias and posted to the predefined channel.

In order to reveal the message, we need to create the outbound route to Reveal the message. The Upstream host will stay the same: hooks.slack.com. We will use the same settings for ContentType and PathInfo.webhooks_outbound.png

Once we have outbound route set up, we can send the curl request using the following shortcut:

curl https://hooks.slack.com/URL_PATH -k \n
-x $HTTPS_PROXY_USERNAME:$HTTPS_PROXY_PASSWORD@tntsfeqzp4a.sandbox.verygoodproxy.com:8080 \n
-H "Content-type: application/json" \n
-d '{"text": "ALIAS"}'

The message will be revealed and posted to the predefined channel.

That is the basic example of using webhooks with VGS. Using this algorithm we can set up VGS integration with any other application (on the webhook basis).

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.