Aller au contenu

Matrix Notifications

Ce contenu n’est pas encore disponible dans votre langue.

Overview

  • Source: https://matrix.org/
  • Image Support: Yes
  • Attachment Support: Yes
  • Message Character Limits:
    • Body: 65000

By default the Apprise Integration of Matrix occurs using it’s built in API.

However, the webhook service also works for those wishing to use it too. At the time, this is still identified as being in it’s late beta state. This can be done by specifying ?mode=matrix or ?mode=slack. Presuming you’ve set it up.

Valid syntax is as follows:

  • matrix://{user}:{password}@{hostname}/#{room_alias}
  • matrixs://{user}:{password}@{hostname}/!{room_id}

You can mix and match as many rooms as you wish:

  • matrixs://{user}:{password}@{matrixhost}/!{room_id}/#{room_alias}/

Note: If no user and/or password is specified, then the matrix registration process is invoked. The matrix servers actually allow this (if enabled to do so in their configuration) to connect as a temporary user with/without a password and/or user-name. Under normal circumstances you should probably always supply a {user} and {password}.

Note: Federated rooms identifiers are fully supported by Apprise. If no hostname is found in the {room_id} and/or {room_alias} entries specified, then apprise automatically uses the hostname returned to it (internally) upon login. For example, assume the following url:
matrix://user:pass@localhost/#room/#room:example.com/!abc123/!def456:example.com:

  • #room is internally interpreted as #room:localhost before it is accessed.
  • #room:example.com is not altered and is directly notified as such
  • !abc123 is internally interpreted as !abc123:localhost
  • !def456:example.com is not altered and is directly notified as such

When you specify the ?mode= argument you immediately shift entirely how this plugin works and the syntax becomes:

  • matrix://{user}:{token}@{hostname}?mode=matrix
  • matrixs://{token}@{hostname}:{port}?mode=matrix
  • matrix://{user}:{token}@{hostname}?mode=slack&format=markdown
  • matrixs://{token}@{hostname}?mode=slack&format=markdown

If you use t2bot.io, then you can use the following URLs:

  • matrix://{t2bot_webhook_token}
  • matrix://{user}@{t2bot_webhook_token}

You can also just use the t2bot URL as they share it with you from their website:

  • https://webhooks.t2bot.io/api/v1/matrix/hook/{t2bot_webhook_token}
VariableRequiredDescription
hostname*YesThe matrix server you wish to connect to.
t2bot_webhook_token*YesThis is effectively the hostname but acts as the t2bot webhook token if the mode is set to t2bot. Apprise is smart enough to determine the mode provided you follow the t2bot URL examples explained above. This field becomes the hostname in all other cases.
userNoThe user to authenticate (and/or register) with the matrix server
passwordNoThe password to authenticate (and/or register) with the matrix server
portNoThe server port Matrix is listening on. By default matrixs:// uses a secure port port of 443 while matrix:// uses port 80.
room_aliasNoThe room alias you wish to join (if not there already) and broadcast your notification. For ambiguity purposes you should prefix these locations with a pound/hashtag symbol # although it is not required.
room_idNoThe room id you wish to join (if not there already) and broadcast your notification. For ambiguity purposes, you MUST prefix these locations with a exclamation symbol ! (otherwise it is interpreted as a room_alias instead)
thumbnailNoDisplays an image before each notification is sent that identifies the notification type (warning, info, error, success). By default this option is set to False.
modeNoThis is optional and allows you to specify a webhook mode instead. Setting this to matrix or slack allows you to leverage this webhook service instead of directly communicating with the matrix server. By default no webhooks are used.
msgtypeNoThis is optional and allows you to specify a Matrix message type to use. Possible options are text and notice. By default all messages are sent as text.
versionNoOptionally over-ride the API version of matrix to use. Possible values are 2 and 3. By default the version is set to 3.

Note: If neither a {room_alias} or a {room_id} is specified on the URL then upon connecting to the matrix server, a list of currently joined channels will be polled. Each and every channel the account is currently part of will automatically be notified.

VariableDescription
overflowThis parameter can be set to either split, truncate, or upstream. This determines how Apprise delivers the message you pass it. By default this is set to upstream
👉 upstream: Do nothing at all; pass the message exactly as you received it to the service.
👉 truncate: Ensure that the message will fit within the service’s documented upstream message limit. If more information was passed then the defined limit, the overhead information is truncated.
👉 split: similar to truncate except if the message doesn’t fit within the service’s documented upstream message limit, it is split into smaller chunks and they are all delivered sequentially there-after.
formatThis parameter can be set to either text, html, or markdown. Some services support the ability to post content by several different means. The default of this varies (it can be one of the 3 mentioned at any time depending on which service you choose). You can optionally force this setting to stray from the defaults if you wish. If the service doesn’t support different types of transmission formats, then this field is ignored.
verifyExternal requests made to secure locations (such as through the use of https) will have certificates associated with them. By default, Apprise will verify that these certificates are valid; if they are not then no notification will be sent to the source. In some occasions, a user might not have a certificate authority to verify the key against or they trust the source; in this case you will want to set this flag to no. By default it is set to yes.
ctoThis stands for Socket Connect Timeout. This is the number of seconds Requests will wait for your client to establish a connection to a remote machine (corresponding to the connect()) call on the socket. The default value is 4.0 seconds.
rtoThis stands for Socket Read Timeout. This is the number of seconds the client will wait for the server to send a response. The default value is 4.0 seconds.
emojisEnable Emoji support (such as providing :+1: would translate to 👍). By default this is set to no.
Note: Depending on server side settings, the administrator has the power to disable emoji support at a global level; but default this is not the case.
tzIdentify the IANA Time Zone Database you wish to operate as. By default this is detected based on the configuration the server hosting Apprise is running on. You can set this to things like America/Toronto, or any other properly formated Timezone describing your area.

Send a secure Matrix.org notification to our server

Terminal window
# Assuming our {hostname} is matrix.example.com
# Assuming our {user} is nuxref
# Assuming our {password} is abc123
# Assuming the {room_alias} we want to notify is #general and #apprise
apprise -vv -t "Test Message Title" -b "Test Message Body" \
matrixs://nuxref:abc123@matrix.example.com/#general/#apprise
# Attachments do not work using the Matrix v3 version; use the
# following to fall back to an earlier API version:
apprise -vv -t "Test Message Title" -b "Test Message Body" \
matrixs://nuxref:abc123@matrix.example.com/#general/#apprise?v=2

Send a t2bot.io request:

Terminal window
# Assuming our {webhook} is ABCDEFG12345
apprise -vv -t "Test Message Title" -b "Test Message Body" \
matrix://ABCDEFG12345