Client side API for communicating with a Mattermost server, in Haskell.
We use the MaterMost docker image for detecting changes in the API. See
.travis.yml or the Mattermost
for the details.
If you are testing your changes locally during development, you will want to run
local_test_mm.sh script will stop and remove a docker container
Note: The tests can only be run once against a given Mattermost instance. This is because the scripts currently assume they can create an initial admin user.
Note: The scripts assume the instance is reachable on
localhost:8065 over plain
For use in production we use TLS, but for testing purposes we avoid the certificate setup.
Our Versioning Scheme
This library uses the same versioning scheme as
matterhorn, see Our
The short version is that in
ABBCC corresponds to Mattermost
A.BB.CC and the
X.Y portion of the version string corresponds
to the version of
mattermost-api package releases.
- Added a
UserText, to wrap many API response fields to indicate that they may contain unsafe or unsanitized user input. Also added
unsafeUserTextto unwrap such values when the caller knows that using the unsafe value is appropriate.
- Endpoints: enabled
mmPatchPostand removed duplicate argument type for
- Ensure that file fetching uses the V4 API endpoint.
- The websocket connection now uses the V4 API endpoint.
- submitRequest now also retries on “resource vanished” exceptions.
createPoolnow requires a secure connection argument. Previously it always defaulted to
Truewhich broke insecure connection setups.
- Removed the upper bound from
memoryto support GHC 8.4.
- Fixed the URI for the mmUnflagPost API call.
- Some JSON instances now more precisely handle missing optional fields.
- mattermost-api now supports connection pooling with persistent server connections. A connection pool configuration is required to connect to Mattermost servers (thanks to Abhinav Sarkar)
- Added a websocket event constructor for the
delete_teamevent added in 4.7.
UserSearchtype now wraps optional fields with
Maybe. The field types changed from
Textto the appropriate ID type.
- Removed defunct
- Added an API endpoint function
mmGetUsersByIdsfor getting users by ID.
doRequestfunction used by APIv4 endpoint functions now invokes the connection’s logger to log request method and URI.
- This release provides implementations of many of Mattermost’s version 4 API endpoints in the new Network.Mattermost.Endpoints module. The old version 3 API is still provided by Network.Mattermost but will be deprecated in a future release, and removed after that. Note that this release chiefly exposes version 4 endpoints used by the Matterhorn application; endpoints not used there have not been tested and so are left commented out in this release and may be enabled in future releases as needed.
- This release also provides first-class Haskell types corresponding to the server-side configuration; see Network.Mattermost.Types.Config.
- The Post data type got a new postEditAt field corresponding to the
(at the time) undocumented
edit_atfield of posts.
- Websockets got action support; see Network.Mattermost.WebSocket.mmSendWSAction and the new WebsocketAction type (thanks to Abhinav Sarkar for this change)
- All UTCTimes received from the Mattermost server are wrapped in a
ServerTimenewtype to ensure that users cannot accidentally compare such timestamps to local UTCTimes, since the server time is not necessarily comparable.
- Added Network.Mattermost.Endpoints.mmGetClientConfig to get the client configuration from the server (Thanks to Kelly McLaughlin for this change)
- Added endpoints for some preference endpoints, group channels, and
GroupChannelPreferencestype for showing/hiding group channels
- Separated the previous
- Websocket parse failures are now captured and appear to the library
user as an
Either String WebsocketEvent, where the
Stringrepresent a parse failure.
- Add support for
user_role_updatedwebsocket event type.
- The postRootId of Post is now a Maybe PostId to better reflect the actual wire format.
- MinCommand now has fields for reply parent and root post IDs to support replying to posts with commands such as /me.
- CommandResponse’s commandResponseType is now Maybe to permit optional types.
- PreferenceCategory got a new constructor, PreferenceCategoryLast, mapping to the “last” preference category.
- Added functions for bulk fetching for channel/user data:
- Added support for the
emoji_addedwebsocket event type.
- WEData’s JSON parser now permits both null and empty channel IDs.
- Added lower bound for binary to avoid build failures in the websocket package on GHC 7.10 (see https://github.com/jaspervdj/websockets/pull/155)
- Added support for the
- Added flagged posts API:
- Types: FlaggedPost
- Added preferences API:
- Types: Preference, PreferenceCategory, PreferenceName, PreferenceValue
- Added PostType for post types (joins, parts, header changes, etc.) and changed the type of Post.postType to use this new type.
- Added a new field WEData.wepMentions so that websocket events can include the set of UserIds in a mention set.
- Made most fields of PostPropAttachment optional.
- Added a new PostPropAttachment type as defined by Slack and used by Mattermost.
- Allow null for the “fields” field of PostPropAttachment.
- Extended PostPropAttachment with additional fields to better match the upstream spec.
- Improved the LoginFailureException message format.
- Refrain from logging passwords when logging login requests.
- Logging operations seek to the end of the log in case of a shared log file.
This release supports server version 3.8.2.
- Made the PendingPost
created_atfield optional. It defaults to 0. This behavior is due to Mattermost’s support for admins setting the creation timestamp to values in the past. A value of zero causes the server to use the server’s clock to set the creation timestamp. Any other value is only permitted for users with administrative privileges.
- Moved some types to a new Types.Internal module and exposed that module for testing purposes. It should not be used by anyone wanting a stable API. For a stable API, see the export list for the Types module.
This release supports server version 3.8.2.
Network.Mattermost.Typesmodule is now directly exported and all clients should obtain their types from this import. The types are still exported from
Network.Mattermostto allow time for this change but this export is deprecated will be removed in a future version.
- Added the CommandResponse type for the execute endpoint.
- mmGetMoreChannels, mmGetChannelMembers, and mmGetProfiles now take limit/offset parameters.
- mmGetFile now supports v4 file-fetching.
- Added new constructors to the WebsocketEventType corresponding to server websocket events.
- mmUpdateLastViewedAt was replaced with mmViewChannel.
- Added the WithDefault type to wrap around bools and NotifyOptions.
- Added NotifyProps types.
Tokentype has been replaced with a
Sessiontype, representing a combination of a
ConnectionDatatype. All exposed API functions which require an authenticated connection will use this instead. This is a major breaking change, but makes the API significantly cleaner.
UserProfiletype in favor of single pervasive
- Replaced the return type of
mmGetTeamMembersto use a
TeamMemberinstead of raw JSON
- All API functions how have corresponding HTTP route documentation.
- Source repository was updated.
- Constrained ‘memory’ version to avoid ‘foundation’ dependency.
- Include Network.Mattermost.TH.
Network.Mattermost.Websocketmodule now exports everything exported by
Network.Mattermost.Websocket.Typesin order to cut down on the number of imports needed by users.
- Supports server version 3.7.1.
- Tests now provide websocket event testing infrastructure
- The Channel data type now supports Group channels (type “G”)
- Added mmGetTeamMembers to get the users in a channel
- Added support for the Post type
system_header_changeand the post properties
old_headeras described at https://github.com/mattermost/platform/pull/4209
- Removed the UserProfile type in favor of the User type (fixed #23)
- WebSocket.Types: permit empty
team_idin event data
- Support optional
last_password_updatein mmGetUser responses.
- Renamed ChangeLog.md to CHANGELOG.md.
- Added support for testing websocket events and updated the test suite to check for expected websocket events.
- Export FileInfo type
- Fixed parsing of nullable width/height fields in FileInfo
- Fixed parsing of create_at, update_at, and delete_at timestamp fields in FileInfo
- Added mmDeletePost
- Added mmUpdatePost for editing posts
- Post: make deletion time optional to match server API, do millisecond conversion on JSON encoding
- PendingPost: add fields for setting parents in case of replies
- Export PendingPost type so it can be modified for replies and edits
- Post: do millisecond conversion of timestamps on JSON encoding
- MinCommand lost its unused minComSuggest field
- The JSON format of MinCommand got its channelId field (3.5.0) renamed to channel_id (3.6.0). See also: https://github.com/mattermost/platform/issues/5281
- mmGetJSONBody got a debugging label that it now uses to generate exception messages to indicate what kind of value it was attempting to parse.
Initial release for server version 3.6.0.