Setup a Sequin sync
Before you can use Sequin with Appsmith, 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 Appsmith Resource
A datasource in Appsmith is a connection to a resource like Postgres. 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 an Appsmith datasource, you can treat it as a regular Postgres resource and enter the connection details in the datasource configuration: Step 1: Go to your Appsmith dashboard and find âDatasourcesâ on the left rail. Click on the plus icon. Step 2: Select PostgreSQL. Step 3: This opens up a new configuration page. 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.
Using the Postgres datasource in Appsmith
Now, Sequin is syncing your API data to Postgres. Youâve also connected Appsmith to Postgres via Sequinâs Proxy. To query this data in your Appsmith app, go back to your Appsmith dashboard and select your app: Step 1: From the Appsmith dashboard, click âEditâ on your app. Step 2: Find âQueries/JSâ on the left rail. Click on the plus icon. Step 3: In the list of datasources, select the Postgres connection to Sequin. Step 4: Compose your query. The schema for your Sequin-synced tables is available on the right rail. Step 5: Click âRunâ in the top right to make sure your query runs as expected. Hereâs an example Salesforce query that finds all the Salesforce Contacts belonging to a given account:Writing back to the API
With Sequin, you can also make mutations via your database as well. 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, find âQueries/JSâ on the left rail again and click on the plus icon. You can compose aninsert
query by populating values
with various input fields in your application. For example, if you have a form with inputs named first_name
, last_name
, and email
, the corresponding insert
query would look like this:
[your_query]
.â Now, when the user clicks the âSubmitâ button on the form, Appsmith will execute the insert query:

Errors
When Sequinâs Proxy encounters an error trying to apply your mutation in the upstream API, the Proxy returns a standard Postgres error. You can configure your app to display this as an alert notification: Step 1: Select the formâs âSubmitâ button. Find âonClickâ in the right rail. Under callbacks, click â+â to add an âon failureâ callback. Step 2: In the âConfigure actionâ popover, set âActionâ to âShow alert.â Set the âMessageâ to{{[your_query].data}}
.
Now, if a user attempts to perform an insert and it fails, theyâll see the validation error that was returned by Salesforce:
