entry
You can create a workflow that will be triggered when a new email arrives. This is done by creating a function emailReceived
which will be called when an email arrives. The function will receive a context object (ctx
) as its parameter.
function emailReceived(ctx) {
// Your code here
}
When interacting with workflow events, callback functions receive a context object (ctx
) that contains information about the current state:
For message handlers:
ctx.email.body
: The body of the emailctx.email.subject
: The subject of the emailctx.email.replyEmailId
: The ID of the email to which this email is a reply.
Example
In this example, the workflow stops if the email is a reply to a previous email.
function emailReceived(ctx) {
if (ctx.email.replyEmailId !== 0) {
console.log('This is a reply, skipping...')
return;
}
Comments
Can’t find what you need? Use the comment section below to connect with others, get answers from our experts, or share your ideas with us.
There are no comments yet.