
= Mattermost Notifications
:description: How to use webhooks to configure {page-component-title} to send notifications through Mattermost.

If your organization uses https://mattermost.com/[Mattermost], you can configure {page-component-title} to send notices to any channel via an incoming webhook.
You must configure an incoming webhook in your Mattermost settings and manually configure some settings in your {page-component-title} instance.

For more information on incoming webhooks in Mattermost, see the https://docs.mattermost.com/developer/webhooks-incoming.html[Mattermost Integration Guide].

== Setup

First, add the following XML to `notificationCommands.xml` (no customization should be needed):

[source, xml]
----
<command binary="false">
  <name>mattermost</name>
  <execute>org.opennms.netmgt.notifd.MattermostNotificationStrategy</execute>
  <comment>class for sending messages to a Mattermost team channel for notifications</comment>
  <argument streamed="false">
    <switch>-subject</switch>
  </argument>
  <argument streamed="false">
    <switch>-tm</switch>
  </argument>
</command>
----

Create `mattermost.properties` in your `opennms.properties.d` directory, and insert the following property:

[source, properties]
org.opennms.netmgt.notifd.mattermost.webhookURL=https://mattermost.example.com/hooks/bf980352b5f7232efe721dbf0626bee1

Customize its values as appropriate for your organization.

{page-component-title} loads `mattermost.properties` upon restart.
After it is loaded, your new `mattermost` notification command will be available for use in a destination path.

== Additional configuration options

The following table lists optional properties that you may use in `mattermost.properties` to customize your Mattermost notifications:

[cols="2,2,1,1"]
|===
| Parameter | Description | Default Value | Example

| org.opennms.netmgt.notifd.mattermost.channel
| Specify a channel or private group other than the one targeted by the webhook.
| _Webhook default_
| NetOps

| org.opennms.netmgt.notifd.mattermost.username
| The username to associate with the notification posts.
| _Blank_
| OpenNMS_Bot

| org.opennms.netmgt.notifd.mattermost.iconEmoji
| An emoji sequence to use as the icon for the notification posts.
| _Blank_
| :metal:

| org.opennms.netmgt.notifd.mattermost.iconURL
| The URL of an image to use as the icon for the notification posts.
| _Blank_
| \https://example.org/assets/icon.png

| org.opennms.netmgt.notifd.mattermost.useSystemProxy
| Should the system-wide proxy settings be used?
Configure the system proxy settings via <<deep-dive/admin/configuration/system-properties.adoc#ga-opennms-system-properties, system properties>>.
| true
| true
|===

IMPORTANT: Some of the optional configuration parameters are not compatible with some versions of Mattermost.
