Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...


Div
idProductTOC

On this page

Table of Contents
maxLevel1
excludeOn this page
typeflat
separator |

Include Page
_RecipeTemplateTopLogo
_RecipeTemplateTopLogo

Recipe overview

This recipe provides step-by-step instructions on how to monitor public HipChat rooms for references to sensitive terms, for instance conversations that may be discussing pending merger or acquisition talks.

(info) It will take you approximately 12-13 minutes to complete this recipe.

Note that a more advanced version of this recipe is also available: How to Monitor Language in Public Chat Rooms (Advanced)

Recipe level

Table plus
border0
heading0
multiplefalse
enableHeadingAttributesfalse
columnAttributesstyle="border:0;width=5%;",style="border:0;width=65%;",style="border:0;width=30%;max-width=30% !important;"
enableSortingfalse
classingredients_table
enableHighlightingfalse



Ingredients

Table plus
border0
heading0
multiplefalse
enableHeadingAttributesfalse
columnAttributesstyle="border:0;width=5%;",style="border:0;width=65%;",style="border:0;width=30%;max-width=30% !important;"
enableSortingfalse
classingredients_table
enableHighlightingfalse



Preparation

...

Table plus
border0
heading0
multiplefalse
enableHeadingAttributesfalse
columnAttributesstyle="border:0;width=5%;",style="border:0;width=65%;",style="border:0;width=30%;max-width=30% !important;"
idsteps_table
enableSortingfalse
enableHighlightingfalse


Build Regex expression

Div
classtime

Image Modified Estimated Time: 2-3 min

Make a list of the words whose use you want to monitor, including pluralizations and common misspellings. Examples might include:

Correct spellings

  • acquire
  • acquisition
  • acquisitions
  • merger
  • mergers

Incorrect spellings

  • aquire
  • aquisition
  • aquisitions

Turn this into a regular expression (aka Regex expression) that searches for any occurrence of the named words, by separating each word with a pipe ('|') character and then adding .*/\b(?: before it and )\b.* after it.

Anchor
step1
step1
Example expression:

No Format
.*\b(?:acquire|acquisition|acquisitions|merger|mergers|aquire|aquisition|aquisitions)\b.*

 

 





Create HipChat CLI command

Div
classtime

Image Modified Estimated Time: 2 min

