If you want to customise the layout and content of your Bamboo notifications, you can customise the templates for each of the notification types (i.e. HTML email, text email, instant message) and events (e.g. Build Commented). The notification templates are written in Freemarker.
To modify a notification template,
- Locate the default notification templates in your Bamboo distribution in WEB-INF/classes/notification-templates/
- Copy the notification template that you wish to modify into the templates/notification-templates folder of your Bamboo home directory, e.g. HOME/templates/notification-templates
The filename will have formatted as: <event name><notification type>.ftl, e.g.AfterXFailedHTMLEmail.ftl
- Modify the copied template, as desired. Please see the section on Working with Freemarker below for tips on updating templates.
- Save your changes to the template. Your updated template will be used in the next notification that the template applies to. You do not have to restart your Bamboo server.
 | Please note, Bamboo does not validate notification templates. If you have incorrectly formatted the markup text in the template, Bamboo will still use the template to send out notifications. If this happens, your users may receive notifications with unreadable or missing information, as well as error messages. Errors will also be posted to your logs. |
Working with Freemarker
The Bamboo notification templates are written in Freemarker. The Freemarker engine allows for dynamic content generation based on the Freemarker markup tags that are used in templates. This document does not describe the Freemarker language in detail. Please see the Freemarker Online Manual for full information on using this markup language.
Generating content via Freemarker involves merging a template (*.ftl file) with a context map. You can access any data in the context map from within the template using the Freemarker markup. For the notifications we have provided a specific subset of Bamboo objects that you can access. For example,
If you had a successful Bamboo build with build result, BAM-1234-1, the above markup would return the following text in your notification:
BAM-1234-1 was successful.
You can find more information on working with Freemarker, including Bamboo objects available from Freemarker templates, tips on writing Freemarker templates and examples in the Freemarker and Notification Templates document.
available objects in the context map as well as some Freemarker examples [Insert link here]. |