Twilio SendGrid binding spec

Detailed documentation on the Twilio SendGrid binding component

Component format

To setup Twilio SendGrid binding create a component of type bindings.twilio.sendgrid. See this guide on how to create and apply a binding configuration.

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: sendgrid
  5. spec:
  6. type: bindings.twilio.sendgrid
  7. version: v1
  8. metadata:
  9. - name: emailFrom
  10. value: "testapp@dapr.io" # optional
  11. - name: emailFromName
  12. value: "test app" # optional
  13. - name: emailTo
  14. value: "dave@dapr.io" # optional
  15. - name: emailToName
  16. value: "dave" # optional
  17. - name: subject
  18. value: "Hello!" # optional
  19. - name: emailCc
  20. value: "jill@dapr.io" # optional
  21. - name: emailBcc
  22. value: "bob@dapr.io" # optional
  23. - name: dynamicTemplateId
  24. value: "d-123456789" # optional
  25. - name: dynamicTemplateData
  26. value: '{"customer":{"name":"John Smith"}}' # optional
  27. - name: apiKey
  28. value: "YOUR_API_KEY" # required, this is your SendGrid key
  29. - name: direction
  30. value: "output"

Warning

The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described here.

Spec metadata fields

FieldRequiredBinding supportDetailsExample
apiKeyYOutputSendGrid API key, this should be considered a secret value“apikey”
emailFromNOutputIf set this specifies the ‘from’ email address of the email message. Only a single email address is allowed. Optional field, see below“me@example.com”
emailFromNameNOutputIf set this specifies the ‘from’ name of the email message. Optional field, see below“me”
emailToNOutputIf set this specifies the ’to’ email address of the email message. Only a single email address is allowed. Optional field, see below“me@example.com”
emailToNameNOutputIf set this specifies the ’to’ name of the email message. Optional field, see below“me”
emailCcNOutputIf set this specifies the ‘cc’ email address of the email message. Only a single email address is allowed. Optional field, see below“me@example.com”
emailBccNOutputIf set this specifies the ‘bcc’ email address of the email message. Only a single email address is allowed. Optional field, see below“me@example.com”
subjectNOutputIf set this specifies the subject of the email message. Optional field, see below“subject of the email”
directionNOutputThe direction of the binding“output”

Binding support

This component supports output binding with the following operations:

  • create

Example request payload

You can specify any of the optional metadata properties on the output binding request too (e.g. emailFrom, emailTo, subject, etc.)

  1. {
  2. "operation": "create",
  3. "metadata": {
  4. "emailTo": "changeme@example.net",
  5. "subject": "An email from Dapr SendGrid binding"
  6. },
  7. "data": "<h1>Testing Dapr Bindings</h1>This is a test.<br>Bye!"
  8. }

Dynamic templates

If a dynamic template is used, a dynamicTemplateId needs to be provided and then the dynamicTemplateData is used:

  1. {
  2. "operation": "create",
  3. "metadata": {
  4. "emailTo": "changeme@example.net",
  5. "subject": "An template email from Dapr SendGrid binding",
  6. "dynamicTemplateId": "d-123456789",
  7. "dynamicTemplateData": "{\"customer\":{\"name\":\"John Smith\"}}"
  8. }
  9. }

Last modified October 12, 2023: Update config.toml (#3826) (0ffc2e7)