Sending emails with triggers in Master Data v2
There are two ways of sending emails automatically with Master Data v2 triggers:
Learn more about triggers in the article Setting up triggers in Master Data v2.
Sending emails
This is the more direct method of sending emails with Master Data v2 triggers, but without the standardization provided by Message Center templates.
Properties
Field | Type | Description | Required |
---|---|---|---|
type | String | Action type, which must be email . | True |
provider | String | Message Center provider name (usually named as default ). | True |
from | Object | Information about the sender. | True |
String | Sender email. | True | |
↪ name | String | Sender name. | True |
to | Array of strings | List of recipient email addresses, separated by comma. | True |
replyTo | Array | Email address for replies. | True |
subject | String | Email subject. | True |
body | String | Email message body. | True |
bcc | Array of strings | List of email addresses that will receive a blind carbon copy (BCC) of the message. | False |
Dynamic expressions
You can use dynamic expressions to deal with document properties in these settings. For more information, look at the Article on dynamic expressions.
JSON schema example
_18 {_18 "properties": { ... },_18 "v-triggers": [_18 {_18 "type": "email",_18 "provider": "default",_18 "subject": "Sending email with VTEX Master Data",_18 "from": {_18 "email": "mailfrom@email.com",_18 "name": "My custom name"_18 },_18 "to": [ "test@test.com" ],_18 "bcc": [ "testbcc@test.com" ],_18 "replyTo": "noreply@email.com",_18 "body": "VTEX Master Data Triggers email body"_18 } _18 ]_18 }
Sending emails using Message Center templates
See below how to set up a trigger to send emails using a Message Center template.
Properties
Field | Type | Description | Required |
---|---|---|---|
type | String | Action type, which must be t-email . | True |
template | String | Name of the Message Center template. | True |
provider | String | Message Center provider name (usually named as default ). | True |
from | Object | Information about the sender. | True |
String | Sender email. | True | |
↪ name | String | Sender name. | True |
to | Array of strings | List of recipient email addresses, separated by comma. | True |
replyTo | String | Email address for replies. | True |
subject | String | Email subjec.t | True |
body | String | Email message body. | True |
bcc | Array of strings | List of email addresses that will receive a blind carbon copy (BCC) of the message. | False |
JSON schema example
_29 {_29 "properties": { ... },_29 "v-triggers" [_29 {_29 "type": "t-email",_29 "template": "template-name",_29 "provider": "default",_29 "subject": "My template email with VTEX Master Data",_29 "to": [_29 "{!email}",_29 "test@email.com"_29 ],_29 "bcc": [_29 "myemail@test.com"_29 ],_29 "replyTo": "noreply@company.com",_29 "body": {_29 "firstName": "{firstName}",_29 "email": "{email}",_29 "id": "{!id}",_29 "clientName": "{!clientProfileData.firstName{!clientProfileData.lastName}",_29 "ownerListName": "{!customData.customApps[0fields.ownerListName}",_29 "ownerListEmail": "{!customData.customApps[0fields.ownerListEmail}",_29 "items": "{!items}",_29 "openTextField": "{!openTextField.value}"_29 }_29 }_29 ]_29 }