Skip to main content

Tutorials

Learn how to build business software on Retool for different use cases.

Connect to Zendesk

· 5 min read

Zendesk supports 3 different authentication methods for using the support API: basic auth, API Tokens, and OAuth. We'll run through all of them here.

Basic Auth with the Zendesk API

Using basic auth is easy, but you'll first need to enable it in your Zendesk API settings:

Once you've enabled basic auth in Zendesk, head over to Retool (create an account if you don’t have one). Click on the “Resources” tab up top, tap on the “Create new” button on the top right, and choose “REST API” as your resource type.

Start by pasting your Zendesk subdomain (ours is retooldocs.zendesk.com) + /api/v2 into the "Base URL" field. Then, from the "Authentication" dropdown below, choose "Basic Auth." Enter your username (email) and password, click "Create resource," and you're ready to go.

API Tokens with the Zendesk API

To authenticate with the Zendesk API via an API Token, head over to your API settings. You'll need to enable Token Access, and then create a token:

To create a token, click "Add API Token" and give it a name. Once you've got it copied to the clipboard or saved elsewhere, head to your Retool homepage (create an account if you don’t have one). Click on the “Resources” tab up top, tap on the “Create new” button on the top right, and choose “REST API” as your resource type.

Start by pasting your Zendesk subdomain (ours is retooldocs.zendesk.com) + /api/v2 into the "Base URL" field. Then, from the "Authentication" dropdown below, choose "None" - we'll do it in the request headers. Scroll up to the "Headers" section and add an Authorization header. It should be of type Basic, and the actual token is going to be a Base64-encoded combination of your username (email) and API token. The format should look like:

<username>/token:<token>

So for us, it looks like docs@retool.com/token:6wiIBWbGkBMo1mRDMuVwkw1EPsNkeUj95PIz2akv. Finally, we need to Base64 encode this - you can use a free tool on the web like this one. The final header value should look something like:

Basic anzdGluJldG9vbC5jb20vdG9rZW46TnVMVDNScElxWEIzelU5SW1EcFhVVkF5N3QwZjZJOEZSQllOam9TVA==

Click "Create resource" and you should be good to go!

OAuth with the Zendesk API

