Add the Slack Client
Connect Slack to your Pandium TypeScript integration by installing the Slack Web API client, authenticating with your bot token, and listing workspace users to target future messages.
import * as dotenv from 'dotenv'
dotenv.config()
import { WebClient } from '@slack/web-api'
import Pokedex from 'pokedex-promise-v2'
import { Config, Secret, Context } from './lib.js'
const run = async () => {
const context = new Context()
const secrets = new Secret()
const config = new Config()
console.error(`This run is in mode: ${context['run_mode']}`)
console.error('------------------------CONFIG------------------------')
console.error(config)
console.error('------------------------CONTEXT------------------------')
console.error(context)
const pokeClient = new Pokedex()
const slackClient = new WebClient(secrets.slack_oauth_access_token)
const { members } = await slackClient.users.list()
console.error(members)
}
run().then(
() => {},
() => {
process.exitCode = 1
}
)Last updated
Was this helpful?