4 ms·
Nice work! Just signed up and am testing sending some AWS Alarms for Elastic Beanstalk via a template. One problem I've come across straight away is that your
by cyberferret 7y ago
Nice work! Just signed up and am testing sending some AWS Alarms for Elastic Beanstalk via a template. One problem I've come across straight away is that your templating engine doesn't seem to be able to handle JSON arrays.
The EB notification JSON body that gets POSTed by the SNS Topic contains a Record[] structure with the messages, and when I try to setup {{ Records[0].Sns.Message }} in the template, I am getting a "template: notification-content:2: unexpected bad character U+005B '[' in command" error.
- cmaster11 7y agoCool!! You can access arrays with `{{ index .myArray 0 }}` ( https://notify17.net/docs/templates/#arrays https://notify17.net/docs/templates/#arrays ). Notify17 uses golang templates :)
- cyberferret 7y agoCan confirm that works. :) I am not familiar with GoLang, but using {{ (index .Records 0).Sns.Message }} works (for anyone who may be interested in the solution).
- cmaster11 7y agoYes, I'm aware at first sight, for non Golang users, it may look a not-so-friendly syntax, but Go templates are just too powerful to not use them :D