Skip to main content

Send email-3.0.0

Send an email
key: PBEmail

Overview

The Send Email stage routine is a bot that automatically generates and sends customized emails within a routine.

Settings Layout

template

Templates

An HTML template is required to generate the email's basic design structure. You can choose between default and customized. Whichever option you choose, you must add the template's variables in the Data (Object) section in JSON format.

To use a custom template, you must select HTML Template from the Add Optional Inputs section. Additionally, a CSS Template can also be added for further customized design.

If you don't provide your own HTML template, the system will expect you to use the default email template.

tip

Within the Data (Object) section, you can use COTLang (Cotalker Scripting Language) to extract context data and use it within the JSON object that contains the variables so that your automated emails are generated with the relative data. Context data can include things like assets, users, and other task details found within the database.

Default Email Template

When no template is provided, you must use the default template object to include variable content on your automated emails.

The default email template has 8 items in which you can include variable content. To add your customized content, include a JSON object in the Data (Object) section with the 8 default keys and the values you wish them to display.

This is the basic structure of the data object corresponding to the default email template:

{
"recipientName": string,
"recipientEmail": string,
"title": string,
"messageA": string,
"messageB": string,
"action": string,
"code": string,
"companyName": string,
}

Below is an example of what an email looks like using the default template:

template


  • 1. recipientName
  • 2. title
  • 3. messageA
  • 4. messageB
  • 5. action
  • 6. code
  • 7. recipientEmail
  • 8. companyName

Custom HTML Template

If you wish to provide a custom template for your emails, add the HTML Template option from the Add Optional Inputs section.

Add your HTML code in the HTML Template code box.

The variables in your template must follow the {{content.key}} format.

Below is a simple example of an HTML template:

<html>
<head>
<h1>Task Reminder: {{content.channel}}</h1>
</head>
<body>
<p>Hi, {{content.recipientName}}!</p>
<p>Remember to check and report on the status of {{content.equipment}}.</p>
<p>Sent by: {{content.sentBy}}
</body>
</html>

In the Data (Object) section, the customized template's variables can be filled out with static and automated content, as shown in the example below:

{
"channel": "$VALUE#channel",
"recipientName": "Diego",
"equipment": "$OUTPUT#get_property#data|name|display",
"sentBy": "$VALUE#user"
}
tip

☞ Read the mustache documentation for more details and options for displaying variable and conditional content on your HTML template.

CSS Template

Through Add Optional Inputs, you can modify your HTML template's design with a CSS Template.

Simply insert CSS code, as shown below:

p {
text-decoration: underline;
color: red;
}

Below you will find the complete list of options available on the Send Email (v3.0.0) stage bot:


Inputs

1. Subject (key: subject)

Subject of the email
Required: true
Data Type: string

2. From (key: from)

Email of the sender
Required: no
Data Type: string

3. Data (key: content)

Data that will be used to build the HTML. In the template they are referenced as: '{{ content.key }}'. In case of using the default template, the keys are 'recipientName', 'recipientEmail', 'companyName', 'title', 'messageA', 'messageB', 'action' and 'code'
Required: true
Data Type: object

4. Attachments (key: attachments)

Email attachments
Required: no
Data Type: array string

5. To (key: targets)

Array with the emails of the recipient
Required: true
Data Type: array string

6. CC (key: cc)

Array with the emails of the person receiving a copy
Required: no
Data Type: array string

7. BCC (key: bcc)

Array with the emails of those who receive a hidden copy
Required: no
Data Type: array string

8. HTML Template (key: htmlTemplate)

Template to use for HTML generation. It must be written in HTML language. If it is empty, the default template will be used. Documentation about how data is referenced in https://mustache.github.io/
Required: no
Data Type: code html

9. CSS Template (key: cssTemplate)

(Optional) Style to apply in the HTML. It must be written in CSS language
Required: no
Data Type: code css

10. Individual shipping (key: singleRecipient)

Indicates whether the mail should be sent individually to the recipients
Required: no
Data Type: boolean

Next Stages

1. SUCCESS

2. ERROR

Outputs

1. Status (key: status)

Required: no
Data Type: boolean

2. Errors (key: errors)

Required: no
Data Type: array string