{"id":18779367,"url":"https://github.com/zostay/bot-backbone-service-slackchat","last_synced_at":"2025-12-18T00:30:19.084Z","repository":{"id":33315025,"uuid":"36959767","full_name":"zostay/Bot-Backbone-Service-SlackChat","owner":"zostay","description":"Chat service adapter for Slack","archived":false,"fork":false,"pushed_at":"2016-10-03T02:10:43.000Z","size":26,"stargazers_count":1,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-29T10:29:18.040Z","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:10:26.000Z","updated_at":"2016-06-23T14:44:27.000Z","dependencies_parsed_at":"2022-08-28T20:10:51.374Z","dependency_job_id":null,"html_url":"https://github.com/zostay/Bot-Backbone-Service-SlackChat","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2FBot-Backbone-Service-SlackChat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2FBot-Backbone-Service-SlackChat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2FBot-Backbone-Service-SlackChat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zostay%2FBot-Backbone-Service-SlackChat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zostay","download_url":"https://codeload.github.com/zostay/Bot-Backbone-Service-SlackChat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239690606,"owners_count":19681130,"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":[],"created_at":"2024-11-07T20:19:49.011Z","updated_at":"2025-12-18T00:30:19.029Z","avatar_url":"https://github.com/zostay.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nBot::Backbone::Service::SlackChat - Connect and chat with a Slack server\n\n# VERSION\n\nversion 0.151570\n\n# SYNOPSIS\n\n    package MyBot;\n    use Bot::Backbone;\n\n    service slack_chat =\u003e (\n        service =\u003e 'SlackChat',\n        token   =\u003e '...', # see slack.com for your tokens\n    );\n\n    service dice =\u003e (\n        service =\u003e 'OFun::Dice',\n    );\n\n    service \"general_chat\" =\u003e (\n        service    =\u003e 'GroupChat',\n        chat       =\u003e 'SlackChat',\n        group      =\u003e 'C',\n        dispatcher =\u003e 'general_dispatch',\n    );\n\n    dispatcher 'general_dispatch' =\u003e as {\n        redispatch_to \"dice\";\n    };\n\n    __PACKAGE__-\u003enew-\u003erun;\n\n# DESCRIPTION\n\nThis allows a [Bot::Backbone](https://metacpan.org/pod/Bot::Backbone) chat bot to be connect to a Slack server using their Real-Time Messaging API.\n\nThis is based on [AnyEvent::SlackRTM](https://metacpan.org/pod/AnyEvent::SlackRTM) and [WebService::Slack::WebApi](https://metacpan.org/pod/WebService::Slack::WebApi). It also uses a [CHI](https://metacpan.org/pod/CHI) cache to help avoid contacting the Slack server too often, which could result in your bot becoming rate limited.\n\n# ATTRIBUTES\n\n## token\n\nThe `token` 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\nWhich you use will depend on whether you want the bot to control a user account or a bot integration account. You are responsible for adhering to the Slack terms of use in whatever you do.\n\n## cache\n\nThis is a [CHI](https://metacpan.org/pod/CHI) cache to use to temporarily store response from the Slack APIs. By default, this is a memory-only cache that caches data for only 60 seconds. The purpose is mainly to prevent repeated requests to the API, which might result in rate limiting.\n\n## api\n\nThis is the [WebService::Slack::WebApi](https://metacpan.org/pod/WebService::Slack::WebApi) object used to contact Slack for information about channels, users, etc.\n\n## rtm\n\nThis is the [AnyEvent::SlackRTM](https://metacpan.org/pod/AnyEvent::SlackRTM) object used to communicate with Slack and trigger events from the Real-Time Messaging API.\n\n## error\\_callback\n\nThis is a callback sub that may be used to report error events from the RTM API. Set it to a sub that will be called as follows:\n\n    sub {\n        my ($self, $rtm, $message) = @_;\n\n        ...\n    }\n\nHere, `$self` is the [Bot::Backbone::Service::SlackChat](https://metacpan.org/pod/Bot::Backbone::Service::SlackChat) object, `$rtm` is the [AnyEvent::SlackRTM](https://metacpan.org/pod/AnyEvent::SlackRTM) object, and `$message` is a hash containing the error message, as described on the [Real Time Messaging API](https://api.slack.com/rtm) documentation.\n\n## whoami\n\nThis returns a hash containing information about who the bot is.\n\n# METHODS\n\n## user\n\nReturns the name of the bot.\n\n## user\\_id\n\nReturns the user ID for the bot.\n\n## team\\_id\n\nReturns the team ID for the team account.\n\n## initialize\n\nThis connects to Slack and prepares the bot for communication.\n\n## load\\_user\n\n    method load_user($by, $value) returns Bot::Backbone::Identity\n\nFetches information about a user from Slack and returns the user as a [Bot::Backbone::Identity](https://metacpan.org/pod/Bot::Backbone::Identity). The `$by` setting determines how the user is looked up, which may either be by \"id\" or by \"name\". The value, then, is the value to check.\n\n## load\\_me\n\n    method load_me() returns Bot::Backbone::Identity\n\nReturns the identity object for the bot itself.\n\n## load\\_user\\_channel\n\n    method load_user_channel($by, $value) returns Str\n\nReturns the ID of a user's IM channel. Here `$by` may be \"user\" to lookup by user ID.\n\n## join\\_group\n\n    method join_group({ group =\u003e $group })\n\nGiven the ID of a channel or group, this causes the bot to open or join it. Note that Slack bot integration accounts might not be able to join team channels, but may still be invited.\n\n## got\\_message\n\nHandles messages from Slack. Decides whether they are group messages or direct and forwards them on as appropriate. Messages with a \"subtype\" will be ignored as will messages that are \"edited\".\n\nThis method also marks messages as read. \n\n## got\\_direct\\_message\n\nHandles direct messages received from an IM channel.\n\n## is\\_to\\_me\n\nThis determines whether or not the message is to the bot.\n\n## got\\_group\\_message\n\nThis handles message received from private group or team channels.\n\n## send\\_message\n\n    method send_message({\n        to    =\u003e $user_id,\n        group =\u003e $group_id,\n        text  =\u003e $message,\n    })\n\nThis sends a message to a Slack channel. To the named user's IM channel or to a private group or team channel named by `$group_id`.\n\n# AUTHOR\n\nAndrew Sterling Hanenkamp \u003chanenkamp@cpan.org\u003e\n\n# COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2015 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%2Fbot-backbone-service-slackchat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzostay%2Fbot-backbone-service-slackchat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzostay%2Fbot-backbone-service-slackchat/lists"}