notify uses a DeployHub Notifier to send a message (email or SMS) to a group of recipients. Using notify, a script has far finer control over the content of the message than that normally provided with notification templates. notify can generate the body of the text with DMScript and – when sending emails – the email can also include zero, one, or more attachments. The attachments themselves can also be generated from scripts. For example, you could checkout a file from a repository, modify it in some way (if required) and include it in an attachment in an email.
The body of an email can be plain text or HTML. As the email body can be generated by script, it is possible – for example – to extract the Change Request records associated with an Application and include them in a table emailed out to the chosen recipients.
notify opens a statement block containing commands whose output is used to create the body of the sent message. Typically these are “echo” commands but you can also call other Procedures whose standard output is then included in the message body. These other Procedures can – of course - be external scripts which means you can create your message body (and attachments) from scripts written in any language you like.
notify takes a number of named parameters:
|notifier||Mandatory. The name of the notifier to use to send the outgoing message. Can be qualified by domain names if required.|
|to||Recipient list. This can be a User Object, a UserGroup Object, a string containing an email address (or mobile/cell number for SMS notifications) or an Array or List containing several such objects. If a User or UserGroup Object is passed then the object’s “email” attribute is used as the recipient (for SMTP notifiers) or “phone” attribute (for SMS notifiers). If to is not specified, then the owner of any Environment and/or Endpoint on the stack is used as a target.|
|cc||Carbon Copy list. SMTP notifiers only. This can be a User Object, a UserGroup Object, a string containing an email address or an Array or List containing several such objects. If a User or UserGroup Object is passed then the object’s “email” attribute is used as the recipient.|
|subject||SMTP notifiers only. String containing the subject of the email.|
|from||The email address used to identify the source of the message (for SMTP notifiers) or the source of the SMS (for SMS notifiers).|
|attachment||SFTP notifiers only. A Stream to attach to the outgoing email – the content of the Stream will appear as an attachment in the email.|
|HTML||SFTP notifiers only. Boolean. If set to true, the body of the email is regarded as being HTML encoded.|