Urban Bot

Urban Bot

  • Docs
  • GitHub

›Bots

Getting Started

  • Intro
  • Telegram

Tutorials

  • Todo List

API

  • Components
  • Hooks
  • Bots

    • Telegram
    • Discord
    • Facebook
    • Slack

UrbanBotSlack

Urban bot part which is responsible to launch slack bot.

Install

npm i @urban-bot/slack --save
yarn add @urban-bot/slack

Usage

import { render, Root, Text } from '@urban-bot/core';
import { UrbanBotSlack } from '@urban-bot/slack';

const urbanBotSlack = new UrbanBotSlack({
    signingSecret: 'signingSecret',
    token: 'token',
});

render(
    <Root bot={urbanBotSlack}>
        <Text>Hello, Slack!</Text>
    </Root>,
);

Options

signingSecret

A slack signingSecret. You can get it from https://api.slack.com/apps/<YOUR_APP_ID>/general.

required

string

const urbanBotSlack = new UrbanBotSlack({
    signingSecret: '6e7cf4e2fen267af5810e3a34gfcb254',
});

token

A slack token. You can get it from https://api.slack.com/apps/<YOUR_APP_ID>/oauth.

required

string

const urbanBotSlack = new UrbanBotSlack({
    token: 'xoxb-1034561432512-1264285621449-nadENxhBj2BfrMkxJ90cqbuz',
});

Bot Instance

You could get bot instance by useBotContext.

function SomeComponent() {
    const { bot } = useBotContext();

    // ...
}

type

Bot type.

required

'SLACK'

client

A client which you can use for call any Slack API.

required

slack/web-api

function SomeComponent() {
    const { bot } = useBotContext();
    
   useText(({ text, chat, from }) => {
       if (text.includes('Fu**')) {
           bot.client.conversations.kick({
               channel: chat.id,
               user: from.id,
           });
       }
   });

    // ...
}
← Facebook
  • Options
  • Bot Instance
Docs
Get StartedComponentsHooksTelegramDiscordFacebookSlack
Community
Telegram
Links
Urban Bot
Copyright © 2022 German Smirnov and Ivan Pakhotin