Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with Handlebars templates #37

Open
jlovison opened this issue May 7, 2015 · 3 comments
Open

Incompatible with Handlebars templates #37

jlovison opened this issue May 7, 2015 · 3 comments

Comments

@jlovison
Copy link

jlovison commented May 7, 2015

I was having some trouble getting this library to work with templates that were using handlebars for Mandrill.

After looking into the issue, it seems like the root of the issue is that Handlebars expects the variables to be structured slightly differently from the way gochimp is structuring them.

As mentioned in the blog post, a handlebars template expects pure key/value pairs to be in global_merge_vars, and expects {email: {key: value}} pairs for the merge_vars paramater.

Whereas the TemplateRender in gochimp seems to hand off two paramaters, content and merge_vars, both of which are simple key/value pairs.

(This is my best estimation as to why I was getting blank variables in my templates, and will be investigating further in the next few days, but the above seems like it could be the root of the issue).

@jlovison
Copy link
Author

jlovison commented May 7, 2015

Hmmm...there seems to be a conflict with the API Mandrill has laid out, which does not have a provison for a "global_merge_vars" in the template render request. I'm at a loss for where the disconnect is.

@saito-sv
Copy link

@jlovison did you ever figure it out? I'm trying to use handlebars with this but I also getting blank vals

@jlovison
Copy link
Author

Wow, flash from the past...

@Marlon-Monroy it's been a while and I switched away from Mandrill a while ago, so I don't remember exactly, but IIRC, I just put the keys and values into the merge_vars map, which I think was made available for each email. So it doesn't have a global_merge_vars but the email specific merge vars are available for each.

But, take that with a grain of salt, as it's been two years since I touched any of this, and migrated away from the implementation probably at least a year ago.

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

No branches or pull requests

2 participants