Skip to content

Attempting to provide custom_args json object for A/B testing #504

Description

@campgurus

But SendGrid seems not to be seeing the custom args. Category is conveyed as expected. Here is the send_email action:

def send_email(daily_content)

# Get A/B test subject line and metadata
ab_test = SubjectLineAbTestingService.new(@user).generate_subject_line_test
daily_content.subject = ab_test[:subject]

mail(
  to: @user.email,
  subject: ActionView::Base.full_sanitizer.sanitize(daily_content.subject).to_s
) do |format|
  format.html

  # Add SendGrid headers
  headers['X-SMTPAPI'] = {
    "category": ["daily_stats"],
    "custom_args": {
      "variation_id": ab_test[:variation],
      "total_variations": ab_test[:total_variations],
      "user_id": @user.id.to_s
    }
  }.to_json
end

end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions