Repository navigation
Releases
Releases · Query-farm/vgi-slack
v0.2.0
Full Changelog: v0.1.3...v0.2.0
v0.1.3
v0.1.2
v0.1.1
v0.1.0
First release of the VGI Slack worker: read Slack channels, people, messages and threads as DuckDB tables, join them with your other data, and post messages from a SQL pipeline. Written in TypeScript on @query-farm/vgi 0.50 (VGI protocol 3.3, DuckDB / Haybarn 2.0).
Functions
| Function | Kind | What it does |
|---|---|---|
auth_info() |
table | The workspace and bot behind the attached token |
channels(types := ..., exclude_archived := true) |
table | Channels the bot can see |
users(include_deleted := false) |
table | The workspace directory |
messages(channel, oldest := NULL, latest := NULL) |
table | A channel's history, newest first |
replies(channel, thread_ts) |
table | A thread: parent message and replies |
post_message(channel, text, thread_ts := NULL) |
table | Post one message, returns its ts |
post_messages((SELECT channel, text [, thread_ts] ...)) |
table in-out | Post one message per row |
Composed examples
channels()joined tousers()for each channel's creatorreplies()joined tousers()for a thread with author namesmessages()feedingpost_messages()to nudge unanswered messages:
SELECT count(*) AS nudged FROM slack.main.post_messages((
SELECT channel_id AS channel, 'Bumping this: is anyone looking at it?' AS text, ts AS thread_ts
FROM slack.main.messages('#general', oldest := now()::TIMESTAMP - INTERVAL 1 DAY)
WHERE reply_count IS NULL AND subtype IS NULL AND bot_id IS NULL));Quick start
Download the signed binary for your platform from the assets below (or make build from source with Bun 1.3+), then from DuckDB 2.0:
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
ATTACH 'slack' (TYPE vgi, LOCATION '/abs/path/to/vgi-slack-worker',
token getenv('SLACK_BOT_TOKEN'));
SELECT team, user FROM slack.main.auth_info();On Haybarn, use INSTALL vgi FROM community; LOAD vgi; instead of the repository lines. The bot token needs channels:read, groups:read, channels:history, groups:history, users:read (plus users:read.email) and chat:write, and the bot must be invited to each channel.
Known limits
- Needs a real Slack bot token for live use; CI and tests run against a local mock Slack API, and
vgi-lintruns with--no-execute. post_message/post_messagespost real messages (markedVOLATILE).- Bound history with
oldest/latest; aWHEREonposted_atpages through the whole channel first. - No macOS x86-64 binary (DuckDB 2.0 dropped Intel macOS).