beam-community / bamboo

Testable, composable, and adapter based Elixir email library for devs that love piping.
https://hex.pm/packages/bamboo
MIT License
1.9k stars 343 forks source link

Bugfix: Change "enabled" to "enable" to conform to SendGrid API. #624

Closed danadaldos closed 2 years ago

danadaldos commented 2 years ago

Problem

A recent PR added click tracking support for the SendGrid adapter. Unfortunately, we didn't catch a typo that sends "enabled" as the param instead of "enable" as is recognized by the API. This results in the following error:

"{\"errors\":[{\"message\":\"The click_tracking enable parameter is required.\",\"field\":\"tracking_settings.click_tracking.enable\",\"help\":\"http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.tracking_settings.click_tracking.enable\"}]}"

with these params:

"tracking_settings" => %{"click_tracking" => %{"enable_text" => false, "enabled" => false}

Where it says "enabled" => false in the params, it should say "enable" => false

Solution

Fix the typo and update the tests.

danadaldos commented 2 years ago

@sreecodeslayer Please give this a review when you get a chance as it may also be affecting your applications.

sreecodeslayer commented 2 years ago

What 🤔 Well that is interesting, seems like the doc here is then outdated or mistyped 😄 This one here says its supposed to be enabled : https://sendgrid.api-docs.io/v3.0/settings-tracking/settings-click-tracking

danadaldos commented 2 years ago

@sreecodeslayer Yeah, that is weird, on the official docs it's definitely enable. Looks like the docs hosted on api-docs.io are inaccurate.

image

danadaldos commented 2 years ago

@germsvel - I hate to "at" you again here, but would you be willing to merge this fix?