{"id":18779327,"url":"https://github.com/zostay/anyevent-slackrtm","last_synced_at":"2026-03-11T07:02:25.766Z","repository":{"id":33314774,"uuid":"36959516","full_name":"zostay/AnyEvent-SlackRTM","owner":"zostay","description":"AnyEvent library for accessing Slack's RTM API","archived":false,"fork":false,"pushed_at":"2022-07-29T18:25:26.000Z","size":62,"stargazers_count":2,"open_issues_count":6,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T11:40:55.577Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zostay.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-05T23:01:11.000Z","updated_at":"2021-11-11T16:44:36.000Z","dependencies_parsed_at":"2022-07-29T19:19:12.745Z","dependency_job_id":null,"html_url":"https://github.com/zostay/AnyEvent-SlackRTM","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/zostay/AnyEvent-SlackRTM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2FAnyEvent-SlackRTM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2FAnyEvent-SlackRTM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2FAnyEvent-SlackRTM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2FAnyEvent-SlackRTM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zostay","download_url":"https://codeload.github.com/zostay/AnyEvent-SlackRTM/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2FAnyEvent-SlackRTM/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30373509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-07T20:19:38.958Z","updated_at":"2026-03-11T07:02:25.751Z","avatar_url":"https://github.com/zostay.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Build Status](https://github.com/zostay/AnyEvent-SlackRTM/actions/workflows/test.yaml/badge.svg)\n[![GitHub issues](https://img.shields.io/github/issues/zostay/AnyEvent-SlackRTM.svg)](https://github.com/zostay/AnyEvent-SlackRTM/issues)\n[![Kwalitee status](https://cpants.cpanauthors.org/dist/AnyEvent-SlackRTM.png)](https://cpants.cpanauthors.org/dist/AnyEvent-SlackRTM)\n[![Coverage Status](https://coveralls.io/repos/zostay/AnyEvent-SlackRTM/badge.svg?branch=master)](https://coveralls.io/r/zostay/AnyEvent-SlackRTM?branch=master)\n\n# NAME\n\nAnyEvent::SlackRTM - AnyEvent module for interacting with the Slack RTM API\n\n# VERSION\n\nversion 1.3\n\n# SYNOPSIS\n\n    use AnyEvent;\n    use AnyEvent::SlackRTM;\n\n    my $access_token = \"\u003cuser or bot token\u003e\";\n    my $channel_id = \"\u003cchannel/group/DM id\u003e\";\n\n    my $cond = AnyEvent-\u003econdvar;\n    my $rtm = AnyEvent::SlackRTM-\u003enew($access_token);\n\n    my $i = 1;\n    my $keep_alive;\n    my $counter;\n    $rtm-\u003eon('hello' =\u003e sub {\n        print \"Ready\\n\";\n\n        $keep_alive = AnyEvent-\u003etimer(interval =\u003e 60, cb =\u003e sub {\n            print \"Ping\\n\";\n            $rtm-\u003eping;\n        });\n\n        $counter = AnyEvent-\u003etimer(interval =\u003e 5, cb =\u003e sub {\n            print \"Send\\n\";\n            $rtm-\u003esend({\n                type =\u003e 'message',\n                channel =\u003e $channel_id,\n                text =\u003e \"\".$i++,\n            });\n        });\n    });\n    $rtm-\u003eon('message' =\u003e sub {\n        my ($rtm, $message) = @_;\n        print \"\u003e $message-\u003e{text}\\n\";\n    });\n    $rtm-\u003eon('finish' =\u003e sub {\n        print \"Done\\n\";\n        $cond-\u003esend;\n    });\n\n    $rtm-\u003estart;\n    AnyEvent-\u003econdvar-\u003erecv;\n\n# DESCRIPTION\n\nThis provides an [AnyEvent](https://metacpan.org/pod/AnyEvent)-based interface to the [Slack Real-Time Messaging API](https://api.slack.com/rtm). This allows a program to interactively send and receive messages of a WebSocket connection and takes care of a few of the tedious details of encoding and decoding messages.\n\nAs of this writing, the library is still a fairly low-level experience, but more pieces may be automated or simplified in the future.\n\n**Disclaimer:** Note also that this API is subject to rate limits and any service limitations and fees associated with your Slack service. Please make sure you understand those limitations before using this library.\n\n# METHODS\n\n## new\n\n    method new($token, $client_opts)\n\nConstructs a [AnyEvent::SlackRTM](https://metacpan.org/pod/AnyEvent%3A%3ASlackRTM) object and returns it.\n\nThe `$token` option is the access token from Slack to use. This may be either of the following type of tokens:\n\n- [User Token](https://api.slack.com/tokens). This is a token to perform actions on behalf of a user account.\n- [Bot Token](https://slack.com/services/new/bot). If you configure a bot integration, you may use the access token on the bot configuration page to use this library to act on behalf of the bot account. Bot accounts may not have the same features as a user account, so please be sure to read the Slack documentation to understand any differences or limitations.\n\nThe `$client_opts` is an optional HashRef of [AnyEvent::WebSocket::Client](https://metacpan.org/pod/AnyEvent%3A%3AWebSocket%3A%3AClient)'s configuration options, e.g. `env_proxy`, `max_payload_size`, `timeout`, etc.\n\n## start\n\n    method start()\n\nThis will establish the WebSocket connection to the Slack RTM service.\n\nYou should have registered any events using [\"on\"](#on) before doing this or you may miss some events that arrive immediately.\n\nSets up a \"keep alive\" timer,\nwhich triggers every 15 seconds to send a `ping` message\nif there hasn't been any activity in the past 10 seconds.\nThe `ping` will trigger a `pong` response,\nso there should be at least one message every 15 seconds.\nThis will disconnect if no messages have been received in the past 30 seconds;\nhowever, it should trigger an automatic reconnect to keep the connection alive.\n\n## metadata\n\n    method metadata() returns HashRef\n\nThe initial connection is established after calling the\n[rtm.connect](https://api.slack.com/methods/rtm.connect) method on the web API.\nThis returns some useful information, which is available here.\n\nThis will only contain useful information _after_ [\"start\"](#start) is called.\n\n## quiet\n\n    method quiet($quiet?) returns Bool\n\nNormally, errors are sent to standard error. If this flag is set, that does not happen. It is recommended that you provide an error handler if you set the quiet flag.\n\n## on\n\n    method on($type, \\\u0026cb, ...)\n\nThis sets up a callback handler for the named message type. The available message types are available in the [Slack Events](https://api.slack.com/events) documentation. Only one handler may be setup for each event. Setting a new handler with this method will replace any previously set handler. Events with no handler will be ignored/unhandled.\n\nYou can specify multiple type/callback pairs to make multiple registrations at once.\n\n## off\n\n    method off(@types)\n\nThis removes the handler for the named `@types`.\n\n## send\n\n    method send(\\%msg)\n\nThis sends the given message over the RTM socket. Slack requires that every message sent over this socket must have a unique ID set in the \"id\" key. You, however, do not need to worry about this as the ID will be set for you.\n\n## ping\n\n    method ping(\\%msg)\n\nThis sends a ping message over the Slack RTM socket. You may add any paramters you like to `%msg` and the return \"pong\" message will echo back those parameters.\n\n## said\\_hello\n\n    method said_hello() returns Bool\n\nReturns true after the \"hello\" message has been received from the server.\n\n## finished\n\n    method finished() returns Bool\n\nReturns true after the \"finish\" message has been received from the server (meaning the connection has been closed). If this is true, this object should be discarded.\n\n## close\n\n    method close()\n\nThis closes the WebSocket connection to the Slack RTM API.\n\n# CAVEATS\n\nThis is a low-level API. Therefore, this only aims to handle the basic message\nhandling. You must make sure that any messages you send to Slack are formatted\ncorrectly. You must make sure any you receive are handled appropriately. Be sure\nto read the Slack documentation basic message formatting, attachment formatting,\nrate limits, etc.\n\n1;\n\n# AUTHOR\n\nAndrew Sterling Hanenkamp \u003chanenkamp@cpan.org\u003e\n\n# COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2022 by Qubling Software LLC.\n\nThis is free software; you can redistribute it and/or modify it under\nthe same terms as the Perl 5 programming language system itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzostay%2Fanyevent-slackrtm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzostay%2Fanyevent-slackrtm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzostay%2Fanyevent-slackrtm/lists"}