Sending SendGrid Emails For New PostgreSQL Custom Query Row Matches
If you want to send emails automatically through SendGrid when new custom PostgreSQL rows are created, you can do that using Zapier.
You will need:
- a PostgreSQL account
- a SendGrid account
- a Zapier account
- To connect your PostgreSQL account to Zapier, you need an active PostgreSQL database to pull data from.
- To install PostgreSQL and create a database, see the PostgreSQL tutorial.
- To learn more, see how to get started with PostgreSQL on Zapier.
To link your PostgreSQL database to Twilio SendGrid, you must have an active Twilio SendGrid account. To learn more, see the Twilio SendGrid API reference and how to get started with Twilio SendGrid on Zapier.
To begin, open the Send SendGrid emails for new PostgreSQL custom query row matches Zap.
- Choose your PostgreSQL account from the list of accounts, or connect a new account.
- To connect a new account, you will need the IP address or hostname of where your database is. Input this data in the Host field, indicate if you use an alternate Port, and fill in the Database and Username fields with the appropriate data. You may also need to fill out the Password field if your database user requires it.

- Create or fill in the Custom Query you wish to use. Click Save + Continue.

- Choose your SendGrid account from the list of accounts, or connect a new account.
- To connect your Twilio SendGrid account to Zapier for the first time, enter your API key. If you haven't created an API key, go to the API Keys page in the Twilio SendGrid Console.
- Using fields from PostgreSQL, create and customize the email message that the Zap will send. The required fields for this step are To, From, and Subject, but you may fill in further fields if you desire to do so.

- Click Save + Finish.
Test the Zap. When the Zap is active, matching PostgreSQL rows trigger emails through Twilio SendGrid.
Info
If you ever want to change this PostgreSQL and SendGrid integration, just go to your Zapier dashboard and tweak anything you'd like.
You can also check out all that's possible with PostgreSQL on Zapier, and other ways to connect PostgreSQL and SendGrid.