From 76dd591dd044baca50843c4b962f6476bf255d9d Mon Sep 17 00:00:00 2001 From: Yann Nicolas Date: Tue, 16 May 2023 23:06:51 -0400 Subject: [PATCH 1/3] Add dynamic template support to Twilio Sendgrid binding Signed-off-by: Yann Nicolas --- .../supported-bindings/sendgrid.md | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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 8a82f2f61c7..f4300652c02 100644 --- a/daprdocs/content/en/reference/components-reference/supported-bindings/sendgrid.md +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/sendgrid.md @@ -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,19 @@ You can specify any of the optional metadata properties on the output binding re } ``` +If a dynamic template is used, the template id needs to be used and if provided, the template data 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 >}}) From c8df8ec12a0a5c237172ba658f73ea4c6b03716c Mon Sep 17 00:00:00 2001 From: Yann Nicolas Date: Wed, 17 May 2023 00:13:26 -0400 Subject: [PATCH 2/3] Put dynamic template in its own section per code review suggestion Signed-off-by: Yann Nicolas --- .../components-reference/supported-bindings/sendgrid.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 f4300652c02..a7a68f32386 100644 --- a/daprdocs/content/en/reference/components-reference/supported-bindings/sendgrid.md +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/sendgrid.md @@ -83,7 +83,8 @@ You can specify any of the optional metadata properties on the output binding re } ``` -If a dynamic template is used, the template id needs to be used and if provided, the template data is used: +## Dynamic templates +If a dynamic template is used, a `dynamicTemplateId` needs to be provided and then the `dynamicTemplateData` is used: ```json { From 17a8c84349b7658545697b3e2f4835a18feff607 Mon Sep 17 00:00:00 2001 From: Yann Nicolas Date: Thu, 18 May 2023 00:00:24 +0200 Subject: [PATCH 3/3] Fix JSON example Signed-off-by: Yann Nicolas --- .../components-reference/supported-bindings/sendgrid.md | 1 + 1 file changed, 1 insertion(+) 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 a7a68f32386..a2eb4961f73 100644 --- a/daprdocs/content/en/reference/components-reference/supported-bindings/sendgrid.md +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/sendgrid.md @@ -96,6 +96,7 @@ If a dynamic template is used, a `dynamicTemplateId` needs to be provided and th "dynamicTemplateData": "{\"customer\":{\"name\":\"John Smith\"}}" } } +``` ## Related links