Collection of bolt-js InstallationStore implementations

Overview

Bolt for JavaScript Extensions (WIP)

npm version lerna

⚠️ Important Notice ⚠️

This project is still work in progress, and may have bugs in it. If you would like to immediately reuse the code here for your production apps, please feel free to take any under the MIT license and maintain it on your own.

This project aims to provide the bolt-js InstallationStore implementations for widely used database libraries, databases, and cloud services.

At this moment, we support the following database libraries. To learn how to use these InstallationStore in your bolt-js apps, check src/tests/bolt-example.ts. You can run the app by npm run bolt in each package directory.

For instance, if you go with Prisma, your Bolt app code will look like the one below:

import { App } from '@slack/bolt';
import { PrismaClient } from '@prisma/client';
import { PrismaInstallationStore } from 'slack-bolt-prisma';

const prismaClient = new PrismaClient({
  log: [
    {
      emit: 'stdout',
      level: 'query',
    },
  ],
});
const installationStore = new PrismaInstallationStore({
  // The name `slackAppInstallation` can be different
  // if you use a different name in your Prisma schema
  prismaTable: prismaClient.slackAppInstallation,
  clientId: process.env.SLACK_CLIENT_ID,
});
const app = new App({
  signingSecret: process.env.SLACK_SIGNING_SECRET,
  clientId: process.env.SLACK_CLIENT_ID,
  clientSecret: process.env.SLACK_CLIENT_SECRET,
  stateSecret: process.env.SLACK_STATE_SECRET,
  scopes: ['commands', 'chat:write', 'app_mentions:read'],
  installationStore,
});

app.event('app_mention', async ({ event, say }) => {
  await say({
    text: `<@${event.user}> Hi there :wave:`,
    blocks: [
      {
        type: 'section',
        text: {
          type: 'mrkdwn',
          text: `<@${event.user}> Hi there :wave:`,
        },
      },
    ],
  });
});

(async () => {
  await app.start();
  console.log('⚡️ Bolt app is running!');
})();

If you go with any of other packages, just replacing the installationStore part works for you.

Features

All the packages guarantee they work with great consideration for the following points:

  • InstallationStore in any of these packages returns the latest bot token plus the latest user token (only when it exists) for a query (enterprise_id / team_id / user_id / is_enterprise_install).
  • Org-wide installations are also properly supported. All the packages have a unit test named src/tests/org-wide-installation.spec.ts to cover the scenarios.
  • historicalDataEnabled: boolean option is supported in all the packages. If the options is set to true, the InstallationStore stores all the histories of installations. If the value is false, it maintains only the latest data by updating them. For deletion in the case of token revocation and uninstallations, all the associated data must be deleted regardless of the mode.
  • The callbacks onFetchInstallation, onStoreInstallation, and onDeleteInstallation are supported in all the packages. These callbacks enable developers to customize the data to be stored in a database (e.g., encrypting token values in database rows), append custom properties to the database row, and do extra logging for better system monitoring.
  • InstallationStore#close(): Promise<void> method is supported in all the packages. This method is supposed to be used for safely disconnecting from a database and cleaning up the remaining resources.

Open source license

All the packages in this repository are published in the npm package registry under the MIT open-source license.

Maintainers Guide

Run all the unit tests

bolt-prisma CI Build bolt-prisma CI Build bolt-prisma CI Build bolt-prisma CI Build

You can run all the unit tests ysung lerna command:

git clone [email protected]:seratch/slack-bolt-extensions.git
cd slack-bolt-extensions/
npm i
npx lerna bootstrap
npx lerna run test

When you work on a specific project, head to the package directory and use npm commands here:

cd slack-bolt-extensions/
npm i
npx lerna bootstrap
cd packages/bolt-prisma/
npm test
code . # Open the project in Visual Studio Code

Publish the packages

For publishing the packages, we always use lerna publish command.

npx lerna bootstrap
npx lerna publish
# Follow the interactive steps with lerna
You might also like...

Collection of JSON-RPC APIs provided by Ethereum 1.0 clients

Ethereum JSON-RPC Specification View the spec The Ethereum JSON-RPC is a collection of methods that all clients implement. This interface allows downs

Jan 8, 2023

A collection of smart contracts for the Stackup platform 🤖 📑

Contracts A collection of smart contracts for the Stackup platform. Dev Blog Deployed Contracts See releases for deployed contracts of previous versio

Nov 29, 2021

This repo is a collection of code samples and links to previous twitch live stream sessions. If you have any ideas or suggestions for future episodes, feel free to open an issue.

Talk DEV to me Talk DEV to me is a monthly show on twitch.tv/aws hosted by Tiago Barbosa and Alex Melnyk, where we invite customers, partners, or Amaz

Jan 6, 2023

A collection of preloaded and essential files that makes the website more attractive, smooth and user friendly

