Versions Compared

Key

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

Status
colourYellow
titleIN PROGRESSBETA

RocketChat is an open source messaging platform that enables secure team collaboration. It competes with Slack but allows different hosting options, including self-hosting and SaaS cloud hosting. 

...

Configuring the RocketChat Connection

In order to send RocketChat notifications from Issue and Post function events, you need to set up a Personal Access Token RocketChat. JEMHCloud will use that access token to authenticate to your RocketChat service when sending notifications.

RocketChat provides an open instance for anybody to quickly try their services without installing or requiring a trial. The instance is https://open.rocket.chat. We will use the open cloud instance when integrating RocketChat with JEMHCloud and Jira.

...

For this step, we are assuming that you have a RocketChat server already configured. The server can be one you have installed in your infrastructure or the one cloud instance RocketChat hosts.  

  1. To create a new Personal Access Token, log into your RocketChat instance (https://open.rocket.chat in our case). 
  2. Click on your avatar → My Account → Personal Access Tokens
  3.   
  4. Enter a name to the token a and click Add
  5. A popup dialog will display your personal token credentials (user id and token). Copy and paste them somewhere safe. JEMHCloud will require those credentials.

...

Info

Note: The author of the messages will the user that owns the personal access token. If you want a different more generic name, you would need to create the a RocketChat integration user (for example Jira or JEMHC) and create the personal access token using that user.

...

  1. Go to JEMHCloud → Messages → RocketChat Connections
  2. Click on Create button.
  3. Once in the RocketChat Connection form, enter the rocket chat base URL (https://open.rocket.chat in our case), the user id and token created in the Personal Access Token sections of RocketChat. 
  4. Submit. If the configuration is ok, you should see a test message in RocketChat's room/channel

Create JEMHCloud's RocketChat Notification Mapping

Like Email, Slack and SMS Notification Mapping, RocketChat Notification Mapping is in charge of sending RocketChat messages from Issue events through the RocketChat Connection.

...

  1. Go to JEMH Cloud → Notifications → RocketChat → Create
  2. Complete the form, select the nominated project, select the RocketChat Connection and the newly created channel/room. Enter a velocity script if you want to modify the notification behavior at runtime (more below).
  3. On Submit, you should see the new RocketChat mapping
  4. To test the mapping, create an issue in the nominated project and go to Auditing → Events
  5. You should see the issue created event in the queue. When the event has been processed, the configured channel in the mapping should have received a RocketChat message
  6. Image Modified
  7. The report of the event should confirm the message sent 
  8. Image Modified
  9. In Auditing → Outbound Messages → Type RocketChat, the . The table should show the Rocket.Chat messages sent and the cog icon should show their contents.

Send RocketChat Notifications from Post Functions

...

Adding the RocketChat Notification Post Function to workflow transition:

  1. Go to right corner Cog → JIRA Administration → Issue → Workflows. Edit the workflow of the project you want to add the Post Function
  2. Click on the transition you want to change and select the Post Functions tab. Click on Add post function
  3. Select Send RocketChat Notification by JEMHCloud and click Add
  4. Image Modified
  5. Set the RocketChat Connection and Velocity script if necessary. Press Add/Update
  6. Image Modified
  7. Once the Post Function is in the right position, publish the workflow draft.
  8. Image Modified
  9. To test the post function, go to an issue of the given workflow and perform the transition that will fire the post function.
  10. Image Modified
  11. Post function event should appear in JEMH Cloud → Notifications → Events.
  12. Image Modified
  13. The event report should show the used incoming webhook URL (part of the URL is hashed for security reasons)
  14. The message in RocketChat:
  15. Image Modified
  16. In Auditing → Outbound Messages , the → Type  → Rocket.Chat the table should show the RocketChat messages sent and the cog icon should show their contents.

Filter Scripts

Both RocketChat Notification Mapping and RocketChat Post Function behavior can be changed at runtime with a Velocity Script. The script can use the event data or be time-based to change how notifications are performed.

...

Code Block
titleChange channel when Critical
#if ($context.issue.fields.priority.name.textValue() != 'Critical')
  $RocketChatNotificationUtils.setRoom('anotherRocketChatRoom') ## JEMHC to send the message to a Rocke.Chat room. It can be the room id or the room name.
#end

Restrict notifications to specific time ranges

...