Merge pull request #3422 from yannart/sendgrid-dynamic-template

Add dynamic template support to Twilio Sendgrid binding
This commit is contained in:
Hannah Hunter 2023-06-21 09:34:49 -04:00 committed by GitHub
commit 942d9cc8f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 1 deletions

View File

@ -35,6 +35,10 @@ spec:
value: "jill@dapr.io" # optional
- name: emailBcc
value: "bob@dapr.io" # optional
- name: dynamicTemplateId
value: "d-123456789" # optional
- name: dynamicTemplateData
value: '{"customer":{"name":"John Smith"}}' # optional
- name: apiKey
value: "YOUR_API_KEY" # required, this is your SendGrid key
```
@ -55,7 +59,8 @@ 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"` |
| dynamicTemplateId | N | Output | If set this specifies the dynamic template id. Optional field, see [below](#example-request-payload) | `"d-123456789"` |
| dynamicTemplateData | N | Output | If set this specifies the dynamic template data. Optional field, see [below](#example-request-payload) | `'{"customer":{"name":"John Smith"}}'` |
## Binding support
@ -78,6 +83,21 @@ You can specify any of the optional metadata properties on the output binding re
}
```
## Dynamic templates
If a dynamic template is used, a `dynamicTemplateId` needs to be provided and then the `dynamicTemplateData` is used:
```json
{
"operation": "create",
"metadata": {
"emailTo": "changeme@example.net",
"subject": "An template email from Dapr SendGrid binding",
"dynamicTemplateId": "d-123456789",
"dynamicTemplateData": "{\"customer\":{\"name\":\"John Smith\"}}"
}
}
```
## Related links
- [Basic schema for a Dapr component]({{< ref component-schema >}})