Add a Subscriber to the Inbound Task Queue — Email

1. Description

This Flow schema is used for receiving email messages from the address specified in the Email profile settings. The Flow schema routes the received emails to the Queue for an Agent.

1.1. Flow example

An example flow can be seen in Figure 1.

Добавление абонента во входящую очередь задач - Email.png
Fig. 1. Add a Subscriber to the Inbound Task Queue — Email

For convenience, you can download the completed JSON file, which is attached below, and then import it.

1.1.1. Flow description

Component  

Block of component

 Component parameters

Description

Component  

Block of component

 Component parameters

Description

Branch 1

Start

 

Start component

Custom code

 

In the Custom code field, enter:

{ "findContact": { "q": "${from}", "qin": [ "emails" ], "setVar": "listContacts", "size": 10, "token": "SUPER" } }

If

 

In the Expression field, enter the following condition:

+${listContacts.data.0.id} > 0

Branch 2

Script

  • in the Set result to variable field, enter the name of the variable to which the code value is passed. For example, contactIds.

  • in the Script field:

    var a = JSON.parse(${listContacts}); return JSON.stringify(a.data.map(function(i){ return i.id}))

Custom code

 

 

In the Custom code field, enter:

{ "linkContact": { "contactIds": "${contactIds}" } }

Branch 3

Callback Queue

 

  • in the Name field, enter the name by which inbound tasks will be labeled. You can specify it as a text or a variable. In this example, the variable ${subject} is used, representing the message's subject;

  • In the Queue field, select the Inbound Task Queue to which the email messages will be routed;

  • In the Destination field, specify the email address from which the message was received, using the variable ${from};

  • in the Set variables field, the variable message_id is defined as ${message_id} for further use, for example, in the Flow schema for email processing.