Skip to content

feat(bindings/twilio/sendgrid): add trackingSettings support - #4456

Open
chadncampbell wants to merge 2 commits into
dapr:mainfrom
chadncampbell:feat/sendgrid-tracking-settings
Open

feat(bindings/twilio/sendgrid): add trackingSettings support#4456
chadncampbell wants to merge 2 commits into
dapr:mainfrom
chadncampbell:feat/sendgrid-tracking-settings

Conversation

@chadncampbell

@chadncampbell chadncampbell commented Jul 14, 2026

Copy link
Copy Markdown

Description

Adds support for SendGrid tracking_settings to the Twilio SendGrid output binding.

  • New optional trackingSettings metadata field (component-level), accepting a JSON object using SendGrid API field names: click_tracking, open_tracking, subscription_tracking, ganalytics
  • Same field supported as per-request metadata on Invoke; request-level settings override component-level
  • Component-level settings are parsed once at init and cached
  • Invalid JSON fails fast: at Init for component metadata, at Invoke for request metadata
  • Updated metadata.yaml with field description and example

Testing

In addition to the unit tests, manually verified the binding end-to-end against the live SendGrid API using a small script that invokes the binding directly:

  • Without trackingSettings set: no tracking settings are included in the API request, so the SendGrid account-level tracking configuration applies (existing behavior unchanged)
  • With trackingSettings set: email sends with the configured tracking settings applied (confirmed by inspecting the raw email data)

Issue reference

#4455

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

@chadncampbell
chadncampbell requested review from a team as code owners July 14, 2026 16:22
Allow configuring SendGrid tracking_settings (click_tracking,
open_tracking, subscription_tracking, ganalytics) via component
metadata or per-request metadata; request-level overrides component.

Signed-off-by: Chad Campbell <ccampbell@rechargeapps.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for SendGrid tracking_settings in the Twilio SendGrid output binding, allowing tracking configuration to be set at the component level and overridden per request.

Changes:

  • Added trackingSettings metadata field with init-time parsing and caching.
  • Applied resolved tracking settings to outgoing SendGrid V3 email requests during Invoke.
  • Added unit tests for parsing/unmarshalling tracking settings and updated component metadata documentation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
bindings/twilio/sendgrid/sendgrid.go Adds trackingSettings metadata, caches parsed settings, and applies tracking settings to outbound emails.
bindings/twilio/sendgrid/sendgrid_test.go Adds tests for parsing and unmarshalling trackingSettings.
bindings/twilio/sendgrid/metadata.yaml Documents the new trackingSettings metadata field with description and example.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +226 to +236
// Build email tracking settings, this is optional
var trackingSettings *mail.TrackingSettings
if req.Metadata["trackingSettings"] != "" {
var trackingError error
trackingSettings, trackingError = UnmarshalTrackingSettings(req.Metadata["trackingSettings"])
if trackingError != nil {
return nil, trackingError
}
} else if sg.metadata.trackingSettingsCache != nil {
trackingSettings = sg.metadata.trackingSettingsCache
}
Comment thread bindings/twilio/sendgrid/sendgrid.go Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Chad Campbell <ccampbell@rechargeapps.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants