I have a Ruby setup for sending out emails using Sendgrid dynamic templates - all works fine except each email has the same first_name content, rather than each email having the correct one (have double checked the array so it's not that!) Am I doing something wrong with the personalisations and add_dynamic_template_date method?
mail = SendGrid::Mail.new
mail.template_id = sendgrid_template_id # a non-legacy template id
mail.from = Email.new(email: INFO_EMAIL)
recipients.each do |r|
personalization = Personalization.new
personalization.add_dynamic_template_data(
first_name: r[:first_name]
)
personalization.add_to(Email.new(email: r[:email]))
mail.add_personalization(personalization)
end
They way I understand it is that dynamic template data gets added to each personalisation and it sends out the email that way - do I need to send individual emails separately to achieve this or something?
Thanks!