You can use Sequin to build Jet Admin apps on top of APIs like Salesforce and HubSpot. Sequin will sync your API data to a Postgres database so you can write your integration in SQL. Changes you make to your database records will be applied to the API and your database at the same time.

While Jet Admin has connectors for APIs, it’s much faster to build with Jet Admin’s Postgres adapter. You don’t have to worry about rate limits and SQL is both familiar and expressive.

Setup a Sequin sync

Before you can use Sequin with Jet Admin, you’ll need to create a sync. Sequin will guide you through authenticating, selecting the data you want to sync, and connecting to your database. Read our getting started guide for step-by-step instructions.

Create a Jet Admin Resource

A data source in Jet Admin is a connection to a database or API.

Sequin uses a Postgres Proxy to interface with your Sequin-synced tables. The Proxy lets Sequin capture inserts, updates, and deletes you make in your database and commit them to the API.

To add Sequin’s Postgres Proxy as a Jet Admin resource, you can treat it as a regular Postgres database and enter the connection details in the resource configuration:

Step 1: Go to your Jet Admin application dashboard and select Data from the side menu.

Step 2: Click Add Resource. From the new page, select PostgreSQL.

Step 3: This opens up a new configuration menu. Give it a name and paste the values for host, database name, database username, and database password from the Connection instructions tab of your Sequin dashboard:

You can use the connection instructions to connect your service to Sequin.

Step 4: Click Choose Tables. Select the tables you want to work with. Finally, click Add Resource.

Using the Postgres resource in Jet Admin

Now, Sequin is syncing your API data to Postgres. You’ve also connected Jet Admin to Postgres via Sequin’s Proxy. To query this data in your Jet Admin app, go back to your Jet Admin dashboard and select your app:

Step 1: Click on the Data from the side menu.

Step 2: Click on your PostgreSQL in the Connected Resources.

Step 3: Click + Create with SQL Query to create a new SQL collection.

Step 4: Give the SQL collection a name.

Step 5: Enter a query to retrieve your data.

For instance, if you were using the Bug Tracker template on Airtable, you can use the following query to retrieve a list of bugs:

select bugs_and_issues.id, bugs_and_issues.name, bugs_and_issues.description, bugs_and_issues.priority, bugs_and_issues.status, bugs_and_issues.created_time, tm1.name as reported_by, tm2.name as assigned_to from bugs_and_issues
join team_members as tm1 on created_by[1] = tm1.id
left join team_members as tm2 on assigned_to[1] = tm2.id

Writing back to the API

With Sequin, you can also make mutations via your database. Inserts, updates, and deletes you make to Sequin-synced tables are first applied to the API. If they pass validation, they’re committed to your database.

To write your first mutation query, click Data from the side menu and select your PostgreSQL resource. Then, create a new SQL query.

When creating a new mutation query, you can choose the Run SQL operation to write your own SQL query.

Alternatively, if you don’t want to write a SQL query on your own you can add the basic create, update, and delete Actions from your GUI components. Learn more about Actions in Jet Admin.

Continuing with the bug tracker example, the query below allows a user to update the details of a bug selected in the table component using a Run SQL query:

Adding SQL mutation in Jet Admin.

note

Jet Admin allows you to map the inputs to the values coming from your application. Learn more about inputs, outputs and parameters.

Displaying Errors

When Sequin’s Proxy encounters an error trying to apply your mutation in the upstream API, the Proxy returns a standard Postgres error. There’s no additional configuration required on Jet Admin to display these errors since Sequin’s Proxy returns a standard API response message containing the Postgres error.

Displaying Postgres error in Jet Admin.

Next steps

You can now use Jet Admin to build on top of sources like Salesforce, Airtable, and HubSpot. If you have any questions, please reach out to us.

Was this page helpful?