How to use the @slack/bolt.ExpressReceiver function in @slack/bolt

To help you get started, we’ve selected a few @slack/bolt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github seratch / slack-app-examples / reacjilator-bolt-typescript / app.ts View on Github external
projectId: process.env.GOOGLE_PROJECT_ID,
  key: process.env.GOOGLE_KEY
}
const googleApi: GoogleTranslateApi = new GoogleTranslateApi(googleApiCredentials);

// ----------------
// Enable debug logging if true
const debug: boolean = true;
// lang code mapping data
import { langcode } from './langcode';

// ----------------
// Slack Bolt App
import { App, ExpressReceiver } from '@slack/bolt';

const expressReceiver = new ExpressReceiver({
  signingSecret: process.env.SLACK_SIGNING_SECRET
  // Endpoints will be attached later by calling the declared methods in Bolt's App
});
export const expressApp = expressReceiver.app;

const app: App = new App({
  token: process.env.SLACK_BOT_TOKEN,
  receiver: expressReceiver
});

app.event('reaction_added', async ({ event }) => {
  try {
    if (debug) {
      console.log(event);
    }
    if (event.item['type'] !== 'message') {
github seratch / slack-app-examples / serverless-bolt-template / aws-ts / app.ts View on Github external
'use strict';

// ------------------------------------------------------
// Type definitions in TypeScript
import * as WebApi from 'seratch-slack-types/web-api';
import { Request, Response, Application } from 'express';

// ------------------------------------------------------
// Bot app
// https://slack.dev/bolt/
import { App, ExpressReceiver } from '@slack/bolt';

const expressReceiver = new ExpressReceiver({
  signingSecret: process.env.SLACK_SIGNING_SECRET
  // Endpoints will be attached later by calling the declared methods in Bolt's App
});
export const expressApp: Application = expressReceiver.app;

const app: App = new App({
  token: process.env.SLACK_BOT_TOKEN,
  receiver: expressReceiver
});

// ------------------------------------------------------
// If you need to use API methods that are not listed on https://api.slack.com/bot-users#methods
// you need to use user api token instead like this:
import { WebClient } from '@slack/web-api';
app.client = new WebClient(process.env.SLACK_API_TOKEN);
github seratch / slack-app-examples / bolt-gcp-js-template / app.js View on Github external
'use strict';

const config = require('./config.js');

// ------------------------------------------------------
// Bot app
// https://slack.dev/bolt/
const { App, ExpressReceiver } = require('@slack/bolt');
const expressReceiver = new ExpressReceiver({
  signingSecret: config.SLACK_SIGNING_SECRET
});
const app = new App({
  token: config.SLACK_BOT_TOKEN,
  receiver: expressReceiver
});
const expressApp = expressReceiver.app;

// ------------------------------------------------------
// If you need to use API methods that are not listed on https://api.slack.com/bot-users#methods
// you need to use user api token instead like this:
const { WebClient } = require('@slack/web-api');
app.client = new WebClient(config.SLACK_API_TOKEN);

// ------------------------------------------------------
github seratch / slack-app-examples / serverless-bolt-template / aws-js / app.js View on Github external
'use strict';

// ------------------------------------------------------
// Bot app
// https://slack.dev/bolt/
const { App, ExpressReceiver } = require('@slack/bolt');
const expressReceiver = new ExpressReceiver({
  signingSecret: process.env.SLACK_SIGNING_SECRET
});
const app = new App({
  token: process.env.SLACK_BOT_TOKEN,
  receiver: expressReceiver
});
module.exports.expressApp = expressReceiver.app;

// ------------------------------------------------------
// If you need to use API methods that are not listed on https://api.slack.com/bot-users#methods
// you need to use user api token instead like this:
const { WebClient } = require('@slack/web-api');
app.client = new WebClient(process.env.SLACK_API_TOKEN);

// ------------------------------------------------------
github seratch / slack-app-examples / bolt-serverless-aws-template / aws-js / app.js View on Github external
'use strict';

// ------------------------------------------------------
// Bot app
// https://slack.dev/bolt/
const { App, ExpressReceiver } = require('@slack/bolt');
const expressReceiver = new ExpressReceiver({
  signingSecret: process.env.SLACK_SIGNING_SECRET
});
const app = new App({
  token: process.env.SLACK_BOT_TOKEN,
  receiver: expressReceiver
});
module.exports.expressApp = expressReceiver.app;

// ------------------------------------------------------
// If you need to use API methods that are not listed on https://api.slack.com/bot-users#methods
// you need to use user api token instead like this:
const { WebClient } = require('@slack/web-api');
app.client = new WebClient(process.env.SLACK_API_TOKEN);

// ------------------------------------------------------
github seratch / slack-app-examples / bolt-serverless-aws-template / aws-ts / app.ts View on Github external
'use strict';

// ------------------------------------------------------
// Type definitions in TypeScript
import * as WebApi from 'seratch-slack-types/web-api';
import { Request, Response, Application } from 'express';

// ------------------------------------------------------
// Bot app
// https://slack.dev/bolt/
import { App, ExpressReceiver } from '@slack/bolt';

const expressReceiver = new ExpressReceiver({
  signingSecret: process.env.SLACK_SIGNING_SECRET
});
export const expressApp: Application = expressReceiver.app;

const app: App = new App({
  token: process.env.SLACK_BOT_TOKEN,
  receiver: expressReceiver
});

// ------------------------------------------------------
// If you need to use API methods that are not listed on https://api.slack.com/bot-users#methods
// you need to use user api token instead like this:
import { WebClient } from '@slack/web-api';
app.client = new WebClient(process.env.SLACK_API_TOKEN);

// ------------------------------------------------------

@slack/bolt

A framework for building Slack apps, fast.

MIT
Latest version published 7 days ago

Package Health Score

95 / 100
Full package analysis

Popular @slack/bolt functions