Tickets and the Workflow Engine

Tickets Overview

  • Mailboxes are configured as ticket boxes, for example, [email protected], [email protected] or [email protected], any email address can be used
  • The Workflow engine connects to the mailbox and imports from the mailbox using IMAP or POP3 to create tickets for each enquiry
  • Each enquiry then appears in the ticket listing for handling by team members
  • Tickets have a range of statuses depending on the status of the ticket
  • Tickets can be responded to using canned responses
tickets image

What is the Purpose of the Ticket Workflow Engine?

  • Any emails sent to your website can be managed through the Tickets Workflow Engine.
  • The engine supports multiple different ticket types, canned responses and the ability to automate the processing and management of enquiries and requests from customers and leads.

Ticket Types

  • Every email sent as a request can be tagged as a Type
  • The types define which email address is used for the pickup of the enquiries
  • Each Ticket Type requires a separate Ticket Mailbox

Ticket Mailboxes

Ticket Mailboxes Overview

  • Mailboxes are just temporary storage locations for tickets
  • Generally, you will have an email address configured for customers to contact your organisation
  • The same mailbox can be used to generate the tickets
  • You can have multiple mailboxes which can then be used to manage different ticket types, for example, sales@ service@ etc.

Setup Oauth for Outlook Account

The instruction video can be found here.

Step 1: Register an application

Detail Steps can be found at: https://learn.microsoft.com/en-us/graph/auth-register-app-v2

  • For this step, you will need access to the mailbox you need and register in Azure Portal.
  • Get the Application Id, Redirect URI/URL and Client Secret.
  • Go to https://portal.azure.com/ and access the created application:    
    Step 1  

  • Click on the application and it will redirect you to Overview page:
    • The Application (client) ID is the Application Id.
    • The Directory (tenant) ID is the Tenant Id.
    • You click on the Redirect URIs to get the Redirect URI, in this case, I set it https://interactivepartners.com.au/. Step 1.2  
  • Click on Certificates & secrets to get the Client Secret:
    You can only get this the first time, then store it in a secure location. If you cannot remember it, you can create a new one.
    Note: The client secret only lives for maximum 730 days (2 years), so we may need to manually refresh it to make sure the API works (I use may as I’m not sure if the API will not work after 730 days).
    Step 1.3  

Step 2: Get access token and refresh token

Step 2.1: Get the code to request tokens

The goal of this step is to get the code to use to get the refresh token and access token.

 

Sample URL(Paste this in your browser):
https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/authorize?client_id={client_id}&response_type=code&redirect_uri={redirect_url}&response_mode=query&scope=offline_access%20 https://outlook.office.com/IMAP.AccessAsU ser.All%
20https://outlook.office.com/POP.AccessAsUser.All&state=12345&access_type=offline

https://login.microsoftonline.com/d495ee85-b84b-4540-960a-6657fa931007/oauth2/v2.0/authorize?client_id=c22dc3e0-b946-4ecb-abaf-37d32819be07&response_type=code&redirect_uri=https://interactivepartners.com.au/&response_mode=query&scope=
offline_access%20https://outlook.office.com/IMAP.AccessAsUser.All%20https://outlook.office.com/POP.AccessAsUser.All&state=12345&access_type=offline

 

The value needed for the request are:

  • tenant_id : it’s the tenant id from step 1
  • client_id : it’s the application id from step 1
  • response_type : code
  • redirect_uri : the redirect url you set up from the first step, I set it https://interactivepartners.com.au/
  • scope : offline_access%20https://outlook.office.com/IMAP.AccessAsUser.All%20https://outlook.office.com/POP.AccessAsUser.All
    to have the permission for read/write emails from Outlook
 

Then, you paste this link to Google Chrome and it will redirect you to the Microsoft Login page, you need to login and it will redirect you to the Redirect URL, then you copy the redirect url to get the code (highlighted in yellow), for example:
Sample of what you will see, this is not the actual code to use in your setup
Sample URL


Step 2.2: Get Access token and refresh token

After having the code, we can send an API request to get both the access token and refresh token, as below image:

Step 2  

Endpoint: https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token

