Load Slack data to Databricks

Build a Slack to Databricks 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.

Source
Slack
Slack API Documentation
Destination
Databricks
Databricks is a unified, open analytics platform for data, analytics and AI, built on the lakehouse.

Slack conversations.history retrieves messages and events from a specified Slack conversation, with time-range and cursor-based pagination support. Everything needed to build a working Slack → Databricks 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 Databricks pipeline

Paste this prompt into Claude, Codex, or Cursor. The agent does the rest.

Prompt
Run uvx dlthub-init@latest to build a pipeline from Slack to Databricks and run it on dltHub

That 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 URLhttps://slack.com/api/
Example endpointGET conversations.history
Records found atmessages
Authenticationall requests require a Bearer bot token — sent in the Authorization header, prefixed Bearer
PaginationCursor-based via cursor, next cursor at response_metadata.next_cursor, page size via limit (default 100, max 999). Conversations.history uses cursor-based pagination: send cursor=response_metadata.next_cursor on the next request. Set limit to control the maximum results per call; Slack recommends no more than 200, and the general Web API pagination documentation states a maximum of 1000, while the method's SDK reference specifies a maximum of 999. Do not treat oldest as the REST pagination cursor: oldest is a timestamp filter for messages after that time. A separate timestamp-based traversal is documented for time-bounded history responses: when has_more is true, set the final message's ts as latest for the next call. Responses can contain fewer than the requested limit even when more results exist; rely on next_cursor/has_more as documented.
Incremental fieldts
Record idts
API referencehttps://docs.slack.dev/reference/methods/conversations.history

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?

Send the bot access token in the HTTP header Authorization: Bearer xoxb-…. Slack says tokens should be transmitted as bearer tokens in Authorization; do not put the token in the query string or JSON body. For JSON POST requests, set Content-Type: application/json; GET requests may use query parameters for method arguments.

1. Get your credentials

  1. Go to https://api.slack.com/apps and select Create New App, choose From scratch, enter an app name, select the development workspace, and create the app. 2. Open OAuth & Permissions. Under Bot Token Scopes, select Add an OAuth Scope and add the history scope required for the conversation type: channels
    for public channels, groups
    for private channels, im
    for direct messages, and mpim
    for group direct messages. 3. Click Install to Workspace (or Reinstall to Workspace), review the requested permissions, and click Allow. 4. Return to OAuth & Permissions and copy the Bot User OAuth Token under OAuth Tokens; bot tokens begin with xoxb-. Keep it secret and store it outside source control. For an app distributed to multiple workspaces, implement Slack OAuth v2 and obtain an installation access token per workspace instead of relying on the single-workspace dashboard token.

2. Add them to .dlt/secrets.toml

[sources.slack_source] api_key = "xoxb-your-slack-bot-token"

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 Databricks?

These are the Slack endpoints dlt can load into Databricks:

ResourceEndpointMethodData selectorDescription
conversations_historyconversations.historyGETmessagesRead messages from a conversation. Supports channel, oldest, latest, inclusive, limit, and cursor pagination via cursor; bearer token in Authorization header. For time-based incremental loading, send the previously stored latest message ts as oldest (use inclusive=false, the documented default, to avoid replaying the boundary). Continue paging with response_metadata.next_cursor when present.
conversations_listconversations.listGETchannelsList channel-like conversations visible to the token. Cursor pagination uses limit and response_metadata.next_cursor; limit must be under 1000 and Slack recommends no more than 200.
conversations_repliesconversations.repliesGETmessagesRetrieve a thread's messages using channel and parent ts; supports oldest, latest, inclusive, limit, and cursor pagination.
conversations_membersconversations.membersGETmembersList members of a conversation; cursor-paginated with limit and response_metadata.next_cursor.
users_listusers.listGETmembersList workspace users; cursor-paginated with limit and response_metadata.next_cursor.
reactions_listreactions.listGETitemsList items reacted to by the authenticated user; cursor-paginated with limit and response_metadata.next_cursor.
stars_liststars.listGETitemsList items starred by the authenticated user; cursor-paginated with limit and response_metadata.next_cursor.

How do I load only new Slack records?

Slack exposes ts on conversations.history, 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_history", "endpoint": { "path": "conversations.history", "data_selector": "messages", "incremental": {"cursor_path": "ts", "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 conversations.history and conversations.replies from the Slack API into Databricks:

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_history", "endpoint": {"path": "conversations.history", "data_selector": "messages"}}, {"name": "conversations_list", "endpoint": {"path": "conversations.list", "data_selector": "channels"}} ], } yield from rest_api_resources(config) def load_slack_to_databricks() -> None: pipeline = dlt.pipeline( pipeline_name="slack_pipeline", destination="databricks", dataset_name="slack_data", ) load_info = pipeline.run(slack_source()) print(load_info) if __name__ == "__main__": load_slack_to_databricks()

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 Databricks?

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_history.df() print(df.head())

SQL:

SELECT * FROM slack_data.conversations_history LIMIT 10;

See querying your data with dataset and exploring it in marimo notebooks.


How do I deploy the Slack to Databricks 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.

Book a demo →


What other destinations can I load Slack data to?

dlt loads into any of these — only the destination argument changes:

DestinationExample 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 Databricks?

Request dlt skills, commands, AGENT.md files, and AI-native context.