Skip to content

team-at-cpan/Net-Async-Slack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

files_upload

Upload file(s) to a channel or thread.

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

AUTHOR

Tom Molesworth TEAM@cpan.org

LICENSE

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