Skip to content
Andrew McClenaghan edited this page Jul 25, 2016 · 12 revisions

Programatically getting your auth token from your email and password credentials

SlackClient.StartAuth((authStartResponse) =>{
    //Here authStartResponse has a field ('users') containing a list of teams you have access to.
    SlackClient.AuthSignin(
        (authSigninResponse) =>{
            //Here, authSigninResponse contains a field 'token' which is your valid authentication token.
        }, 
        authStartResponse.users[0].user_id, 
        authStartResponse.users[1].team_id, 
        YOUR_PASSWORD_HERE
    );
}, YOUR_EMAIL_HERE);

Creating a SlackSocketClient instance

First thing's first, you're going to need one of Slack's auth tokens. Once you do that, connecting is as easy as:

SlackSocketClient client = new SlackSocketClient(YOUR_AUTH_TOKEN);
client.Connect((connected) =>{
    //This is called once the client has emitted the RTM start command
}, () =>{
    //This is called once the RTM client has connected to the end point
});
client.OnMessageReceived += (message) =>
{
    //Handle each message as you receive them
};
Clone this wiki locally