Expand description
Direct messages through the Mattermost REST API as a bot account.
A notification goes to one person only: the bot looks the user up by
username (GET /api/v4/users/username/{name}, cached), opens the direct
channel bot <-> user (POST /api/v4/channels/direct) and posts into it
(POST /api/v4/posts). Nothing is ever posted into a channel and there is
no fallback to one: an unknown or deactivated user is a failure of the chat
delivery with a reason the user reads under Account → Notifications.
The server URL and the bot token are set by the administrator (not by users), the HTTP client follows no redirects (the bearer token must not travel to another host) and ignores proxy environment variables.
classify and dm_text are pure and unit tested; BotClient is the
one network implementation of DirectMessenger.
Structs§
- BotClient
- The Mattermost REST API as a bot.
- Chat
Failure - Why a direct message was not delivered.
Enums§
- Step
- The API call a failure belongs to.
Traits§
- Direct
Messenger - Sends a text as a direct message to a Mattermost user (the bot in production, a recorder in tests).
Functions§
- classify
- Maps an HTTP status of a failed call to what the user (and the retry logic) should learn.
- deactivated
- The failure for a user that exists but is deactivated (
delete_atset). - dm_text
- Text of the direct message: the title links to the object.