Use the command shown on the right to invoke the HipChat CLI to scan the chat history of public HipChat rooms to find any references to your list of words and write the results to a file.

  • hipchat indicates to invoke the HipChat CLI client.
  • The runFromRoomList action indicates to retrieve a list of public HipChat rooms and then, for each room, run the action indicated by the --common parameter. (Note that the value of the --common parameter extends up to the final double quote (") character.)
  • The getRoomHistoryList action  that is executed for each room returned by the runFromRoomList action includes these parameters:
    • --room indicates to access the current HipChat room
    • --file indicates to save the references to the words you're monitoring into a file named chatreferences.csv. This file will be saved to the same folder to which you installed the HipChat CLI client. If this is not what you want, you can specify a full path to the file, enclosing it within double quotes:

      No Format
      --file "../yourfolder/chatreferences.csv"


    • --append indicates to append the output to the chatreferences.csv file if it already exists. This is important since the references may be written from multiple HipChat rooms.

    • --regex provides the Regex expression you prepared earlier. Note that this expression is inserted between \" and \" since it must be quoted but appears within the entire --common parameter which is also quoted.

Anchor
step2
step2
Example command:

Code Block
languagetext
themeDJango
linenumberstrue
hipchat --action runFromRoomList --common "--action getRoomHistoryList --room \"@room@\" --file chatreferences.csv --append --regex \".*\b(?:acquire|acquisition|acquisitions|merger|mergers|aquire|aquisition|aquisitions)\b.*\" " 



Execute HipChat CLI command

Div
classtime

Image Modified Estimated Time: 1 min 

In your command window, type the command from the previous step and press Enter.

The command will run, showing the result of executing the GetRunHistoryList action against each public HipChat room (3 rooms in our example).

(warning) Per the HipChat CLI instructions, your hipchat.bat or .sh file contains a --token parameter which supplies the API Access token of a HipChat user. Be sure to use the token of a user who has access to all of the public rooms you wish to monitor.

Anchor
step3
step3
Example output:

Code Block
languagetext
themeDJango
linenumberstrue
Run: --action getRoomHistoryList --room "ExampleGear Engineering" --file chatreferences.csv --append --regex ".*\b(?:acquire|acquisition|acquisitions|merger|mergers|aquire|aquisition|aquisitions)\b.*" 
2 history entries in list appended to file: chatreferences.csv
Run: --action getRoomHistoryList --room "ExampleGear HR" --file chatreferences.csv --append --regex ".*\b(?:acquire|acquisition|acquisitions|merger|mergers|aquire|aquisition|aquisitions)\b.*" 
1 history entries in list appended to file: chatreferences.csv
Run: --action getRoomHistoryList --room "ExampleGear Marketing" --file chatreferences.csv --append --regex ".*\b(?:acquire|acquisition|acquisitions|merger|mergers|aquire|aquisition|aquisitions)\b.*" 
0 history entries in list
Run completed successfully. 3 actions were successful 

Example CSV file:

Code Block
languagetext
themeDJango
titlechatreferences.csv file
linenumberstrue
"Room","Message Id","Date","Type","Message Format","Message Color","Message","From Id","From Name","From Mention Name","Link Name","Link URL","Link Type"
"ExampleGear Engineering","d75f884d-f5b0-4aa4-ba2c-d273d9da682b","2015-03-25T10:54:04.082-0400","message","","","That'll look great to Acme's auditors as they try to decide whether to follow-thru on the acquisition!","1928057","Hank Johnson","hjohnson","","",""
"ExampleGear Engineering","218e7533-b2b5-40da-91f4-6ff1f9534940","2015-03-25T12:29:59.647-0400","message","","","Whoops, @hjohnson! Everything is hush hush about that subject. There can be absolutely no talk about mergers or acquisitions in public rooms.","1915328","Jasmine Stone","JasmineStone","","",""
"ExampleGear HR","ed202752-f46f-40a9-85a8-ea6c09accda0","2015-03-25T10:42:10.755-0400","message","","","When the acquisition goes through, will HR provide training and guidance to managers on how to communicate the details to their staff?","1915328","Jasmine Stone","JasmineStone","","",""



Create Confluence page

Div
classtime

Image Modified Estimated Time: 2 min

Create a Confluence page that will display the chatreferences.csv file in a table so others can easily review what your language monitoring revealed.

The page consists of 2 items:

  1. An introductory paragraph that describes the purpose of the page or anything else the viewer ought to know.
  2. The CSV macro, which is part of the Advanced Tables for Confluence add-on, configured with the parameters shown on the right.

Save the page, and take note of the space key and the page title.

The space key appears in the URL of the page after you've saved, immediately after "display/". For instance, in the URL http://wiki.examplegear.com/display/EGM/HipChat+Monitoring, the space key is EGM.

 

 

 




Anchor
step4
step4
CSV Macro parameters:

Output format html
Location of CSV data^chatreferences.csv
Auto number each rowselected
Show sort iconselected
Auto sort columnDate
Column typesS,S,M,S,S,S,S,S,S,S,S,S


Edit view of the page:

Image Modified


Create Confluence CLI command

Div
classtime

Image Modified Estimated Time: 1 min

Use the command shown on the right to attach the chatreferences.csv to the Confluence page you just created,

  • confluence indicates to invoke the Confluence CLI client.
  • The addAttachment action indicates to attach a file to a Confluence page.
  • The --title parameter provides the Confluence page's title.
  • The --file parameter provides the name of the file to be attached. (This will generally match what you used on the previous HipChat CLI command.)

Anchor
step5
step5
Example command:

Code Block
languagetext
themeDJango
linenumberstrue
confluence --action addAttachment --space "EGM" --title "HipChat Monitoring"  --file chatreferences.csv



Execute Confluence CLI command

Div
classtime

Image Modified Estimated Time: 1 min

In your command window, type the command from the previous step and press Enter.

The command will run, showing the result of executing the addAttachment action.

(warning) Per the Confluence CLI instructions, your confluence.bat or .sh file contains credentials for a Confluence user. Be sure to use credentials of a user who has read/write access to your Confluence page.

Anchor
step6
step6
Example output:

Code Block
languagetext
themeDJango
linenumberstrue
Attachment 'chatreferences.csv' of type 'text/csv' added to page 'HipChat Monitoring' in space 'EGM', id: 557107, url: http://wiki.examplegear.com/download/attachments/557100/chatreferences.csv?version=2&modificationDate=1427900084733&api=v2



Review Confluence page

Div
classtime

Image Modified Estimated Time: 1 min

In Confluence, navigate to the page you created to verify the chatreferences.csv file is now attached to the page and it reflects the contents of that file.

If this page was already open in your browser, you may need to refresh the page.

 


Anchor
step7
step7
Image Modified


Create a reusable CLI script

Div
classtime

Status
titleOptional
Image Modified Estimated Time: 2 min

If you'd like to save your CLI commands for later reuse, you can save them as a CLI script file.

Using an editor capable of producing a plain text file, such as Notepad (Windows) or TextEdit (Mac), create a script file named:

  • For Windows: monitorRooms.bat
  • For OS X/Linux: monitorRooms

Save it in the same folder to which you installed the HipChat and Confluence CLI clients and make sure it has permissions so that you can read, write and execute it.

Follow these steps in your command window to execute the script file you just created:

  1. Navigate to the folder to which you installed the HipChat and Confluence CLI clients.
  2. Type the name of the script file as shown on the right and press Enter.

The script will run, showing the result of executing each action.

 

Anchor
step8
step8
Contents of example CLI script file:

Code Block
languagetext
themeDJango
linenumberstrue
hipchat --action runFromRoomList --common "--action getRoomHistoryList --room \"@room@\" --file chatreferences.csv --append --regex \".*\b(?:acquire|acquisition|acquisitions|merger|mergers|aquire|aquisition|aquisitions)\b.*\" " 
confluence --action addAttachment --space "EGM" --title "HipChat Monitoring" --file chatreferences.csv 
 


Command to execute reusable script file:

Code Block
languagetext
themeDJango
linenumberstrue
monitorRooms



Include Page
_RecipeTemplateFooter
_RecipeTemplateFooter