Please use postman to get the response. The parameters below should be in the BODY of the request.

Parameters:

  • client_id: you get it from Step 1
  • scope: offline_access https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/POP.AccessAsUser.All
  • code: you get it from Step 2.1
  • redirect_url: you set it up in Step 1
  • grant_type : authorization_code
  • client_secret: you set it up in Step 1

After this step, you can get both access_token and refresh_token.

  • The access_token is used to request for the Microsoft Graph API, but it has expiry date and time.
  • The refresh_token cannot be used to request API, but it can be used to get the access_token again without getting a new code manually. The refresh_token lives for 90 days and every time you use the refresh_token to get the new access_token, Microsoft will return you a new refresh token, you should replace the old one with the new one, so that it will never expire.
    As the schedule to get the tickets is running every 10 minutes, you shouldn’t worry about the expiry time of the refresh token.

For this step, after we get the refresh token manually, we will store the refresh token (with expiry time) in the DB of WebEd9, so we can reuse it and update it for future usage.

  
Step 3: Create the Mailbox with token information

Step 3.1: Create mailbox in Ticket Engine Mailbox Management

  • Name: Can be anything: Industrial AWG or using email
  • Type: POP3 - OAuth
  • Host: outlook.office365.com
  • Port: 995
  • Use SSL: true
  • Username: [email protected]
  • OAuth Type: Microsoft
  • Tenant Id: get from Step
  • Client Id: get from Step 1
  • Client Secret: get from Step 1
  • Redirect Url: get from Step 1
  • Refresh Token: get from Step 2.2
Step 3

Step 3.2: Create ticket type in Ticket Engine Type Management

  • Go to the Menu and type 'Ticket Types'. Ticket Listing
  • Click the 'Ticket Types', this will redirect you to the Ticket Engine Management.
  • Then configure the following:

Task: Simple Storage
Name: ticket type name
Ticket Engine Mailbox: choose the mailbox you created in Step 3.1
Admin Email: the email of the admin who will handle the tickets


Step 3.2

Access another mailbox on the same Directory

STEP-BY-STEP
  • 1
    Go to https://portal.azure.com/ and access the created application:
    Access another mailbox
  • 2
    Click on Certificates & secrets to get a NEW Client Secret.
  • 3
    Once you have the Client Secret, repeat Step 2 but use the new user email address you need and the new Client Secret.
  • 4
    This step makes sure that only the mailbox of the user will be accessed when we pass that authorization to the Mailbox.
  • 5
    Then continue the whole process from Step 2 until Step 3.2.

How To Manage Workflow Engine Mailbox

How to create new mailbox

STEP-BY-STEP
  • 1
    Go to Settings > Workflow Engines > Workflow Engines Mailboxes
    Managing Workflow
    Managing Workflow
  • 2
    Click Create New Workflow Engine Mailbox
    Managing Workflow
  • 3
    Enter name, select type, enter host, port, check user SSL(optional), enter the username and password
  • 4
    Click Create
  • 5
    A new workflow engine mailbox is created
    Managing Workflow

How To Edit, View Details and Delete a Mailbox

STEP-BY-STEP
  • 1
    Go to Settings >> WorkflowEngines >> Workflow Engines Mailboxes
    Managing Workflow
  • 2
    Click Edit/View Details/Delete button on the row you want
    Managing Workflow

57 - Test plan manage the mail box (PASS)

Target Release 9.0
Epic  
JIRA issue  
Document status DRAFT
Document owner Phung Dinh (Unlicensed)
Developers Minh Nguyen (Unlicensed)
Enter your name Belinda Sharp (Unlicensed)

(Use @ above to add someone by name)

What are we testing

  • Testing for managing the mailbox

Assumptions

  • Login as CRM admin successfully

Requirements

# Test Steps Expected Result Actual Result Test By (use @) Date Notes
1 Go to Settings >> WorkflowEngines >> Workflow Engines Mailboxes

List of mailboxes appears

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 
2 Click Create New Workflow Engine Mailbox

Create screen for mailbox appears

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 
4

Enter name, select type, enter host, port, check user SSL(optional), enter the username, password
Click Create

