Webhooks are user-defined HTTP callbacks that are triggered by specific actions taken on Tableau Server. When you create a Webhook, you need to specify a name, the event type, and the destination URL that defines where the Webhook will be sent. Whenever that event happens on Tableau Server, the Webhook will fire and send a HTTP POST request to the destination URL. The destination URL needs to be the address of some external server that will receive Webhooks from Tableau Server via HTTP POST and take some action.
You can read more about Webhooks in our blog post.
These instructions will provide you with step-by-step instructions on basics of Webhooks, including how to set them up, how to fire them, and how to integrate them into an example workflow.
- Tableau Server - We recommend using your free Tableau Developer Program online site! These instructions will assume you are using your Developer Program online site, but you can also use any other Tableau Server instance, as long as it is on the 2019.4 version.
- Postman - A free third-party application which allows us to interact with the Tableau Server REST API. If you would rather use a CLI (command-line interface) tool to interact with the Tableau Server REST API, visit the webhooks-cli repository on Github for more information.
- Webhook test site - A simple external server that will receive your Webhooks and display them to you.
If you have already activated your free Developer Sandbox Site or are planning on using another Tableau Server instance, then you can skip this step.
- Go to the Tableau Developer Program Sandbox Site page.
- From this page, you can either sign up for a new account or sign in using your existing credentials. The sign in button is located on the top right corner of the page.
- After you sign in, go back to the Sandbox Site page, and click the GET SITE button to continue.
- You should receive an email with instructions on activating your Sandbox Site.
- After activating the site, try signing in to your site on Tableau Online. A successful sign in should take you to the main page of your site.
- You can download Postman from their download page.
- Open up Postman.
- Open up the Import dialog by going to File -> Import....
- Click the Choose Files button and import both of the .json files you've downloaded (Tableau Collection.json and Tableau Environment.json).
- After a successful import, you should be able to see the imported Collection and Environment as shown below. (If you can't see the collections panel, you may have to toggle the side bar from the bottom left corner).
- From the Environment dropdown menu on the top right corner of Postman, ensure that you have Tableau Environment selected.
- Open up https://webhook.site
- This is a Webhook test site, useful for testing that a Webhook fires properly. For now, you don't need to do anything on this site, but it will be used in Module 2.
- In Postman, click on the Collections tab and open up Tableau Collection. Then open up either the XML or the JSON folder, whichever one you prefer to use.
- Click on the Sign in request to open it up in the main panel. Look through the Body and Header tabs, just below the sign in request URL to see more details. Notice the Postman variables denoted by the double curly brackets, {{variable}}.
- In order to set the variables, click on the eye icon located in the top right corner of the application, right next to the Environment dropdown menu. In the dialog that pops up, click on the Edit button to edit the Tableau Environment.
- In the Manage Environments dialog, you need to fill out the variables in the CURRENT VALUE column. For the sign in request, you will only need to set the username, password, the server URL, and the site name.
- Username: Your email used to sign in to your Online site.
- Password: Your password used to sign in to your Online site.
- Server: https://10ax.online.tableau.com.
- Site-name: Name of your site in the URL (found in browser). If your online site URL is https://10ax.online.tableau.com/#/site/mysitedev123/home, then mysitedev123 would be your site name.
- After you've set the 4 variables, click on the orange Update button located on the bottom right corner of the dialog.
- Close the dialog and click the blue Send button to send the request. You should be able to see the response body on the bottom part of Postman.
- Look at the response from the sign in request and find the site-id and token values.
- Copy the site-id value from the response and set the site-id variable.
- Copy the token value from the response and set the tableau-auth-token variable.
- Let's now fill in the next 3 variables. The last variable is for later, after we've created a Webhook.
- Webhook-name: my-webhook
- Webhook-url: URL copied from your Webhook test site from Module 1, step 3. Go to the page and make sure to click on the green Copy button on the top right corner of the page.
- Webhook-source-api-event-name: webhook-source-event-workbook-created
- After updating the variables, click on the Create a webhook request in the collection pane on the left.
- We already have all the required variables set, so click the blue Send button to send the request.
- From the response, copy the Webhook id value and paste that into the last remaining environment variable, webhook-id.
Congratulations on creating your very first Webhook! Now that you have a webhook created, you can use the other endpoints in the collection. Feel free to explore and try out some of these endpoints.
- List Webhooks: This endpoint lets you list out all Webhooks that exist on your site. Try creating more Webhooks to get more than one result.
- Get a Webhook: This endpoint lets you get a specific Webhook, by its unique id. If you have more than one Webhook, you will have to change the webhook-id environment variable to specify a different Webhook each time.
- Test a Webhook: This endpoint lets you test out a Webhook, by its unique id. When you send this request, the Webhook will fire and you will be able to see the result in the Webhook test site!
- Delete a Webhook: This endpoint lets you delete a Webhook, by its unique id. If you use the delete endpoint, be sure to re-create a Webhook before moving on to the next module!
- From your browser, navigate back to your Tableau Online site.
- Click on the Explore tab on the left menu panel. Then, navigate to the Default project.
- Click on the Create button. Select Workbook to create a new workbook in web authoring mode.
- In web authoring mode, select the Superstore Datasource and click Connect.
- Create a simple workbook, or you can leave it blank.
- Save the workbook. This should trigger the Webhook you've created in the previous module!
- From your browser, navigate back to your Webhook test site opened up in Module 1, Part 3.
- In the body, you should be able to see the JSON response that contains more information about the event. Tip: Check the Format JSON checkbox to prettify the JSON response.
-
Workbook publish event is one of 13 events that we support today (more to come!). You can see the full list of events below.
Friendly Event Name API Event Name DatasourceUpdated webhook-source-event-datasource-updated DatasourceCreated webhook-source-event-datasource-created DatasourceDeleted webhook-source-event-datasource-deleted DatasourceRefreshStarted webhook-source-event-datasource-refresh-started DatasourceRefreshSucceeded webhook-source-event-datasource-refresh-succeeded DatasourceRefreshFailed webhook-source-event-datasource-refresh-failed WorkbookUpdated webhook-source-event-workbook-updated WorkbookCreated webhook-source-event-workbook-created WorkbookDeleted webhook-source-event-workbook-deleted ViewDeleted webhook-source-event-view-deleted WorkbookRefreshStarted webhook-source-event-workbook-refresh-started WorkbookRefreshSucceeded webhook-source-event-workbook-refresh-succeeded WorkbookRefreshFailed webhook-source-event-workbook-refresh-failed -
Pick an event from the list above and replace the webhook-source-api-event-name environment variable in Postman with the corresponding value from the API Event Name column.
-
Send the request in Postman to create a new Webhook with the event type you have chosen.
-
Try to trigger the newly created Webhook using Tableau Desktop or Tableau Server and verify them in the Webhook test site.
Now that we have a Webhook created, let's take a look at how to integrate it into a third-party workflow management application. In the previous module, our destination URL was a Webhook test site that simply listed out all the Webhooks that it received. We can now replace that destination URL With Automate.io, a third-party workflow management application which allows you to integrate Tableau Webhooks with hundreds of other applications. Automate.io can be configured to listen to your Tableau Webhook and take an action on a number of applications that they support.
Automate.io allows you to start for free, but they also offer paid plans for more advanced usage. Zapier is another paid third-party application that you can use to connect your Webhooks to hundreds of applications. These are no-code integration applications, but you can also write your own external server to listen to your Webhooks.
- Go to automate.io and follow the directions to sign up for an account.
- Sign in to automate.io.
- From the dashboard page, click on Create a Bot button located near the top right corner of the page.
- In the Select Trigger App drop menu, search for and select Webhooks.
- In the Select the trigger event drop menu, select Incoming Hook.
- Click on the Setup Webhook button to open up the setup window.
- From the new window, click on the Copy button to copy the URL. This URL will be your new destination URL, replacing the https://webhook.site url.
- Click on the I'm Done button and it will notify you that it is waiting for your Webhook to fire.
- Go back to Postman and create a new Webhook using this new destination URL by changing the webhook-url variable.
- Trigger the Webhook you've just created.
- Go back to the Automate.io window with your destination URL. If Automate.io received your Webhook properly, you should see the result on the window.
- Click on the "Looks Good" button to close the window.
- Your trigger app configuration should now look like this:
- In the Select Action App drop menu, search for and select an application of your choice. We will use Slack - Send a Direct Message action as an example.
- Automate.io will prompt you to integrate your application credentials in order to use the application as an action app.
- Slack has 2 required fields, username and message.
- As shown below, you can use the content included in the Tableau Webhook to generate a unique message by clicking on the plus button to the right:
- Save the Bot and turn it on.