To authenticate via OAuth (check out Zendesk's docs here), navigate to the "OAuth clients" section of your Zendesk API settings. You'll need to create a new client application for Retool, and copy the resulting Client Secret and ID.

In the "Redirect URLs" section, paste in https://oauth.retool.com/oauth/user/oauthcallback - this is the callback URL Retool uses for authenticating via OAuth schemes. Once you click "Save" you should see your Client Secret - keep that in a safe place, as Zendesk won't display it again.

Once you've finished creating your client application in Zendesk, head over to Retool (create an account if you don’t have one). Click on the “Resources” tab up top, tap on the “Create new” button on the top right, and choose “REST API” as your resource type.

Start by pasting your Zendesk subdomain (ours is retooldocs.zendesk.com) + /api/v2 into the "Base URL" field. Then, from the "Authentication" dropdown below, choose "OAuth 2.0". There are a few fields you'll need to fill out:

  • Authorization URL: this is your Zendesk subdomain + /oauth/authorizations/new. For us, it's https://retooldocs.zendesk.com/oauth/authorizations/new
  • Access Token URL: this is your Zendesk subdomain + /oauth/tokens. For us, it's https://retooldocs.zendesk.com/oauth/tokens
  • Client ID: this is the Unique Identifier you provided when you created your client application in Zendesk. For us, it's retool
  • Client Secret: this is the secret token Zendesk provided when you created your client application
  • Scopes: you can provide a list of scopes for authorization, separated by a space. For our application, we've chosen read write

Finally, you'll need to add a Header to your request that references Retool's magic OAUTH2_TOKEN variable that gets inserted at request time. It should look like Authorization: Bearer OAUTH2_TOKEN. Here's what the final setup should look like:

You can test the OAuth flow by clicking the "Test OAuth integration with your own account" button, or do so in your query when you choose this resource from the dropdown.

Basic query: getting tickets

Start by creating a new query in your query editor (“+ new”) and selecting your Zendesk API resource from the “Resource” dropdown. Our Base URL is pre-populated from when we created the resource, so we just need to append tickets.json to the end. Click preview, and you should see your results!

Server side pagination: getting tickets

You might have too many tickets to display in a Retool table without overloading the frontend. Retool supports server side pagination with table components, so you can re-run your request every time a user switches pages. To get started, we've built a basic GET query that lists our tickets from the tickets.json endpoint. You can pull that data into a table component by referencing the query's data: in our case, {{ getTickets.data.tickets }}.

Zendesk's tickets endpoint supports multiple methods for pagination - in this tutorial, we're going to use limit-offset.

1. Update the table settings

To get started, click on your table component, head over to the right sidebar, and scroll down to the "Pagination" section. Toggle "Server side paginated" on, and select "Limit offset based" from the dropdown. In the "Number of rows in this table" field, reference the count field from the getTickets query with {{ getTickets.data.count }}. You can leave the "Selected page" field at the default.

2. Update the query

Once the table is configured, head over to your getTickets query (or whatever you've named it). You'll need to add two URL Parameters. We've named our table table1, so if you've updated your table name, you'll need to adjust this code accordingly.

  • per_page = {{ table1.pageSize }}
  • page = {{ table1.selectedPageIndex + 1 }}

Save your query, and you should be good to go. Here's what the final setup should look like:

Build a mobile field sales app

· 9 min read

Field sales mobile app

A common use case for Retool Mobile is sales account management, enabling sales representatives in the field to manage accounts and opportunities wherever they are. This tutorial explains how to build a field sales mobile app for users to: browse, filter, and edit opportunities.

Build a mobile inventory management app

· 12 min read

Inventory management mobile app

Retool Mobile enables you to build native mobile apps that interact with your data and deploy them to your workforce.

A common use case for Retool Mobile is inventory management, enabling workers to look up product information in any warehouse, wherever they are. This tutorial explains how to build an inventory management mobile app for users to:

  • Browse, filter, and view details of products across all warehouses.
  • Browse and view details of warehouses, and look up available products at the location.
  • Quickly look up product information by scanning a barcode.

Automate ETL tasks with Workflows

· 10 min read

ETL workflow

A common use case for Retool Workflows is to automate ETL tasks. Retool apps can query data from a variety of sources but it's much more efficient to prepare data outside of the frontend application.

This tutorial explains how to build an ETL workflow that:

  • Extracts account data from Salesforce and transform it using JavaScript.
  • Upserts the transformed data into a PostgreSQL database.
  • Reads behavioral event data from a Google Sheet.
  • Aggregates event data at an account level.
  • Upserts aggregate event counts into a PostgreSQL database alongside account data.

The transformed data is then available to all Retool apps without the need for complex queries that run every time the app launches.

Automate incident notifications with Workflows

· 13 min read

Incident alert workflow

A common use case for Retool Workflows is to automatically alert on-call engineers and customer account managers if an incident occurs that is affecting customers, such as a service outage or downtime.

This tutorial explains how to build a notification workflow that:

  • Runs automatically in response to a webhook event that occurs whenever an incident is logged in Intercom.
  • Creates a ticket in Linear and assigns it to the on-call engineer for the affected product area.
  • Notifies the customer's account manager on Slack.
  • Evaluates the severity level to determine if the incident is urgent. If so, the workflow creates an incident in PagerDuty for escalation.

Automate metrics reporting with Workflows

· 8 min read

Metrics reporting workflow

A common use case for Retool Workflows is to automatically compile metrics and generate reports by aggregating data from various sources.

This tutorial explains how to build a daily reporting workflow that:

  • Retrieves opportunity, sales, and pipeline data from Salesforce.
  • Retrieves monthly targets from a PostgreSQL database.
  • Transforms and aggregates data using JavaScript.
  • Sends HTML-formatted email reports using SMTP.
  • Sends Slack notifications about any targets not currently met.

Automate trial expiration offers with Workflows

· 7 min read

Automate trial expiration offers

A common use case for Retool Workflows is to automate ETL (extract, transform, and load) tasks that transform and process data. Retool apps can directly interact with data from a variety of sources but it's much more efficient to automate ETL tasks than perform them in a frontend application.

This tutorial explains how to build a daily ETL and notification workflow that:

  • Retrieves a list customers from a REST API.
  • Filters results to exclude customers with personal email addresses and whose trial does not expire within 24 hours.
  • Looks up data on company size using filtered email addresses with Clearbit.
  • Sends a special offer email using SMTP to customers at companies with fewer than 50 employees.
  • Notifies the Sales team in Slack of expiring trials for customers at companies with more than 50 employees.