GithubHelp home page GithubHelp logo

hcca2000 / p5-webservice-slack-webapi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mihyaeru21/p5-webservice-slack-webapi

0.0 2.0 0.0 78 KB

a simple wrapper for Slack Web API

License: MIT License

Perl 100.00%

p5-webservice-slack-webapi's Introduction

Build Status Coverage Status

NAME

WebService::Slack::WebApi - a simple wrapper for Slack Web API

SYNOPSIS

use WebService::Slack::WebApi;

# the token is required unless using $slack->oauth->access
my $slack = WebService::Slack::WebApi->new(token => 'access token');

# getting channel's descriptions
my $channels = $slack->channels->list;

# posting message to specified channel and getting message description
my $posted_message = $slack->chat->post_message(
    channel  => 'channel id', # required
    text     => 'hoge',       # required (not required if 'attachments' argument exists)
    username => 'fuga',       # optional
    # other optional parameters...
);

DESCRIPTION

WebService::Slack::WebApi is a simple wrapper for Slack Web API (https://api.slack.com/web).

Options

You can set some options by giving opt parameter to new method. Almost values of opt are gived to Furl#new.

WebService::Slack::WebApi->new(token => 'access token', opt => {});

Proxy

opt can contain env_proxy as boolean value . If env_proxy is true then proxy settings are loaded from $ENV{HTTP_PROXY} and $ENV{NO_PROXY} by calling Furl#env_proxy method. See also https://metacpan.org/pod/Furl#furl-env\_proxy.

METHODS

This module provides all methods declared in the API reference (https://api.slack.com/methods).

Basis

WebService::Slack::WebApi::Namespace::method_name corresponds to namespace.methodName in Slack Web API. For example WebService::Slack::WebApi::Chat::post_message corresponds to chat.postMessage. You describe as below to call Chat::post_message method.

my $result = $slack->chat->post_message;

Return value

All methods return HashRef. When you want to know what is contained in HashRef, see the API reference.

The token parameter

The API reference shows chat.update method require 4 parameters: token, ts, channel and text. When using this module token parameter is added implicitly except using oauth.access method. So you pass the other 3 parameters to Chat::update method as shown below.

my $result = $slack->chat->update(
    ts      => '1401383885.000061',  # as Str
    channel => 'channel id',
    text    => 'hoge',
);

Optional parameters

Some methods have optional parameters. If a parameter is optional in the API reference, it is also optional in this module.

Not primitive parameters

These parameters are not primitive:

  • files.upload.file: string of path to local file
  • files.upload.channels: ArrayRef of channel id string

SEE ALSO

AUTHOR

Mihyaeru/mihyaeru21 [email protected]

LICENSE

Copyright (C) Mihyaeru/mihyaeru21

Released under the MIT license.

See LICENSE file.

p5-webservice-slack-webapi's People

Contributors

mihyaeru21 avatar zostay avatar anotheroneackap avatar ivanwills-optus avatar arcticsnowman avatar yanick avatar likk avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.