Load Slack data to BigQuery
Build a Slack to BigQuery pipeline with your coding agent. One prompt scaffolds it with the dltHub AI harness, plus the Slack API base URL, auth, endpoints, and incremental loading.
Slack Web API is an interface for querying information from and enacting change in a Slack workspace. Everything needed to build a working Slack → BigQuery pipeline is on this page: the API's base URL, authentication, endpoints, pagination and incremental field — plus a prompt that hands the whole job to your coding agent.
Build your Slack to BigQuery pipeline
Paste this prompt into Claude, Codex, or Cursor. The agent does the rest.
uvx dlthub-init@latest to build a pipeline from Slack to BigQuery and run it on dltHubThat scaffolds a dltHub workspace and installs the dltHub AI harness — the project rules, the secrets-management skill, and the dlt MCP server your agent needs to work safely. From there it reads the Slack API, proposes the endpoints to load, then writes, runs and validates the pipeline while you review rather than type. Credentials are inspected through MCP tools, so your agent never reads secrets.toml itself. How the LLM-native workflow works →
Prefer to write it yourself? Every fact the agent uses is below.
Slack API at a glance
| Base URL | https://slack.com/api/ |
| Example endpoint | GET conversations.list |
| Records found at | channels |
| Authentication | requests require a Bearer token in the Authorization header or as a POST parameter — sent in the Authorization header, prefixed Bearer |
| Pagination | Cursor-based via cursor, next cursor at response_metadata.next_cursor, page size via limit (default 100, max 999) |
| Incremental field | next_cursor |
| Record id | id |
| API reference | https://docs.slack.dev/apis/web-api/ |
These values come from the Slack API reference — the authoritative source if anything here looks out of date.
How do I authenticate with the Slack API?
Slack uses OAuth tokens that should be passed in the Authorization HTTP header with the Bearer scheme (e.g., 'Authorization: Bearer xoxb-...' or 'Authorization: Bearer xoxp-...'). Alternatively, tokens can be sent as a 'token' parameter in an 'application/x-www-form-urlencoded' POST body.
1. Get your credentials
To obtain credentials for the Slack API: 1. Sign in to your Slack account and navigate to the Slack API dashboard at https://api.slack.com/apps. 2. Click 'Create New App' and choose 'From scratch' or 'From an app manifest'. 3. Once the app is created, navigate to the 'OAuth & Permissions' section in the left sidebar. 4. Scroll to the 'Scopes' section and add the necessary Bot Token Scopes (e.g., channels
, users). 5. Scroll up to the 'OAuth Tokens for Your Workspace' section and click 'Install to Workspace' to authorize the app. 6. After installation, copy the 'Bot User OAuth Token' (which starts with xoxb-) displayed in the 'OAuth Tokens' section. This token acts as your credential.2. Add them to .dlt/secrets.toml
[sources.slack_source] access_token = "xoxb-your-slack-bot-token-here"
dlt reads this file automatically at runtime. With the harness, the setup-secrets skill prompts you for the values and never handles the raw credential in chat. For production, see setting up credentials with dlt.
What Slack data can I load into BigQuery?
These are the Slack endpoints dlt can load into BigQuery:
| Resource | Endpoint | Method | Data selector | Description |
|---|---|---|---|---|
| conversations | conversations.list | GET | channels | List all channels in a Slack workspace |
| users | users.list | GET | members | List all users in a Slack workspace |
| stars | stars.list | GET | items | List all starred items for a user |
| conversations_history | conversations.history | GET | messages | Fetch a conversation's history |
| conversations_replies | conversations.replies | GET | messages | Retrieve a thread of messages |
How do I load only new Slack records?
Slack exposes next_cursor on conversations.list, so dlt can request only the records that changed since the last run. Set it as the cursor_path and dlt tracks the high-water mark for you between runs.
{"name": "conversations", "endpoint": { "path": "conversations.list", "data_selector": "channels", "incremental": {"cursor_path": "next_cursor", "initial_value": "2024-01-01T00:00:00Z"}, }}
On the first run dlt loads everything from initial_value; on every run after that it requests only what changed and appends with write_disposition="merge" if you set a primary key. See incremental loading.
What does the generated Slack pipeline look like?
A standard dlt REST API pipeline — the same code you would write by hand, loading oauth.access and chat.postMessage from the Slack API into BigQuery:
import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def slack_source(token=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://slack.com/api/", "auth": {"type": "bearer", "token": token}, }, "resources": [ {"name": "conversations", "endpoint": {"path": "conversations.list", "data_selector": "channels"}}, {"name": "users", "endpoint": {"path": "users.list", "data_selector": "members"}} ], } yield from rest_api_resources(config) def load_slack_to_bigquery() -> None: pipeline = dlt.pipeline( pipeline_name="slack_pipeline", destination="bigquery", dataset_name="slack_data", ) load_info = pipeline.run(slack_source()) print(load_info) if __name__ == "__main__": load_slack_to_bigquery()
Run it with uv run python slack_pipeline.py. The agent iterates on this until it loads cleanly — you review and approve, rather than write it from scratch.
How do I query Slack data in BigQuery?
dlt creates one table per resource. Query the loaded data with Python or SQL — or ask your agent to, through the MCP server's execute_sql_query tool.
Python (pandas DataFrame):
import dlt data = dlt.pipeline("slack_pipeline").dataset() df = data.conversations.df() print(df.head())
SQL:
SELECT * FROM slack_data.conversations LIMIT 10;
See querying your data with dataset and exploring it in marimo notebooks.
How do I deploy the Slack to BigQuery pipeline in production?
The pipeline runs locally, which is ideal for prototyping and one-off analysis. When you need it on a schedule, monitored on every load, and shared with your team, deploy the same dlt code on the dltHub platform — no infrastructure to maintain. The prompt above already ends with "run it on dltHub", so your agent can take it there directly.
- Deploy & schedule — run the pipeline as a managed job with automatic retries.
- Monitor — observable job queues, alerting, and load metrics for every run.
- Transform — promote raw Slack loads into governed, documented models.
- Visualize & share — explore data in notebooks and publish live dashboards instead of static screenshots.
What other destinations can I load Slack data to?
dlt loads into any of these — only the destination argument changes:
| Destination | Example value |
|---|---|
| PostgreSQL | "postgres" |
| BigQuery | "bigquery" |
| Snowflake | "snowflake" |
| Redshift | "redshift" |
| Databricks | "databricks" |
| Filesystem (S3, GCS, Azure) | "filesystem" |
Set dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. On the dltHub platform the same pipeline runs against a managed Iceberg lakehouse. See the full destinations list.
Next steps
Was this page helpful?
Community Hub
Need more dlt context for Slack to BigQuery?
Request dlt skills, commands, AGENT.md files, and AI-native context.