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:

Steps

  1. Getting your accounts ready
  2. Connecting your accounts

Getting your accounts ready

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.

Connecting your accounts

Click here to Send SendGrid emails for new PostgreSQL custom query row matches.

  1. Choose your PostgreSQL account from the list of accounts, or connect a new account.
  2. 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. Connecting PostgreSQL
  3. Create or fill in the Custom Query you wish to use. Click Save + Continue. PostgreSQL selection
  4. Choose your SendGrid account from the list of accounts, or connect a new account.
  5. 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. Credential entry
  6. 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. Email creation
  7. 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.

You can also check out all that’s possible with PostgreSQL on Zapier, and other ways to connect PostgreSQL and SendGrid.