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 |
---|---|---|
type* | String | The action type must be email |
provider* | String | Message Center provider name (usually named as default ) |
from* | Object | Name and email address of sender |
to* | Array | List of emails that email will be sended |
replyTo* | Array | Email address for replies |
subject* | String | Email subject |
body* | String | Email message body |
bcc | Array | List of email addresses that will receive a blind carbon copy (BCC) of the message |
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 "cco": [ "testcco@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 |
---|---|---|
type* | String | The action type must be t-email |
template* | String | Name of the Message Center template |
provider* | String | Message Center provider name (usually named as default ) |
from | Object | Name and email address of sender |
to* | Array | List of email addresses to send the email |
replyTo* | String | Email address for replies |
subject* | String | Email subject |
body* | String | Email message body |
bcc | Array | List of email addresses that will receive a blind carbon copy (BCC) of the message |
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 }