Web-Docs A collection of preloaded and essential files that makes the website more attractive, smooth and user friendly How to use: git clone https://

Dec 17, 2022

Prototype Pollution exploits collection

Prototype Pollution Exploits Intro This repository is a collection of exploits for Prototype Pollution vulnerability. If you're not familiar with the

Dec 10, 2022

Build your own generative art NFT collection with 21 lines of JavaScript

Build your own generative art NFT collection with 21 lines of JavaScript

Avatar Collection Build your own Generative Art NFT Collection in 1 minute. Quickstart Just run the following to get started: git clone https://github

Dec 16, 2022

Collection of My Open-Source APIs.

GTAVModFinder Experimental mod finder from gta5-mods.com Installation ⚒ npm update npm install gta5mods-finder NPM 📂 NPM Page - Phaticusthiccy's gta

Dec 26, 2021

Frontend tech guide and collection of highly recommended materials

Frontend Learning Kit Frontend tech guide and collection of highly recommended materials Show your support by giving a ⭐ to this repo 2022 Frontend De

Jan 7, 2023

4Web is a collection&creation of codebase, frameworks, libraries dedicated to web development 📦

4Web is a collection&creation of codebase, frameworks, libraries dedicated to web development 📦

📨 You can also contribute to add / create your own collection in this repository Collection name Description 📌 blinke

Nov 14, 2022
Comments
  • next.js example doesn't work

    next.js example doesn't work

    I have tried adding stateSecret and various permutations of installationStore, but ultimately I get errors like Failed fetching data from the Installation Store

    question 
    opened by dakom 2
  • Connect mongoose to database

    Connect mongoose to database

    @seratch , I may be misunderstanding, but what is the purpose of the in memory store? How can I change the provided sample to connect to my mongo db and store the tokens?

    Many thanks

    question 
    opened by brock-rb2t 2
  • onStoreInstallationFinished

    onStoreInstallationFinished

    Hey, first of all, thanks for this package!

    We are trying to save additional data into the installation table, but it is impossible because onStoreInstallation executes before persisting (prisma). Is it possible to add an onStoreInstallationFinished method that runs after inserting/updating an installation?

    Best,

    question 
    opened by wellermiranda 1
Owner
Kazuhiro Sera
Slack Bolt Framework / SDK Developer
Kazuhiro Sera
Data structures & algorithms implementations and coding problem solutions. Written in Typescript and tested with Jest. Coding problems are pulled from LeetCode and Daily Coding Problem.

technical-interview-prep Data structures & algorithms implementations and coding problem solutions. Written in Typescript and tested with Jest. Coding

Lesley Chang 7 Aug 5, 2022
GraphErr is an open-source error handling library for GraphQL implementations in Deno. It's a lightweight solution that provides developers with descriptive error messages, reducing ambiguity and improving debugging.

GraphErr Descriptive GraphQL error handling for Deno/Oak servers. Features Provides additional context to GraphQL's native error messaging for faster

OSLabs Beta 35 Nov 1, 2022
⏬ Fetch the most up-to-date ABI of verified Smart Contracts (including proxy implementations) from Etherscan in seconds!

etherscan-abi ⏬ ?? Fetch the most up-to-date ABI of verified Smart Contracts (including proxy implementations) from Etherscan in seconds! Usage CLI Fe

Romain Milon 6 Dec 27, 2022
Brainfuck implementations each other in different languages.

Brainfuck implementations Brainfuck implementations in each other in different languages. What is brainfuck? Brainfuck is an esoteric programming lang

Lee Sun-Hyoup 3 Nov 15, 2022
Obsidian-Snippet-collection - A collection of snippet to customize obsidian

This repo is a collection of CSS snippets for Obsidian.md. To install them on PC

Mara 110 Dec 22, 2022
A collection of (mostly) technical things every software developer should know about

Join our community for professional Software Developers and get more control over your life and career! Every Programmer Should Know ?? A collection o

MTDV 66.6k Jan 4, 2023
A curated collection of common interview questions to help you prepare for your next interview.

30 Seconds of Interviews A curated collection of common interview questions to help you prepare for your next interview. This README is built using ma

30 seconds 11k Jan 7, 2023
Collection of browser challenges

?? CTF browser challenges ?? Collection of browser challenges Challenge CTF Difficulty Baby WASM RITSEC CTF 2021 ⭐ Kit Engine picoCTF 2021 ⭐ oob-v8 *C

exd0tpy 61 Dec 15, 2022
A collection of coding challenges from interviews and websites

coding-challenges All of these folders are challenges that I've make for interviews and from tutorials, now I'll enumerate the ones that are from inte

Matias Salicru 37 Jul 13, 2022
A collection of all the data structures implemented in javascript code

Data structures A collection of all the data structures implemented in javascript code, interview questions & problems ( with solutions ) Contributors

MSK Web development 2 May 1, 2022