• Stars
    star
    1,910
  • Rank 24,271 (Top 0.5 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 4 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

⚑ A reactive Slack application framework.

⚑ Phelia

React for Slack Apps

Build interactive Slack apps without webhooks or JSON headache. If you know React, you know how to make a Slack app.

Quick start

  1. Create your message with React:

    import randomImage from "../utils";
    
    export function RandomImage({ useState }: PheliaMessageProps) {
      const [imageUrl, setImageUrl] = useState("imageUrl", randomImage());
    
      return (
        <Message text="Choose a dog">
          <ImageBlock
            title="an adorable :dog:"
            alt="a very adorable doggy dog"
            imageUrl={imageUrl}
            emoji
          />
          <Divider />
          <Actions>
            <Button
              style="primary"
              action="randomImage"
              onClick={() => setImageUrl(randomImage())}
            >
              New doggy
            </Button>
          </Actions>
        </Message>
      );
    }
  2. Register your component

    const client = new Phelia(process.env.SLACK_TOKEN);
    
    app.post(
      "/interactions",
      client.messageHandler(process.env.SLACK_SIGNING_SECRET, [RandomImage])
    );
    
    client.postMessage(RandomImage, "@max");
  3. Interact with your message:

See: docs for more info or join our community Slack.

How this works

Phelia transforms React components into Slack messages by use of a custom React reconciler. Components (with their internal state and props) are serialized into a custom storage. When a user interacts with a posted message Phelia retrieves the component, re-hydrates it's state and props, and performs any actions which may result in a new state.

Components

Each component is a mapping of a specific object type for a slack block. There are 3 categories of components, each with special rules for how that component can be used with other components.

  1. Surface Components (Message, Home, Modal) - Root components that contains Block Components
  2. Block Components (Actions, Context, Divider, Image, Input, Section) - Direct descendants of a Surface Component. Contains Block Components
  3. Block Element Components (Text, CheckBoxes, TextField, etc) - Direct descendants of a Block Components.

Feature Support

To request a feature submit a new issue.

Component Example
Actions βœ… Counter
Button βœ… Counter
Channel Select Menus βœ… Channel Select Menu
Checkboxes βœ… Modal Example
Confirmation dialog βœ… Random Image
Context βœ…
Conversation Select Menus βœ… Conversation Select Menu
Date Picker βœ… Birthday Picker
Divider βœ… Random Image
External Select Menus βœ… External Select Menu
Home Tab βœ… Home App Example
Image Block βœ… Random Image
Image βœ… Random Image
Input βœ… Modal Example
Messages βœ… Server
Modals βœ… Modal Example
Multi channels select Menu βœ… Multi Channels Select Menu
Multi conversations select Menu βœ… Multi Conversations Select Menu
Multi external select Menu βœ… Multi External Select Menu
Multi static select Menu βœ… Multi Static Select Menu
Multi users select Menu βœ… Multi Users Select Menu
Option group βœ… Static Select Menu
Option βœ…
Overflow Menu βœ… Overflow Menu
Plain-text input βœ… Modal Example
Radio button group βœ… Radio Buttons
Section βœ… Counter
Static Select Menus βœ… Static Select Menu
Text βœ… Counter
Text βœ… Random Image
User Select Menus βœ… User Select Menu

More Repositories

1

CSS-Keylogging

Chrome extension and Express server that exploits keylogging abilities of CSS.
CSS
3,209
star
2

quickfix

The best stupid idea for fixing problems in node modules.
JavaScript
268
star
3

redditfs

An interactive command line utility to save files and directories to Reddit.
Go
58
star
4

Unofficial-Google-Messages-Desktop-App

The (Unofficial) Google Messages Desktop Application
Makefile
31
star
5

Remote-Linux-Unlocker

Android application and Linux daemon to login and out of computer remotely.
Java
28
star
6

wssh

Online ssh and sftp interface using docker and websockets.
JavaScript
8
star
7

Finger-Printer

Finger Printer is a library and android application that utilizes mobile devices fingerprint reader to authenticate users on a computer.
Java
5
star
8

genesis

Online IDE for quick prototyping.
JavaScript
3
star
9

Yu-Gi-Oh

School project. Nothing to see here 😊.
C++
3
star
10

face-authenticator

Script that unlocks your desktop with your face.
Python
3
star
11

gugu

Telemetry software for an AVR ATMEGA1284p chip. This software controls the telemetry for a 30ft πŸš€.
C
3
star
12

git-video

A tool for linking Youtube videos in GitHub markdown files with a single link.
Go
2
star
13

mailyourrep-backend

Go
2
star
14

zipcodes2016

Package provides city and state correlating to provided zipcode (last updated 2016).
JavaScript
2
star
15

linux-keylogger

Go
2
star
16

mailyourrep

JavaScript
1
star
17

create-grid

Create a grid from a selected object or group of objects in Figma.
HTML
1
star
18

9ight

πŸŒ’ A Next.js API framework
TypeScript
1
star
19

template-npm

TypeScript
1
star
20

first-robotics-2018

Java
1
star
21

figtree

env files shouldn't exist.
TypeScript
1
star
22

trio-eyes

movin' eyes πŸ‘€
TypeScript
1
star
23

tweet-bot

Go
1
star
24

xray

Go
1
star
25

Bulldog-Bucks

An android application to manage Gonzaga's Bulldog Bucks.
Java
1
star
26

phelia-message-example

TypeScript
1
star
27

gu-port-backend

A backend for https://github.com/Flaque/gu-port
Go
1
star