SendGrid Reference
Supported objects
SendGrid offers an extensive API for email operations. Here is a list of objects we support:
Collection Name | Read | Write |
---|---|---|
Mail Send | ✅ | ✅ |
Contacts | ✅ | ✅ |
Custom Fields | ✅ | ✅ |
Lists | ✅ | ✅ |
Marketing Campaign Stats | ✅ | |
Segments | ✅ | ✅ |
Single Sends | ✅ | ✅ |
Security | ✅ | ✅ |
Settings | ✅ | ✅ |
Templates | ✅ | ✅ |
Need a SendGrid object we’re not syncing? We can add it quickly. Send us a note.
Setup & Installation
Sequin authenticates to your SendGrid data using an API Key.
To authenticate with SendGrid:
- Generate an API Key in your SendGrid account.
- Copy and paste the API Key into the Sequin UI.
Please refer to the official SendGrid documentation for detailed steps and guidelines on generating and managing API keys.
The Syncing Process
We first backfill your Postgres database with the SendGrid data you’ve selected. The time for the backfill is dependent upon the amount of data you want to sync. Unless your SendGrid account has over a million records, the backfill should complete in under an hour. Smaller accounts finish in a few minutes. We’ll email you when your backfill is complete.
After the initial backfill, we make use of webhooks to ensure all changes in SendGrid are synced instantly. We use occasional polling to make sure we don’t miss any changes. This means that changes in SendGrid should show up in your database in a matter of seconds.
Sequin ensures that the upstream API is always the source of truth.
Learn more about our syncing process.
Read and write SendGrid data using SQL
You’ll connect to your database via Sequin’s Postgres Proxy, which lets you read from your synced tables as well as write to them. You can use any SQL client that works with Postgres.
Here’s an example of what one of your SendGrid tables might look like in your database:
You’ll see all the SendGrid objects you selected when setting up your sync are now tables in your database. You’ll also see a _sync_cdc
table which Sequin uses to manage your sync.
Here’s what it looks like to query the templates
table:
Which returns a row that looks like:
Updating a SendGrid template is as simple as writing a SQL query. For example, to change the name of the template we just selected, you can write a query like this:
Sequin will write this change to both SendGrid and your database at the same time.
If a write to SendGrid fails, Sequin will roll back the write to your database. For example, if you try to update a template’s name to be an integer, you’ll receive a Postgres error:
Next steps
Your SendGrid tables are now available as fully readable and writeable tables in your database. You can query for all your data using SQL, and mutate data thanks to Sequin’s Postgres Proxy. To build on this foundation, here are some next steps:
- Setup your ORM to work with your synced tables.
- Edit the SendGrid objects and properties you’re syncing at any time.
- Create views on your SendGrid data to tailor your schema to your needs.
- Invite your team to your Sequin account and start building!
If you need assistance setting up your sync, just send us a note. We’re around and eager to help.
Troubleshooting
- If you encounter any errors during the installation or syncing processes, please reach out.