SendGrid Provider

SendGridProvider is a class that implements the SendGrid API and allows email sending through Keep.

Inputs

The notify function of SendGridProvider takes the following arguments:

  • to (str): Required. The email address of the recipient.
  • subject (str): Required. The subject of the email.
  • html (str): Required. The HTML body of the email.
  • **kwargs (optional): Additional optional parameters can be provided as key-value pairs.

See documentation for more details.

Outputs

The notify function of SendGridProvider outputs the following format (example):

{
  "status_code": 202,
  "body": "",
  "headers": {
    "X-Message-Id": "G9RvW0ONQ0uK7eRfhHfZTQ"
  }
}

See documentation for more details.

Authentication Parameters

The SendGrid provider requires the following authentication parameters:

  • api_key: Required. SendGrid API key. You can obtain an API key by visiting SendGrid API Keys.
  • from_email: Required. The email address from which the email is sent.

Connecting with the Provider

To connect with the SendGrid provider and send emails through Keep, follow these steps:

  1. Obtain a SendGrid API key: Visit SendGrid API Keys to obtain an API key if you don’t have one already.
  2. Configure the SendGrid provider in your system with the obtained API key and the from_email address.
  3. Use the following YAML example to send an email notification using the SendGrid provider:
title=examples/alert_example.yml
# Send an email notification using the SendGrid provider.
alert:
  id: email-notification
  description: Send an email notification using SendGrid
  actions:
    - name: send-email
      provider:
        type: sendgrid
        config: "{{ providers.sendgrid-provider }}"
        with:
          to: "[email protected]"
          subject: "Hello from SendGrid Provider"
          html: "<p>This is the email body.</p>"