Skip to content

krishamoud/meteor-slack-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slack API for Meteor.js

A Meteor wrapper for the Slack API

Install

Add khamoud:slack-api to your applications .meteor/packages file

Alternatively:

meteor add khamoud:slack-api

How to use

SlackAPI is a global object server side only*

It is used to make the method calls which can be synchronous or asynchronous.

Asynchronous calls will return a callback with one error argument upon failure or return the object as the second argument upon success.

// async calls
SlackAPI.api.test({good:1}, function(err,res){
    console.log(err); // will return null
    console.log(res); // will return {"ok":true, "args":{good:1}}
});

SlackAPI.api.test({good:1, error:1}, function(err,res){
    console.log(err); // will return {"ok":false, "error":1, "args":{good:1, error:1}}
    console.log(res); // will return undefined
});

// sync calls
SlackAPI.api.test({good:1}); // return {"ok":true, "args":{good:1}}
SlackAPI.api.test({good:1, error:1}) // return  {"ok":false, "error":1, "args":{good:1, error:1}}

Documentation

Each API method receives arguments for the request, and an optional callback function to execute once the request has completed. The available request parameters are explained for each method below.

Each callback function receives one or two arguments: error and response (one for errors, two for success).

error applicable when there's an issue with the request connection.

response is the request response body parsed as JSON.

Overview

api

auth

channels

chat

emoji

files

groups

im

oauth

rtm

search

stars

team

users

Testing

I have tested all of the synchronous calls. Their tests can be found in slack-api-tests.js

To run the tests yourself you are going to need an accessToken and a slack userId then you can run the tests with this command.

export USER="U123456789" 
export TOKEN="TOKEN"`
meteor test-packages ./

Todo

  • test async calls

About

This is the entire slack api written for meteor. Both synchronous and asynchronous calls available.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published