diff --git a/daprdocs/content/en/reference/components-reference/supported-bindings/sendgrid.md b/daprdocs/content/en/reference/components-reference/supported-bindings/sendgrid.md index 2b6dddc6e7a..5463a753a9a 100644 --- a/daprdocs/content/en/reference/components-reference/supported-bindings/sendgrid.md +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/sendgrid.md @@ -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 ``` @@ -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 @@ -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": "

Testing Dapr Bindings

This is a test.
Bye!" +} +``` + ## Related links - [Basic schema for a Dapr component]({{% ref component-schema %}})