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:
To connect your PostgreSQL account to Zapier you will need an active PostgreSQL, and a database that you wish to pull data from. To get started with PostgreSQL, including information on how to install the program and how to create a database, go here. You can learn more about getting started with PostgreSQL on Zapier, here.
To link your PostgreSQL to SendGrid, you must have an active SendGrid account. To learn more about getting started with SendGrid basics, start here. For more information about getting started with SendGrid on Zapier, go here.
- 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 SendGrid account to Zapier for the first time, you will enter the credentials of an API/mail account. If you have not created this account, you can do so here.
- 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.
Now test the Zap to make sure it works. Once you’re satisfied with the results, a new SendGrid email will be sent whenever your custom query is matched in your PostgreSQL.
Note: if you ever want to change this PostgreSQL and SendGrid integration, just go to your Zapier dashboard and tweak anything you’d like.