From Workspaces 2.2 or plugin Rocket.Chat

Rocket.Chat enables Ametys to offer an instant chat system integrated into project spaces.

It is not possible to use an existing Rocket.Chat server that is already in use elsewhere(even by another instance ofAmetys), for several reasons:
* rights configuration will be modified
* Ametys will automatically create users from their mail address, which must be unique in Rocket.Chat.

Architecture

Depending on the expected traffic, it may be advisable to install Rocket.Chat on a different physical network machine fromAmetys.

The Ametys back-office application must be able to communicate with the Rocket.Chat server and vice versa via http/https.

Project space end-users must also be able to communicate directly with the Rocket.Chat server via http/https.

If at least CMS Ametys or one of the sites is configured in https, then Rocket.Chat must also be configured in https.

Installation

Perform a standard Rocket.Chat installation, but refuse all links to the official Rocket.Chat site at the time of configuration (cloud service has become mandatory, but you can cancel it later, no registration...).

Configuration

  • 1) Create an all-power administrator user who will be used to create users and private rooms.
    This user will be visible in conversation histories, for example: The user raf_utilisateur-local has been added by admin.
  • 2) In this account's preferences (be authenticated with this account, and go to "My account", "Personal access token"), create a personal access token for Ametys (without two-factor authentication) and keep the user ID and this token to put in the configuration. Ametys

Please note that to regenerate the token, you must also deactivate two-factor authentication. Alternatively, you can delete and recreate the token if you've lost it.

  • 2b) In this account's preferences (be authenticated with this account, and go to "My account", "Security"), disable two-factor authentication.
  • 2c) In Administration/Submistription, you need to cancel the Starter plan, to use the unrestricted community version. (it's at the very bottom of the subscription page, cancel... )
  • 3) Administration/Settings/Disposition/CSS Customized
.avatar-image {
border-radius : 100px;
}
#react-user-card + div {
display: none !important;
}
#react-user-card + div .rcx-box {
display: none !important; 
}
#react-user-card .rcx-modal__backdrop {
z-index: -1;
}
.rcx-box.rcx-box--full.rcx-message-header__username {
  display: none;
}

*[data-qa-id="reply-directly"],
*[data-qa-id="reply-in-thread"],
*[data-qa-id="Reply_in_thread"],
*[data-qa-id="Forward_message"],
*[data-qa-id="mark-message-as-unread"],
*[data-id="Link"],
*[data-id="KaTeX"],
*[data-qa-id="audio-message"],
*[data-qa-id="video-message"],
button[title="More actions"],
*[data-id="KaTeX"] + hr,
*[data-key="copy"],
*[data-key="star-message"],
*[data-key="follow-message"],
*[data-key="mark-message-as-unread"],
*[data-key="permalink"],
*[data-qa-id="menu"] hr,
*[data-qa-id="menu"] [role="presentation"]:not(:last-child){
display: none !important;
}
  • 4) Administration/Settings/Customized scripts/Customized rcipt for logged-in users
document.addEventListener('click', e => {
const url = (window.location != window.parent.location)
? document.referrer
: document.location.href,
memberCard = e.target.closest('.user-card-message')
if (memberCard) {
parent.postMessage({
evtname: 'user-card-click',
username: memberCard.parentNode.getAttribute('data-username'),
id: memberCard.parentNode.getAttribute('data-id')
}, url);
}
})

window.navigation.addEventListener("navigate", (event) => { 
    if (/.*(\?|&)msg=[^&]+/.test(event.destination.url)) 
    {
        parent.postMessage({eventName: "scrolling-to-message", data: { url : window.location.href }}, "*");
    }
})

window.addEventListener("popstate",  (event) => {
    parent.postMessage({eventName: "iframe-change", data: { url : window.location.href}}, "*");
});

window.addEventListener('keydown', (event) => {
  if (event.key === "Escape") {
    parent.postMessage({eventName: "escaped", data: { url : window.location.href}}, "*");
  }
});
  • 5) In Administration/Parameters/General: "Number of unread messages" AND "Number of unread messages for private messages", indicate "all messages".
  • 5b) In Administration/Parameters/General: in Rest API according to the version, Activate "Activate CORS" and in "Origin of CORS" put the basicURL of project spaces for example: "https://projects.ametys.io" or "*".
  • 5c) In Administration/Parameters/General: Iframe integration, enable sending and enable receiving. + For both, set the basicURL for project spaces or "*".
  • 5d) In Administration/Settings/General: NPS: deactivate "Enable NPS survey".
  • 5e) In Administration/Settings/Layout/User interface: select Use real name
  • 6) Go to Administration/Settings/Load files and disable protection of loaded files
  • 7) In Administration/Authorization, "user" profile (click on 100 at the bottom of the page for fewer pages), remove all rights except the following (Note that the list of rights is paginated on many pages)
    1. Create direct messages
    2. Delete Own Message
    3. Mention @all
    4. Mention here
    5. Display direct messages
    6. View history
    7. See the private lounge
  • 8) In Administration/Settings/Accounts, deactivate
    • two-factor authentication
    • Profile change
    • Changing your avatar
    • The name change
    • Changing your username
    • Changing your password
    • The change ofemail
    • Default user preference
      • Disable mobile bandwidth saving

Please note: if you're installing Rocket.chat on existing project spaces, we recommend that you synchronize the chat servers after installation (see here).

Back to top