Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ spec:
value: "d-123456789" # optional
- name: dynamicTemplateData
value: '{"customer":{"name":"John Smith"}}' # optional
- name: trackingSettings
value: '{"click_tracking":{"enable":true},"open_tracking":{"enable":true}}' # optional
- name: apiKey
value: "YOUR_API_KEY" # required, this is your SendGrid key
```
Expand All @@ -59,6 +61,7 @@ The above example uses secrets as plain strings. It is recommended to use a secr
| `emailCc` | N | Output | If set this specifies the 'cc' email address of the email message. Only a single email address is allowed. Optional field, see [below](#example-request-payload) | `"me@example.com"` |
| `emailBcc` | N | Output | If set this specifies the 'bcc' email address of the email message. Only a single email address is allowed. Optional field, see [below](#example-request-payload) | `"me@example.com"` |
| `subject` | N | Output | If set this specifies the subject of the email message. Optional field, see [below](#example-request-payload) | `"subject of the email"` |
| `trackingSettings` | N | Output | If set this specifies the [SendGrid tracking settings](https://www.twilio.com/docs/sendgrid/api-reference/mail-send/mail-send#request-body) for the email message, as a JSON object using SendGrid API field names (`click_tracking`, `open_tracking`, `subscription_tracking`, `ganalytics`). Can also be set per request; request-level settings override the component-level value. Optional field, see [below](#email-tracking-settings) | `'{"click_tracking":{"enable":true},"open_tracking":{"enable":true}}'` |

## Binding support

Expand Down Expand Up @@ -96,6 +99,22 @@ If a dynamic template is used, a `dynamicTemplateId` needs to be provided and th
}
```

## Email tracking settings

Email tracking can be configured with the `trackingSettings` metadata field, either on the component (shown [above](#component-format)) or per request. The value is a JSON object using the field names from the [SendGrid mail send API](https://www.twilio.com/docs/sendgrid/api-reference/mail-send/mail-send#request-body): `click_tracking`, `open_tracking`, `subscription_tracking`, and `ganalytics`. When set on the request, it overrides the component-level value:

```json
{
"operation": "create",
"metadata": {
"emailTo": "changeme@example.net",
"subject": "An email from Dapr SendGrid binding",
"trackingSettings": "{\"click_tracking\":{\"enable\":true,\"enable_text\":true},\"open_tracking\":{\"enable\":true},\"subscription_tracking\":{\"enable\":false},\"ganalytics\":{\"enable\":true,\"utm_source\":\"transactional-email\",\"utm_medium\":\"email\"}}"
},
"data": "<h1>Testing Dapr Bindings</h1>This is a test.<br>Bye!"
}
```

## Related links

- [Basic schema for a Dapr component]({{% ref component-schema %}})
Expand Down