Bots that live in your channels

A bot is your program in the channel: it listens, answers and publishes, with a key that can do only what you allow.

An example: Ada and Bo chat in the channel presence-chat-lobby; their messages are numbers 4998, 4999 and 5000 in the channel. A counter bot is in the room with its own key, listed as a bot. It counts the members' messages, not its own, celebrates message 5000 in the room with confetti, and pushes the total to the public channel status, which every page shows: 5000.

Bots you can build

Each idea with the key it needs, set exactly as in the dashboard's "New API key" form. Give a bot the fewest rights and the narrowest channels that work: it can then do nothing else, whoever runs it.

How a bot gets into someone's app

A bot written by someone else, for your app: they never get your keys, only one made for their bot.

  1. You make it a key

    In the dashboard, one API key per bot, with the fewest rights and the narrowest channels that work.

  2. You hand over that key

    The secret, sk_k_….…, is shown once. The bot's author gets it and your app id, nothing else: not your backend's key, not your signing keys.

  3. The bot signs for itself

    It signs its own join tokens and requests with that key. Pikoman checks each one against the key's rights, and shows it as a bot in presence channels.

  4. You can take it back

    Delete the key and the bot is closed out within about 30 seconds. Narrow it instead, and it keeps only what is left.

The limits that matter

What a bot meets, and what the numbers do not mean.

LimitWhat it means
100 channels per connection Per user connection, not per room: a room can hold any number of connections.
1 000 channels for a bot A connection that joined with an API key may be in ten times as many. A bot that only counts needs none: the counts come from GET /channels.
500 members Only in presence channels, where everyone gets the member list. Public channels have no member cap.
Connections at once Set by your plan (Free 100, Pro 1 000). Each open page is one, and so is each bot.
10 client events a second Per connection, the bot's too. Over it, the event is refused with rate_limited and the connection stays.
12 KiB per event For a push, a client event and each event of /mass_events. A bigger one is refused whole, never cut.

Webhooks or joining?

A bot either sits in the channel or is told what happens there. Pick by what it has to do.

When the botUse
must answer within a moment, or talk in the room Joining, with subscribe (and client_events to speak). It holds a websocket, which counts as a connection.
reacts to people coming and going, or rooms opening and closing Webhooks: channel_occupied, channel_vacated, member_added, member_removed, signed by Pikoman. No connection, and it can run as a plain HTTP endpoint.
only needs numbers GET /{channel}/stats today, and GET /channels with message counts soon. No joining at all.
only tells An HTTP push with publish. Nothing to keep open.

Build your first bot

A key, a 30-line Node program, and four lines on your page. A live message counter, running in ten minutes.

We are rebuilding the dashboard

Self-service sign-up is closed while we do. Until the new dashboard is ready we set up apps by hand: write to us with a line about what you are building, and we will set up your app and get back to you.

Write to hello@pikoman.se