{"id":23577158,"url":"https://github.com/n7st/webservice-mattermost","last_synced_at":"2025-05-05T23:13:21.862Z","repository":{"id":46021231,"uuid":"170408683","full_name":"n7st/WebService-Mattermost","owner":"n7st","description":"Perl client library for Mattermost","archived":false,"fork":false,"pushed_at":"2025-01-02T17:40:28.000Z","size":530,"stargazers_count":7,"open_issues_count":7,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-05T23:13:16.919Z","etag":null,"topics":["integration","mattermost","perl","perl5","websocket-client"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/n7st.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-12T23:42:30.000Z","updated_at":"2025-01-02T17:40:31.000Z","dependencies_parsed_at":"2024-12-26T22:39:01.230Z","dependency_job_id":null,"html_url":"https://github.com/n7st/WebService-Mattermost","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n7st%2FWebService-Mattermost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n7st%2FWebService-Mattermost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n7st%2FWebService-Mattermost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n7st%2FWebService-Mattermost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/n7st","download_url":"https://codeload.github.com/n7st/WebService-Mattermost/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252590632,"owners_count":21772940,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["integration","mattermost","perl","perl5","websocket-client"],"created_at":"2024-12-26T22:27:03.870Z","updated_at":"2025-05-05T23:13:21.825Z","avatar_url":"https://github.com/n7st.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebService::Mattermost ![test status](https://github.com/n7st/webservice-mattermost/workflows/test/badge.svg)\n\n`WebService::Mattermost` is a suite for interacting with Mattermost chat servers.\nIt includes an API client and a WebSocket gateway.\n\nSee individual POD files for details.\n\n## Installation\n\n### From CPAN\n\n```\n% cpanm WebService::Mattermost\n```\n\n### Manual\n\n```\n% git clone git@github.com:n7st/WebService-Mattermost.git\n% cd WebService-Mattermost\n% dzil listdeps | cpanm\n% dzil authordeps | cpanm\n% dzil install\n```\n\n## API usage\n\nCurrently, only API version 4 (latest) is supported.\n\n```perl\nuse WebService::Mattermost;\n\nmy $mattermost = WebService::Mattermost-\u003enew({\n    authenticate =\u003e 1, # Log into Mattermost\n    debug        =\u003e 1, # Output some debug-level information via Mojo::Log\n    username     =\u003e 'email@address.com',\n    password     =\u003e 'hunter2',\n    base_url     =\u003e 'https://my.mattermost.server.com/api/v4/',\n});\n\n# API methods available under:\nmy $api = $mattermost-\u003eapi;\n```\n\n## WebSocket gateway usage\n\n### Emitted events\n\n| Event                 | Purpose                                                              |\n| :-------------------- | :------------------------------------------------------------------- |\n| `gw_message_no_event` | A message with no event type was received (ping or unknown event)    |\n| `gw_ws_started`       | The WebSocket client started                                         |\n| `gw_ws_finished`      | The WebSocket client's connection was closed                         |\n| `gw_ws_error`         | An error occurred                                                    |\n| `gw_message`          | A chat message was received                                          |\n\n### Extending with `Moo` or `Moose` \n\n```perl\npackage SomePackage;\n\nuse Moo;\n\nextends 'WebService::Mattermost::V4::Client';\n\n# WebService::Mattermost::V4::Client emits events which can be caught with these\n# methods. None of them are required and they all pass two arguments ($self,\n# HashRef $args).\nsub gw_ws_started {}\n\nsub gw_ws_finished {}\n\nsub gw_message {\n    my $self = shift;\n    my $args = shift;\n\n    # The message's data is in $args\n}\n\nsub gw_ws_error {}\n\nsub gw_message_no_event {}\n\n1;\n```\n\n### As a script\n\n```perl\nuse WebService::Mattermost::V4::Client;\n\nmy $bot = WebService::Mattermost::V4::Client-\u003enew({\n    username =\u003e 'usernamehere',\n    password =\u003e 'password',\n    base_url =\u003e 'https://mattermost.server.com/api/v4/',\n\n    # Optional arguments\n    debug                     =\u003e 1,   # Show extra connection information\n    ignore_self               =\u003e 0,   # May cause recursion!\n    reauthentication_interval =\u003e 600, # Shorten the reauthentication loop delay\n});\n\n$bot-\u003eon(gw_message =\u003e sub {\n    my ($bot, $args) = @_;\n\n    # $args contains the decoded message content\n});\n\n$bot-\u003estart(); # Add me last\n```\n\nThe available events are the same. See [here](#emitted-events) for a full list.\n\n## Running the test suite\n\n```\n% dzil test\n```\n\n## License\n\nMIT. See LICENSE.txt.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn7st%2Fwebservice-mattermost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fn7st%2Fwebservice-mattermost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn7st%2Fwebservice-mattermost/lists"}