Build Status Dependency Status Coverage Status

A node.js API for talking to Stack Exchange chat (Largely based on ChatExchange for python)


Using npm:

$ npm i chatexchange

Word of Caution

This API is still in development, and thus should be considered unstable. Be warned: API calls between version may change drastically.


const Client = require('chatexchange');

const main = async () => {
    const client = new Client('stackoverflow.com');

    await client.login('EMAIL', 'PASSWORD');

    const me = await client.getMe();

    const room = await client.joinRoom(167908);

    room.on('message', async msg => {
        console.log('Got Message', msg);

        // eventType 8 (Someone has messaged me)
        if (msg.eventType === 8 && msg.targetUserId === me.id) {
            await msg.reply('Hello World!');

    // Connect to the room, and listen for new events
    await room.watch();