Create successfully

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 
5

Click the Edit icon on a row in the list of mailbox

Edit screen appears

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 
6 Click Save

Update mailbox successfully

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 
7

Click the View Details icon on a row in the list of mailbox

The Details screen appears correctly

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 
8

Click the Delete icon on a row in the list of mailbox

Details screen appears with a message to confirm deleting

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 
9 Click OK

If the mailbox doesn't have related data => Delete successfully

If the mailbox has related data => Show an error message

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 

Background Task Explained

  • The background task "Email Processing Task" is used to process emails that come into the ticket mailbox defined
  • Each ticket mailbox can have none, one or many workflow engine ticket type/s
  • Every time the background task run, it will get all the ticket boxes that have workflow engine ticket type/s..
  • Recommendations on how often it should be configured to run: Use whatever the default time is set, as for the Email Processing Task, the interval seconds is 600 seconds. To understand more on how to configure the Background Task please click here.

Processing Steps

Creating Tickets

STEP-BY-STEP
  • 1
    With each mailbox, connect to the mailbox and get all the emails from the box
    • With each email, get the email info (to address, from address, subject, content, ...)
    • If the email cannot be read - failure (the email is too big or any reason) → an error ticket is created, this ticket does not have contact
  • 2
    Get all the items not yet processed from the current mailbox and create a ticket for each, note only emails with a To, CC or BCC Address matching the valid ticket types will create a ticket
  • 3
    Determine whether this email is a new email or a reply to a previous ticket.
  • 4
    Each outbound email from the ticketing engine has a generated subject line for the ticket type
    • example [Support #123-789] - This is a "Support" type ticket, the Ticket ID is 123 and the Support Log ID is 789.
  • 5
    If this email has a ticket-generated subject line it is a reply and is added to the existing ticket, if not a new ticket is created.

The Email Process

STEP-BY-STEP
  • 1
    From the ticket and the ticket log that has just been created above, we generate:
    • The email subject with the format: [WorkflowTag #TicketId-TicketLogId] Subject
    • The attachments
    • Determine the email, name and contact for the receiver
  • 2
    Update for the ticket log (update the receiver info)
  • 3
    Finally, create an email queue to notify the admin there is a new ticket (this email queue will be sent via email sending background task)
  • 4
    Finally, delete the email from the mailbox

Assignment Emails

  • From the ticket and the ticket log that has just been created above, we determine the email, name and contact for the receiver
  • Update for the ticket log (update the receiver info)
  • Get the student assignment for this ticket (based on the ticket id).
  • If there is no assignment → this is submitted as an assignment
    • Check if this is submitted by a student or not?
    • If so → Run the submit assignment flow by email (based on the ticket log)
    • If no → Update the ticket to NULL type (Invalid ticket)
  • If there is an assignment, we will check if this is a student re-submits assignment or the tutor giving feedback to the admin (other cases cannot be controlled by workflow engine ticket)
    • If this is a re-submitting assignment by a student → Run the re-submit assignment flow by email (based on the ticket log)
    • If this is feedback by the tutor → Run the feedback returned by tutor flow by email (based on the ticket log)
  • Generate:
    • The email subject with the format: [WorkflowTag #TicketId-TicketLogId] Subject
    • The attachments
  • Finally, create an email queue for the ticket log (this email queue will be sent via email sending background task)
  • In some cases, the email queue cannot be created:
    • An admin sent to himself/herself ([email protected])
    • Someone tries replying to an email that is NOT sent to him/her
  • → We will delete the ticket and ticket log
  • Finally, delete the email from the mailbox

Invalid Emails

In some cases, an invalid ticket will be created. This can happen when you drag an email from another mailbox to a question mailbox.

  • An invalid ticket will be created for this email.
  • This ticket does not belong to any type (assignment or question) and the receiver (email to) is not specific.
  • No email is created either.
  • Admin user can reassign this ticket to the correct ticket type (in CRM - ticket management)
  • When a ticket is re-assigned an email will be generated and sent
  • The invalid email is deleted from the mailbox

Workflow Engine Management and Test Plans

How To Manage Workflow Engine Mailbox

How to create new mailbox

STEP-BY-STEP
  • 1
    Go to Settings > Workflow Engines > Workflow Engines Mailboxes
    Managing Workflow
    Managing Workflow
  • 2
    Click Create New Workflow Engine Mailbox
    Managing Workflow
  • 3
    Enter name, select type, enter host, port, check user SSL(optional), enter the username and password
  • 4
    Click Create
  • 5
    A new workflow engine mailbox is created
    Managing Workflow

How To Edit, View Details and Delete a Mailbox

STEP-BY-STEP
  • 1
    Go to Settings >> WorkflowEngines >> Workflow Engines Mailboxes
    Managing Workflow
  • 2
    Click Edit/View Details/Delete button on the row you want
    Managing Workflow

57 - Test plan manage the mail box (PASS)

Target Release 9.0
Epic  
JIRA issue  
Document status DRAFT
Document owner Phung Dinh (Unlicensed)
Developers Minh Nguyen (Unlicensed)
Enter your name Belinda Sharp (Unlicensed)

(Use @ above to add someone by name)

What are we testing

  • Testing for managing the mailbox

Assumptions

  • Login as CRM admin successfully

Requirements

# Test Steps Expected Result Actual Result Test By (use @) Date Notes
1 Go to Settings >> WorkflowEngines >> Workflow Engines Mailboxes

List of mailboxes appears

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 
2 Click Create New Workflow Engine Mailbox

Create screen for mailbox appears

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 
4

Enter name, select type, enter host, port, check user SSL(optional), enter the username, password
Click Create

Create successfully

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 
5

Click the Edit icon on a row in the list of mailbox

Edit screen appears

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 
6 Click Save

Update mailbox successfully

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 
7

Click the View Details icon on a row in the list of mailbox

The Details screen appears correctly

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 
8

Click the Delete icon on a row in the list of mailbox

Details screen appears with a message to confirm deleting

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 
9 Click OK

If the mailbox doesn't have related data => Delete successfully

If the mailbox has related data => Show an error message

Pass

Belinda Sharp (Unlicensed)

06 Aug 2016

 

How To Manage Workflow Engine Type

How to create a new mailbox

STEP-BY-STEP
  • 1
    Go to Settings >> WorkflowEngines >> Workflow Engines Types
    How To Manage Workflow
    How To Manage Workflow
  • 2
    Click Create New Workflow Engine Type
    How To Manage Workflow
  • 3
    Select the task, enter a name, enter a description, enter the email toe
  • 4
    Enter the workflow tag, select the mailbox, enter the email forward, select the workflow engine save table to store the workflow engine information
  • 5
    Select an email from storage, select email subject storage, select email body storage, and check active(optional)
  • 6
    New workflow engine type created
    How To Manage Workflow

How to edit/view details/delete a workflow engine type

STEP-BY-STEP
  • 1
    Go to Settings >> WorkflowEngines >> Workflow Engines Types
  • 2
    Click the Edit/View Details/Delete button on the row you want
    How To Manage Workflow

How to assign Workflow Engine to Course

STEP-BY-STEP
  • 1
    Open Edit Course in BMS
    How To Manage Workflow
  • 2
    Select the type of Workflow Engine Type for Simple Storage (Questions) and Assignment.
    How To Manage Workflow

55 - Test plan manage the workflow engine type (PASS)

Target release 9.0
Epic  
JIRA issue  
Document status

DRAFT

Document owner

Phung Dinh (Unlicensed)

Developers

Minh Nguyen (Unlicensed)

Enter your name  

(Use @ above to add someone by name)

What are we testing

  • Testing for managing workflow engine type

Assumptions

  • Login as CRM admin successfully

Requirements

# Test Steps Expected Result Actual Result Test By (use @) Date Notes
1 Go to Settings >> WorkflowEngines >> Workflow Engines Types

List of workflow engine types appears

Pass Belinda Sharp (Unlicensed)

01 Feb 2017

 
2 Click Create New Workflow Engine Type

Create screen for type appears

Pass Belinda Sharp (Unlicensed)

01 Feb 2017

 
4
  • Select the task, enter a name, enter a description, enter email to,
  • Enter the workflow tag, select the mailbox, enter the email forward, select the workflow engine save table to store the workflow engine information
  • Select email from storage, select email subject storage, select email body storage, and check active(optional)
  • Click Create

Create successfully

Pass Belinda Sharp (Unlicensed)

01 Feb 2017

 
5

Click the Edit icon on a row in the list of mailbox

Edit screen appears

Pass Belinda Sharp (Unlicensed)

01 Feb 2017

 
6 Click Save

Update workflow engine type successfully

Pass Belinda Sharp (Unlicensed)

01 Feb 2017

 
7

Click the View Details icon on a row in the list of workflow engine type

The details screen appears correctly

Pass Belinda Sharp (Unlicensed)

01 Feb 2017

 
8

Click the Delete icon on a row in the list of workflow engine type

Details screen appears with a message to confirm deleting

Pass  

01 Feb 2017

 
9 Click OK

If workflow engine type doesn't have related data => Delete successfully

If workflow engine type has related data => Show error message

Pass Belinda Sharp (Unlicensed) 01 Feb 2017  

How To Handle Bounces

Bounces Demo

Here's video demo

What is a bounce email?

When users want to handle bounce emails in the system.

When an email message cannot be delivered to an email address, it's called a bounce.

There are lots of different reasons why emails bounce so when it happens, a message is sent from the recipient's mail server to explain why.

Why you would use bounces handling

  • The system sends many emails for various functions
  • When email sending fails, has a bounce-back reply which can be seen in CRM
  • Staff identify what the issue is with the email (if possible) and edit the contact record

How To Handle Bounces Recommendation

  • We recommend having a stand-alone mailbox for bounce-back email processing because it will produce less time in processing emails

How to setup Bounce Back workflow engine mailbox and workflow engine type

STEP-BY-STEP
  • 1
    Log in as an administrator and go to the Admin Dashboard.
    Learn how to log in here →
  • 2
    Go to Admin > System Settings > Workflow Engine Mailboxes
    How to handle Bounces
  • 3
    Click Create New Workflow Engine Mailbox
  • 4
    Put all of your mailbox information
  • 5
    Note: If you will use multiple mailboxes, set the name to Bounce Back so you easily identify what is the mailbox for a Bounce Back
    How to handle Bounces
  • 6
    Click Save
  • 7
    Go to Admin > System Settings > Workflow Engine Types
    How to handle Bounces
  • 8
    Click Create New Workflow Engine Type
  • 9
    Put all your Workflow Engine Type information
    Note:
    • Do not forget to set the Workflow Engine Mailbox to the Bounce Back mailbox you created
    • Always be mindful of the Email To field because the system will get the domain of that email and use it as the receiver of the bounce back, in the image below the domain for the Email To field is (@mailtest.interactivepartners.com.au)
    How to handle Bounces
  • 10
    Click Save

How to setup Bounce Back Site Settings (Retired)

/wiki/spaces/ANFBMS/pages/100180794

How to review the list of bounced emails

STEP-BY-STEP
  • 1
    Log in as an administrator and go to the Admin Dashboard.
    Learn how to log in here →
  • 2
    Go to Settings >> Bounces
  • 3
    A list of bounced emails appears. The default filter is 'Unresolved' to make staff easier for reviewing.
    How to handle Bounces
  • 4
    Click the View Details icon to go to the details page of a bounce
    How to handle Bounces
  • 5
    Click the checkbox icon to resolve a bounce.
    How to handle Bounces

How to review bounce emails for individual contact/ lead/ student/ tutor

STEP-BY-STEP
  • 1
    Log in as an administrator and go to the Admin Dashboard.
    Learn how to log in here →
  • 2
    Go to the details page of a contact/ lead/ student or tutor.
  • 3
    Navigate to the bounces tab
  • 4
    A list of bounce emails for this contact appears. The default filter is 'Unresolved' to make staff easier for reviewing
    How to handle Bounces
  • 5
    Click the View Details icon to go to the details page of a bounce
    How to handle Bounces
  • 6
    Click the checkbox icon to resolve a bounce.
    How to handle Bounces