In the previous document, we used the multichannel feature and configured journeys allowing an agent to interact with the user on Facebook Messenger. This document is a resemblance that features Twitter as a communication channel integrating with Quickwork Chat. Let's drill through this document and understand the usage of the multichannel feature using Twitter as a messaging channel.
Communicate with a user, who messaged you on Twitter, using Quickwork Chat as a messaging platform.
To implement this use-case, we need to build two journeys with the following two adapters. The journeys will execute in synchronization thus facilitating the flow of messages in real-time:
Quickwork Chat account
A dedicated multichannel account to be connected in both journeys.
Twitter account to be connected in both journeys
Log in to your Quickwork Chat dashboard and click the gear icon located on the left to open the Settings section. Click on Inbox Settings from the navigation menu on the left and then click on the Add New Inbox button to start creating a new inbox. Select the Multichannel option to proceed:
Enter a name for the inbox, for example, Twitter Multichannel, and click Continue. Add any agents if you want to assign specific agents for this inbox or else assign it to yourself and then click Continue. Your inbox is now ready. Scroll down and click on the Go To Dashboard button to redirect to the conversations dashboard of the respective inbox which will be blank as of now.
Let’s create the first journey that will fetch new messages sent by users from Twitter and will forward those to a Quickwork Chat agent.
Create a new journey named New message from a Twitter user.
Under the Trigger section, choose the Twitter app from the drop-down menu in the Apps field present right below the New Trigger button.
Select the trigger event as New text message from the drop-down menu in the Triggers field.
To authorize and connect your Twitter account, click on the Link an account button. Simply allow the permissions in the Twitter account you have logged in
Once the authorization has been completed, the new window that had opened for Messenger’s authorization will automatically close and you will get a notification message in the journey stating Your connection has been successfully established. Your trigger should then look like this:
The reason to configure the If condition with a Stop Journey is to terminate the automation if the sender and recipient are the same. This journey will execute only if the message sender and message recipeint are two different entities. For simplification, let's understand Daniel as a message sender on Twitter and John as a message receiver. John is also a human agent, will eventually reply to Daniel's messages using Quickwork Chat.
Under the Steps section, click the Business Logic option and select If Condition:
2. The Setup If condition block will appear with a pre-indented action bar as illustrated here:
You will get the following fields to which input is to be specified:
Specify a value in the Left Value field by placing the
Recipient Id key from the Twitter | New message Trigger-Data Tree Output on the right-hand side of the screen.
Equals condition from the drop-down in the Condition field.
Drag and drop
Sender ID key in the Right Value field from the Twitter | New message Trigger-Data Tree Output:
Now, delete the action that is pre-indented beneath the If Condition as we need to add Stop Journey.
Click the + icon. Click the Business Logic button and select Stop Journey. Drag the Stop Journey bar and drop it below If Condition in such a way that it gets indented and appears as a part of If Condition:
To do this, perform the following steps:
Again, click the + icon and click on the Simple Action button.
Choose the Quickwork Chat app from the drop-down menu present in the Apps field.
Select the Forward message to agent action in the Actions field.
Create a new connection with the Twitter Multichannel inbox that you had just created. To do so, click the + Create new connection option if you have existing Quickwork Chat connections, and then click on the Link an account button and specify the API key and Inbox ID of this inbox. You’ll get these in the Toolkits window of the Twitter Multichannel inbox present in the Inbox Settings option on the Settings page. After entering the required data, click the Link account button:
Note: The API key is common for all the inboxes of an account whereas the Inbox ID is unique for each inbox.
5. Once the connection has been successfully created, the input fields will open up automatically. Drag the
Sender ID and
Text Message data pills from the Data Tree Output and drop them into the Multichannel Identifier and Message fields, respectively. Select Twitter as the Multichannel type from the drop-down given. Your action should now look like this:
The complete journey structure will look like this:
Click the Save changes button and start the execution by clicking the Start Journey button.
Let’s configure the second journey which will allow an agent to reply to the user on Twitter via the Quickwork Chat portal.
Follow the steps as given below:
Create a new journey named Reply from QC agent to the Twitter user.
Under the Trigger section, choose the Quickwork Chat app from the drop-down menu in the Apps field present right below the New Trigger button.
Select the trigger event, New agent message, from the drop-down menu present in the Triggers field.
From the drop-down menu of selecting existing connections use the same connection that you had created in the previous journey with the inbox named Twitter Multichannel.
In the event field, enter the text demo. The journey builder will return a webhook URL as shown below:
6. Now copy this URL and go to Inbox Settings of the Twitter Multichannel inbox in your Quickwork Chat account. Then go to the Webhook tab and paste this URL in the Agent Response Webhook field:
7. Click the Save Changes button. 8. Your successfully configured trigger shall now look like this:
To do this, follow the given steps:
Under the Steps section, click on the Simple Action button and choose the Twitter app from the drop-down menu in the Apps list.
Select the Send message action from the drop-down menu present in the Actions field.
Select the same existing connection which was created in the previous journey for the Twitter account in the drop-down menu with the title Existing connections of Twitter and then click on the Link Account button.
Once the connection has been successfully created, all the input fields will get loaded.
Now drag the
MultiChannel Identifier data pill from the Data Tree Output and drop it in the recipient ID field.
Similarly, drag the
Content data pill from the Data Tree Output and drop it into the Text field.
Your action should now look like this:
9. Now click the Save changes button and then the Start Journey button to push it in execution. Both the configured journeys shall now look like this:
Now, consider Daniel has sent the message. Hello. I need some assistance for Quickwork Chat on Twitter to John:
As John is a human-agent with an active Quickwork Chat portal, he will receive the same message on the Twitter Multichannel inbox conversation window under Mine, Resolved, Latest First filter:
Until here, the first journey New message from a Twitter user got executed successfully. You might face some delay for the message reflected in Quickwork Chat as Twitter trigger APIs have default delay policy and is polling in nature.
The human agent, John, now can reply to the user through this portal:
The same reply message can be seen as sent from the Twitter account of John:
Until here, the second journey, Reply from QC agent to the Twitter user, got executed by forwarding the reply message sent by human agent on Quickwork Chat to the user on Twitter.
Hence, this is how a human-agent can connect with a user on Twitter with the help of Quickwork Chat and Quickwork Journey Builder.