# SendGrid

> Send emails and manage your marketing contacts in SendGrid.

App · Email · 6 actions. Web page: https://docs.lodol.com/docs/integrations/sendgrid

## Actions

### Add contact to list

Add contacts to a SendGrid marketing list.

**Inputs**

- Email (`email`, text, required): Contact email address to add.
- List IDS (`list_ids`, list, required): Marketing list IDs to add the contact to.

**Outputs**

- `result` (object)

**Example output**

```json
{
  "result": {
    "job_id": "job_987"
  }
}
```

### Create marketing list

Create a marketing list for SendGrid contacts.

**Inputs**

- Name (`name`, text, required): List name.

**Outputs**

- `result` (object)

**Example output**

```json
{
  "result": {
    "contact_count": 0,
    "id": "list_789",
    "name": "My List"
  }
}
```

### Get email stats

Retrieve SendGrid email statistics for a date range.

**Inputs**

- Start date (`start_date`, text, required): Start date (YYYY-MM-DD).
- End date (`end_date`, text, required): End date (YYYY-MM-DD).

**Outputs**

- `result` (object)

**Example output**

```json
{
  "result": {
    "stats": [
      {
        "date": "2024-01-01",
        "stats": [
          {
            "metrics": {
              "clicks": 10,
              "delivered": 95,
              "opens": 50,
              "requests": 100
            }
          }
        ]
      }
    ]
  }
}
```

### List templates

List SendGrid email templates.

**Inputs**: None.

**Outputs**

- `result` (object)

**Example output**

```json
{
  "result": {
    "result": [
      {
        "id": "tmpl_123",
        "name": "Welcome Email"
      }
    ]
  }
}
```

### Send email

Send an email through SendGrid.

**Inputs**

- From email (`from_email`, text, required): Sender email address.
- To email (`to_email`, text, required): Recipient email address.
- Subject (`subject`, text, required): Email subject.
- Text content (`text_content`, text, required): Plain text email content.
- HTML content (`html_content`, text): Optional HTML email content.
- CC (`cc`, list): Optional CC email addresses.
- BCC (`bcc`, list): Optional BCC email addresses.

**Outputs**

- `result` (object)

**Example output**

```json
{
  "result": {
    "status_code": 202
  }
}
```

### Send template email

Send an email built from a saved SendGrid template.

**Inputs**

- From email (`from_email`, text, required): Sender email address.
- To email (`to_email`, text, required): Recipient email address.
- Template ID (`template_id`, text, required): The ID of the SendGrid template to use.
- Template values (`dynamic_data`, object): Values to fill into the template's placeholders.

**Outputs**

- `result` (object)

**Example output**

```json
{
  "result": {
    "status_code": 202
  }
}
```
