mattbaird / gochimp Goto Github PK
View Code? Open in Web Editor NEWGolang based client API for Mailchimp, including Mandrill
License: Apache License 2.0
Golang based client API for Mailchimp, including Mandrill
License: Apache License 2.0
Running go 1.5 here. Receiving this error when running client.MessageSend
.
panic: parse https://mandrillapp.com%2Fapi%2F/1.0/messages/send.json: percent-encoded characters in host
If you don't set TrackOpens
or TrackClicks
they are set to false and overriding mandrills default sending options.
Ie this happens even if you don't set them to false. Perhaps a NewMessage() func could fix this or adding functions to set them since they really have 3 values true, false, and none(default to mandrill settings).
When I create a new message where I leave out the fields Subject, FromEmail, FromName
, the values which I have set in Mandrill (https://mandrillapp.com/templates) are ignored.
Go snippet:
message := gochimp.Message{ Html: renderedTemplate, To: recipients, TrackClicks: true, TrackOpens: true, }
Mandrill template configuration:
My assumption is that gochimp is still sending an empty string via the Mandrill API. Omitting the field when it is not set might honor the predefined values in Mandrill.
When sending a transactional message with the mandrill API, there is a flag, view_content_link
, that can be set to tell mandrill to discard the sent message's content so that people who can access the logs can't click on "View content". This flag is true by default and must be hard-set to false.
However... the Message
struct declares this field with omitempty
, so you it won't be sent when set to false.
type Message struct {
// ...
ViewContentLink bool `json:"view_content_link,omitempty"`
// ...
}
Removing omitempty
would mean messages would always send view_content_link: false
, it's a go quirk, I'm not sure if there is an "elegant" way to fix this. Maybe with a pointer to bool?
Hi!
Thanks for the API wrapper looks good!
I checked out a API from mailchimp and tried the templatelist function. What am i missing ? Checked that is used the correct endpoint, but there seems to be no response unmarshaled into the listresponse.
chimp := gochimp.NewChimp("mykey", true)
mylist := gochimp.TemplatesList{}
mylist.ApiKey = "mykey"
mylist.Filters.IncludeDragAndDrop = true
myresp, err := chimp.TemplatesList(mylist)
if err != nil {
fmt.Print(err)
}
for _, val := range myresp.User {
fmt.Print(val.Id)
}
for _, val := range myresp.Gallery {
fmt.Print(val.Id)
}
Can't you just reuse the API key you used to create the ChimpAPI?
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).
I get this error using the example in README.md
:
$ go run gochimp.go
Error rendering template
The mail sends regardless, just with an empty message body. golang is 1.4.2 on Arch Linux.
Should go next to the description near the top... would be handy to have accessible.
I'm using mandrill for server-side transactional emails and I'm wondering if there is a way to forward the context.Context
object from my requests to the gochimp client or request. I couldn't find a way to do it in the API, is there one I missed? (Couldn't find any issues on this either)
If not, would it be possible to add a way?
Cheers!
any plan to support for mailchimp api v3.0?
Thanks
Trying to BCC multiple people, but the Message's BCCAddress field doesn't accept comma separated email addressed and using
message.AddRecipients(Recipient{Email: "[email protected]", Name: "Test", Type: "bcc"})
Just sends the message as "to" instead of a bcc
EDIT: if I set PreserveRecipients: true
it does seem to send BCC, but without the 'to' recipients email address. Seems like it might be an issue with Mandrill itself
I want to use Sourcegraph code search and code review with gochimp. A project maintainer needs to enable it to set up a webhook so the code is up-to-date there.
Could you please enable gochimp on @sourcegraph by going to https://sourcegraph.com/github.com/mattbaird/gochimp and clicking on Settings? (It should only take 15 seconds.)
Thank you!
This is probably a vestigial parameter from older days however I got confused by it for a while. I was looking for message.CC
or similar and couldn't find it as a parameter so went with message.BCCAddress
but that didn't do anything either. Then realized I need to add an extra message.Recipient
and set the Recipient.Type
to bcc
or cc
as necessary.
Hello!
I'm trying to vendor your library but my vendor tool (gvt) failed due to missing dependencies:
bin/gvt fetch github.com/mattbaird/gochimp
2017/09/06 19:44:11 Fetching: github.com/mattbaird/gochimp
2017/09/06 19:44:13 · Fetching recursive dependency: github.com/picatic/gochimp
Username for 'https://github.com':
Password for 'https://github.com':
remote: Repository not found.
fatal: Authentication failed for 'https://github.com/picatic/gochimp/'
2017/09/06 19:44:28 skipping insecure protocol: git://github.com/picatic/gochimp
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
2017/09/06 19:44:29 skipping insecure protocol: http://github.com/picatic/gochimp
2017/09/06 19:44:29 command "fetch" failed: error fetching github.com/picatic/gochimp: vcs probe failed, tried: https://github.com/picatic/gochimp,ssh://github.com/picatic/gochimp
And according to GitHub this library was removed or renamed (https://https://github.com/picatic/gochimp) :(
Could you remove/correct dependency to this code?
Thank you!
When trying to use the MessageSearch
functionality, it appears the date formatting isn't right when we marshal a DateFrom
field.
error="-2: Validation error: {\"date_from\":\"Please enter the date in the form MM\\/DD\\/YYYY\"}"
Looks like we need to add a custom marshaller for APITime
Hi,
I came across with an unexpected issue when I ran the command.
panic: json: cannot unmarshal number into Go struct field UserTemplate.folder_id of type bool
I checked with the code but found that FolderId
is using bool
as type. Any idea why we using
bool
here instead of int
? https://github.com/mattbaird/gochimp/blob/master/chimp_templates.go#L48
Not sure if this is something you'd like to fix, but the Godoc entry looks pretty messy:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.