Skip to main content

pipelinewise-tap-slack

PyPI version PyPI - Python Version License: MIT

Singer tap that extracts data from a Slack workspace and produces JSON-formatted data following the Singer spec.

This is a PipelineWise compatible tap connector.

How to use it

The recommended method of running this tap is to use it from PipelineWise. When running it from PipelineWise you don't need to configure this tap with JSON files and most of things are automated. Please check the related documentation at Tap Slack

If you want to run this Singer Tap independently please read further.

Installation

It is highly recommended installing tap-slack in it's own isolated virtual environment. For example:

python3 -m venv ~/.venvs/tap-slack
source ~/.venvs/tap-slack/bin/activate
pip3 install pipelinewise-tap-slack
deactivate

Setup

The tap requires a Slack API token to interact with your Slack workspace. You can obtain a token for a single workspace by creating a new Slack App in your workspace and assigning it the relevant scopes. As of right now, the minimum required scopes for this App are:

  • channels:history
  • channels:join
  • channels:read
  • files:read
  • groups:read
  • links:read
  • reactions:read
  • remote_files:read
  • remote_files:write
  • team:read
  • usergroups:read
  • users.profile:read
  • users:read
  • users:read.email This scope is only required if you want to extract the user emails as well.

Create a config file containing the API token and a start date, e.g.:

{
  "token":"xxxx",
  "start_date":"2020-05-01T00:00:00"
}

Private channels

Optionally, you can also specify whether you want to sync private channels or not by adding the following to the config:

    "private_channels":"false"

By default, private channels will be synced.

Joining Public Channels

By adding the following to your config file you can have the tap auto-join all public channels in your ogranziation.

"join_public_channels":"true"

If you do not elect to have the tap join all public channels you must invite the bot to all channels you wish to sync.

Specify channels to sync

By default, the tap will sync all channels it has been invited to. However, you can limit the tap to sync only the channels you specify by adding their IDs to the config file, e.g.:

"channels":[
    "abc123",
    "def345"
  ]

Note this needs to be channel ID, not the name, as recommended by the Slack API. To get the ID for a channel, either use the Slack API or find it in the URL.

Archived Channels

You can control whether or not the tap will sync archived channels by including the following in the tap config:

  "exclude_archived": "false"

It's important to note that a bot CANNOT join an archived channel, so unless the bot was added to the channel prior to it being archived it will not be able to sync the data from that channel.

Date Windowing

Due to the potentially high volume of data when syncing certain streams (messages, files, threads) this tap implements date windowing based on a configuration parameter.

including

"date_window_size": "5"

Will cause the tap to sync 5 days of data per request, for applicable streams. The default value if one is not defined is to window requests for 7 days at a time.

Usage

It is recommended to follow Singer best practices when running taps either on their own or with a Singer target.

In practice, it will look something like the following:

~/.venvs/tap-slack/bin/tap-slack --config slack.config.json --catalog catalog.json | ~/.venvs/target-stitch/bin/target-stitch --config stitch.config.json

Replication

The Slack Conversations API does not natively store last updated timestamp information about a Conversation. In addition, Conversation records are mutable. Thus, tap-slack requires a FULL_TABLE replication strategy to ensure the most up-to-date data in replicated when replicating the following Streams:

  • Channels (Conversations)
  • Channel Members (Conversation Members)

The Users stream does store information about when a User record was last updated, so tap-slack uses that timestamp as a bookmark value and prefers using an INCREMENTAL replication strategy.

Table Schemas

Channels (Conversations)

  • Table Name: channels
  • Description:
  • Primary Key Column: id
  • Replication Strategy: FULL_TABLE
  • API Documentation: Link

Channel Members (Conversation Members)

  • Table Name: channel_members
  • Description:
  • Primary Key Columns: channel_id, user_id
  • Replication Strategy: FULL_TABLE
  • API Documentation: Link

Messages (Conversation History)

  • Table Name: messages
  • Description:
  • Primary Key Columns: channel_id, ts
  • Replication Strategy: INCREMENTAL
  • API Documentation: Link

Users

  • Table Name: users
  • Description:
  • Primary Key Column: id
  • Replication Strategy: INCREMENTAL
  • API Documentation: Link

Threads (Conversation Replies)

  • Table Name: threads
  • Description:
  • Primary Key Columns: channel_id, ts, thread_ts
  • Replication Strategy: FULL_TABLE for each parent message
  • API Documentation: Link

User Groups

  • Table Name: user_groups
  • Description:
  • Primary Key Column: id
  • Replication Strategy: FULL_TABLE
  • API Documentation: Link

Files

  • Table Name: files
  • Description:
  • Primary Key Column: id
  • Replication Strategy: INCREMENTAL query filtered using date windows and lookback window
  • API Documentation: Link

Remote Files

  • Table Name: remote_files
  • Description:
  • Primary Key Column: id
  • Replication Strategy: INCREMENTAL query filtered using date windows and lookback window
  • API Documentation: Link

Testing the Tap

Install test dependencies

make venv

To run tests:

make unit_test

Linting

Install test dependencies

make venv

To run linter:

make pylint

Metadata

Release files for pipelinewise-tap-slack 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pipelinewise-tap-slack 1.1.1
File Size Uploaded Provenance
pipelinewise-tap-slack-1.1.1.tar.gz 25.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pipelinewise-tap-slack 1.1.1
File Interpreter ABI Platform
pipelinewise_tap_slack-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 55.8 kB

Release files / pipelinewise-tap-slack-1.1.1.tar.gz

Download URL pipelinewise-tap-slack-1.1.1.tar.gz
Size 25.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bafdc765df15daa498916860a992a9daa98a75b8cec795bed4ca8d6f313509e0
BLAKE2b-256 checksum
How to use checksums
ccb45daabde4d454b77c995987b18bf0916b69f90c777f58f66970eaaad2e699
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / pipelinewise_tap_slack-1.1.1-py3-none-any.whl

Download URL pipelinewise_tap_slack-1.1.1-py3-none-any.whl
Size 30.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f5eb955865cfa60f59194c25fc34acf03f79f34422565b216dd1afa9f8649eff
BLAKE2b-256 checksum
How to use checksums
88ae344cd3df4205efd5e57a91c529be26171943831b4d111be2d1f8bf643f91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Security for pipelinewise-tap-slack 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page