The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::Async::Slack - support for the https://slack.com APIs with IO::Async

SYNOPSIS

 use IO::Async::Loop;
 use Net::Async::Slack;
 my $loop = IO::Async::Loop->new;
 $loop->add(
  my $slack = Net::Async::Slack->new(
   token => '...',
  )
 );

DESCRIPTION

This is a basic wrapper for Slack's API. It's an early version, the module API is likely to change somewhat over time.

See the examples/ directory for usage.

METHODS

rtm

Establishes a connection to the Slack RTM websocket API, and resolves to a Net::Async::Slack::RTM instance.

send_message

Send a message to a user or channel.

Supports the following named parameters:

and the following named boolean parameters:

  • link_names - convert @user and #channel to links

  • unfurl_links - show preview for URLs

  • unfurl_media - show preview for things that look like media links

  • as_user - send as user

  • reply_broadcast - send to all users when replying to a thread

Returns a Future, although the content of the response is subject to change.

conversations_info

Provide information about a channel.

Takes the following named parameters:

  • channel - the channel ID to look up

and returns a Future which will resolve to a hashref containing { channel => { name => '...' } }.

join_channel

Attempt to join the given channel.

Takes the following named parameters:

  • channel - the channel ID or name to join

METHODS - Internal

endpoints

Returns the hashref of API endpoints, loading them on first call from the share/endpoints.json file.

endpoint

Processes the given endpoint as a template, using the named parameters passed to the method.

oauth_request

token

API token.

http

Returns the HTTP instance used for communicating with the API.

Currently autocreates a Net::Async::HTTP instance.

http_get

Issues an HTTP GET request.

http_post

Issues an HTTP POST request.

SEE ALSO

INHERITED METHODS

IO::Async::Notifier

add_child, adopt_future, adopted_futures, can_event, children, configure_unknown, debug_printf, get_loop, invoke_error, invoke_event, loop, make_event_cb, maybe_invoke_event, maybe_make_event_cb, new, notifier_name, parent, remove_child, remove_from_parent

Net::Async::Slack::Commands

admin_apps_approve, admin_apps_approved_list, admin_apps_requests_list, admin_apps_restrict, admin_apps_restricted_list, admin_conversations_archive, admin_conversations_convert_to_private, admin_conversations_create, admin_conversations_delete, admin_conversations_disconnect_shared, admin_conversations_ekm_list_original_connected_channel_info, admin_conversations_get_conversation_prefs, admin_conversations_get_teams, admin_conversations_invite, admin_conversations_rename, admin_conversations_restrict_access_add_group, admin_conversations_restrict_access_list_groups, admin_conversations_restrict_access_remove_group, admin_conversations_search, admin_conversations_set_conversation_prefs, admin_conversations_set_teams, admin_conversations_unarchive, admin_emoji_add, admin_emoji_add_alias, admin_emoji_list, admin_emoji_remove, admin_emoji_rename, admin_invite_requests_approve, admin_invite_requests_approved_list, admin_invite_requests_denied_list, admin_invite_requests_deny, admin_invite_requests_list, admin_teams_admins_list, admin_teams_create, admin_teams_list, admin_teams_owners_list, admin_teams_settings_info, admin_teams_settings_set_default_channels, admin_teams_settings_set_description, admin_teams_settings_set_discoverability, admin_teams_settings_set_icon, admin_teams_settings_set_name, admin_usergroups_add_channels, admin_usergroups_add_teams, admin_usergroups_list_channels, admin_usergroups_remove_channels, admin_users_assign, admin_users_invite, admin_users_list, admin_users_remove, admin_users_session_invalidate, admin_users_session_reset, admin_users_set_admin, admin_users_set_expiration, admin_users_set_owner, admin_users_set_regular, api_test, apps_event_authorizations_list, apps_permissions_info, apps_permissions_request, apps_permissions_resources_list, apps_permissions_scopes_list, apps_permissions_users_list, apps_permissions_users_request, apps_uninstall, auth_revoke, auth_test, bots_info, calls_add, calls_end, calls_info, calls_participants_add, calls_participants_remove, calls_update, chat_delete, chat_delete_scheduled_message, chat_get_permalink, chat_me_message, chat_post_ephemeral, chat_post_message, chat_schedule_message, chat_scheduled_messages_list, chat_unfurl, chat_update, conversations_archive, conversations_close, conversations_create, conversations_invite, conversations_join, conversations_kick, conversations_leave, conversations_list, conversations_mark, conversations_members, conversations_open, conversations_rename, conversations_replies, conversations_set_purpose, conversations_set_topic, conversations_unarchive, dialog_open, dnd_end_dnd, dnd_end_snooze, dnd_info, dnd_set_snooze, dnd_team_info, emoji_list, files_comments_delete, files_delete, files_info, files_list, files_remote_add, files_remote_info, files_remote_list, files_remote_remove, files_remote_share, files_remote_update, files_revoke_public_url, files_shared_public_url, files_upload, migration_exchange, oauth_access, oauth_token, oauth_v2_access, pins_add, pins_list, pins_remove, reactions_add, reactions_get, reactions_list, reactions_remove, reminders_add, reminders_complete, reminders_delete, reminders_info, reminders_list, rtm_connect, search_messages, stars_add, stars_list, stars_remove, team_access_logs, team_billable_info, team_info, team_integration_logs, team_profile_get, usergroups_create, usergroups_disable, usergroups_enable, usergroups_list, usergroups_update, usergroups_users_list, usergroups_users_update, users_conversations, users_delete_photo, users_get_presence, users_identity, users_info, users_list, users_lookup_by_email, users_profile_get, users_profile_set, users_set_active, users_set_photo, users_set_presence, views_open, views_publish, views_push, views_update, workflows_step_completed, workflows_step_failed, workflows_update_step

AUTHOR

Tom Molesworth <TEAM@cpan.org>

LICENSE

Copyright Tom Molesworth 2016-2021. Licensed under the same terms as Perl itself.