In this topic:
Overview
Webhooks let you build custom applications or workflows that react to events that happen in Tableau. For example, you could use webhooks to send an SMS or Slack notification any time a datasource refresh fails, or fire off a confetti cannon when a new workbook is created. For the initial release, webhooks are supported for a selected set of datasource and workbook events.
You configure each webhook to subscribe to an event in Tableau. Then, when the event occurs, an HTTP POST request will be sent to the public URL you specified. This POST request includes a JSON payload that includes information about the event. The payload includes the ID of the object in question so that the Tableau REST API can be used to get additional information or take further action.
Prerequisites
To use Tableau webhooks, you must be authenticated as a site administrator for the Tableau Cloud or Server instance where the webhooks feature is enabled, for example, https://10ax.online.tableau.com.
You can set up your own Tableau Cloud instance and get many other benefits at no cost by joining the Tableau Developer Program.
Set Up a Webhook Using Postman
Here is an example of setting up a webhook with the REST API using Postman.
-
Download the following files (follow the link and save from your browser or IDE: https://github.com/tableau/rest-api-samples/tree/master/postman
-
Download and install Postman from https://www.getpostman.com/.
-
Launch Postman and click File > Import and choose the Postman collection and environment files you downloaded and then select Import.
-
Choose the Tableau Webhooks Requests collection on the left, and then select Tableau Webhooks from the environment dropdown menu on the top right.
-
To configure environment variables for webhooks, click the sliders icon near the environment dropdown. In the MANAGE ENVIRONMENTS dialog, select Tableau Webhooks. Replace the placeholder URL for the
servervariable in the CURRENT VARIABLE column with your server URL (likehttps://10ax.online.tableau.com). Fill in thecontent-urlenvironment variable for your site (content-url value would bemy_siteif your site url looks like this -https://10ax.online.tableau.com/site/my_site/projects). Add either your username and password or your Personal Access Token name and secret. Click Update and close the dialog. -
In the Tableau Webhooks Requests collection, choose the Sign-in request. You can choose either the username/password method or the personal access token method. Click Send. The response body contains the site id and a token.
-
Open the MANAGE ENVIRONMENTS dialog from the sliders icon, open Tableau Webhooks variables, and use the site id and token to set CURRENT VALUE of the
site_idandtableau_auth_tokenvariables. -
In the list of requests, click Create a webhook. In the request body, enter a webhook
name, a Tableau trigger event name from the Trigger Events table, and a destinationurl. The destination URL must be https and have a valid certificate. -
Click Send, and then use the ID of your new webhook from the response body to set the
webhook-idenvironment variable in the MANAGE ENVIRONMENTS dialog. -
In the list of requests, choose Test a webhook and click Send. Testing the webhook sends an empty payload to the configured destination URL of the webhook and returns the response from the server. This is useful for testing, to ensure that webhooks POSTs are being sent from Tableau and a response is returned from the destination as expected.
Set Up a Webhook Using cURL
Here is an example of setting up a webhook with the REST API using cURL.
Sign In
curl "http://<server>/api/3.1/auth/signin" -X POST -d @signin.xml
Content of signin.xml:
<tsRequest>
<credentials name="<username>" password="<password>" >
<site contentUrl="" />
</credentials>
</tsRequest>
Create a Webhook
curl "http://<server>/api/3.6/sites/<site-id>/webhooks" -X POST -H "X-Tableau-Auth:<token>" -d @details.xml
Replace token with the token from the sign in response body.
Content of details.xml:
<tsRequest>
<webhook name="my_first_webhook"
event="DatasourceRefreshStarted" >
<webhook-destination>
<webhook-destination-http method="POST" url="<URL>" />
</webhook-destination>
</webhook>
</tsRequest>
Replace URL with the destination URL for the webhook. The webhook destination URL must be https and have a valid certificate.
Test the Webhook
Testing the webhook sends an empty payload to the configured destination URL of the webhook and returns the response from the server. This is useful for testing, to ensure that things are being sent from Tableau and received back as expected.
curl "http://<server>/api/3.6/sites/<site-id>/webhooks/<webhook-id>/test" -X GET -H "X-Tableau-Auth:<token>"
Replace webhook-id with the webhook id from the create webhook response body.
See the Test a Webhook endpoint for more information.
List Webhooks
curl "http://<server>/api/3.6/sites/<site-id>/webhooks" -X GET -H "X-Tableau-Auth:<token>"
Webhooks Tutorials
Set up a Tableau Webhook Using Glitch and If This Then That
In this tutorial, you can learn how to set up a Glitch project with If This Then That (IFTTT) as the service that processes your webhook message.
Integrate Tableau Webhooks with Slack Using Glitch
In this tutorial, you can learn how to use a Glitch project to integrate your webhook message into Slack. Using these techniques can help you avoid commonly seen HTTP 400 errors.