Skip to content

Commit

Permalink
[AP-809] Add tap slack (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
koszti authored Oct 1, 2020
1 parent b4b5c4a commit fbce3e5
Show file tree
Hide file tree
Showing 12 changed files with 231 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ consumes data from taps and do something with it, like load it into a file, API
| Tap | **[Google Analytics](https://github.com/transferwise/pipelinewise-tap-google-analytics)** | Extra | [![PyPI version](https://badge.fury.io/py/pipelinewise-tap-google-analytics.svg)](https://badge.fury.io/py/tap-adwords) | Extracts data from Google Analytics |
| Tap | **[Oracle](https://github.com/transferwise/pipelinewise-tap-oracle)** | Extra | [![PyPI version](https://badge.fury.io/py/pipelinewise-tap-oracle.svg)](https://badge.fury.io/py/pipelinewise-tap-oracle) | Extracts data from Oracle databases. Supporting Log-Based, Key-Based Incremental and Full Table replications |
| Tap | **[Zuora](https://github.com/transferwise/pipelinewise-tap-zuora)** | Extra | [![PyPI version](https://badge.fury.io/py/pipelinewise-tap-zuora.svg)](https://badge.fury.io/py/pipelinewise-tap-zuora) | Extracts data from Zuora database using AQAA and REST extraction API with Key-Based incremental replications |
| Tap | **[GitHub](https://github.com/singer-io/tap-github)** | Extra | [![PyPI version](https://badge.fury.io/py/tap-github.svg)](https://badge.fury.io/py/tap-github) | Extracts data from GitHub API using Personal Access Token and Key-Based incremental replications |
| Tap | **[GitHub](https://github.com/singer-io/tap-github)** | | [![PyPI version](https://badge.fury.io/py/tap-github.svg)](https://badge.fury.io/py/tap-github) | Extracts data from GitHub API using Personal Access Token and Key-Based incremental replications |
| Tap | **[Shopify](https://github.com/singer-io/tap-shopify)** | Extra | [![PyPI version](https://badge.fury.io/py/tap-shopify.svg)](https://badge.fury.io/py/tap-shopify) | Extracts data from Shopify API using Personal App API Password and date based incremental replications |
| Tap | **[Slack](https://github.com/singer-io/tap-slack)** | | [![PyPI version](https://badge.fury.io/py/tap-slack.svg)](https://badge.fury.io/py/tap-slack) | Extracts data from a Slack API using Bot User Token and Key-Based incremental replications |
| Target | **[Postgres](https://github.com/transferwise/pipelinewise-target-postgres)** | | [![PyPI version](https://badge.fury.io/py/pipelinewise-target-postgres.svg)](https://badge.fury.io/py/pipelinewise-target-postgres) | Loads data from any tap into PostgreSQL database |
| Target | **[Redshift](https://github.com/transferwise/pipelinewise-target-redshift)** | | [![PyPI version](https://badge.fury.io/py/pipelinewise-target-redshift.svg)](https://badge.fury.io/py/pipelinewise-target-redshift) | Loads data from any tap into Amazon Redshift Data Warehouse |
| Target | **[Snowflake](https://github.com/transferwise/pipelinewise-target-snowflake)** | | [![PyPI version](https://badge.fury.io/py/pipelinewise-target-snowflake.svg)](https://badge.fury.io/py/pipelinewise-target-snowflake) | Loads data from any tap into Snowflake Data Warehouse |
Expand Down
10 changes: 10 additions & 0 deletions docs/connectors/taps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ PipelineWise can replicate data from the following data sources:

:ref:`tap-shopify`

.. container:: tile

.. container:: img-hover-zoom

.. image:: ../img/slack-logo.png
:target: taps/slack.html

:ref:`tap-slack`

Configuring taps
----------------
.. toctree::
Expand All @@ -177,3 +186,4 @@ Configuring taps
taps/google_analytics
taps/github
taps/shopify
taps/slack
115 changes: 115 additions & 0 deletions docs/connectors/taps/slack.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@

.. _tap-slack:

Tap Slack
----------

Configure your Slack workspace
''''''''''''''''''''''''''''''

The tap requires a `Slack Bot user token <https://api.slack.com/authentication/token-types#granular_bot>`_
to interact with your Slack workspace. You can obtain a token for a single workspace by creating a new
`Slack App <https://api.slack.com/apps?new_app=1>`_ in your workspace and assigning it the relevant
`scopes <https://api.slack.com/docs/oauth-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``

Configuring what to extract
'''''''''''''''''''''''''''

PipelineWise configures every tap with a common structured YAML file format.
A sample YAML for Jira replication can be generated into a project directory by
following the steps in the :ref:`generating_pipelines` section.

Example YAML for ``tap-slack``:

.. code-block:: bash
---
# ------------------------------------------------------------------------------
# General Properties
# ------------------------------------------------------------------------------
id: "slack" # Unique identifier of the tap
name: "Slack" # Name of the tap
type: "tap-slack" # !! THIS SHOULD NOT CHANGE !!
owner: "[email protected]" # Data owner to contact
#send_alert: False # Optional: Disable all configured alerts on this tap
# ------------------------------------------------------------------------------
# Source (Tap) - Github connection details
# ------------------------------------------------------------------------------
db_conn:
token: "<SLACK_TOKEN>" # Slack API token
start_date: "2020-09-01" # Start date. Data will be synced incrementally starting from this data
#channels: ["ID1", "ID2", "ID3"] # Optional: 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
#exclude_archived: "false" # Optional: You can control whether or not the tap will sync archived channels
# by including the following in the tap config
#private_channels: "false" # Optional:, you can also specify whether you want to sync private
# channels. By default private channels not synced
#join_public_channels: "false" # Optional: Auto-join every public channel.
# 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.
#date_window_size: "5" # Optional: 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.
# ------------------------------------------------------------------------------
# Destination (Target) - Target properties
# Connection details should be in the relevant target YAML file
# ------------------------------------------------------------------------------
target: "snowflake" # ID of the target connector where the data will be loaded
batch_size_rows: 20000 # Batch size for the stream to optimise load performance
stream_buffer_size: 0 # In-memory buffer size (MB) between taps and targets for asynchronous data pipes
default_target_schema: "slack" # Target schema where the data will be loaded
#default_target_schema_select_permission: # Optional: Grant SELECT on schema and tables that created
# - grp_power
# ------------------------------------------------------------------------------
# Source to target Schema mapping
# ------------------------------------------------------------------------------
schemas:
- source_schema: "slack" # This is mandatory, but can be anything in this tap type
target_schema: "slack" # Target schema in the destination Data Warehouse
target_schema_select_permissions: # Optional: Grant SELECT on schema and tables that created
- grp_stats
# List of Slack tables to load into destination Data Warehouse
# Tap-Slack will use the best incremental strategies automatically to replicate data
tables:
# Supported tables
- table_name: "channels"
- table_name: "users"
- table_name: "channel_members"
- table_name: "messages"
- table_name: "threads"
- table_name: "user_groups"
- table_name: "teams"
# Additional supported tables
#- table_name: "files"
#- table_name: "remote_files"
# OPTIONAL: Load time transformations - you can add it to any table
#transformations:
# - column: "some_column_to_transform" # Column to transform
# type: "SET-NULL" # Transformation type
Binary file added docs/img/slack-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,18 @@ PipelineWise can replicate data from the following data sources:

.. image:: img/shopify-logo.png
:target: connectors/taps/shopify.html

:ref:`tap-shopify`

.. container:: tile

.. container:: img-hover-zoom

.. image:: img/slack-logo.png
:target: connectors/taps/slack.html

:ref:`tap-slack`


Target (Destination Connectors)
-------------------------------
Expand Down
6 changes: 5 additions & 1 deletion docs/installation_guide/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ Here’s the list of the singer connectors and if they are installed by default
+----------------------------+---------------------------------------------+----------------------------------+---------------------------------------+
| tap-google-analytics | ./install --connectors=tap-google-analytics | NO | |
+----------------------------+---------------------------------------------+----------------------------------+---------------------------------------+
| tap-shopify | ./install --connectors=tap-shopify. | NO | |
| tap-github | ./install --connectors=tap-github | YES | |
+----------------------------+---------------------------------------------+----------------------------------+---------------------------------------+
| tap-slack | ./install --connectors=tap-slack | YES | |
+----------------------------+---------------------------------------------+----------------------------------+---------------------------------------+
| tap-shopify | ./install --connectors=tap-shopify | NO | |
+----------------------------+---------------------------------------------+----------------------------------+---------------------------------------+
| target-postgres | ./install --connectors=target-postgres | YES | |
+----------------------------+---------------------------------------------+----------------------------------+---------------------------------------+
Expand Down
1 change: 1 addition & 0 deletions docs/user_guide/yaml_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ YAML configuration
* :ref:`tap-zendesk`
* :ref:`tap-zuora`
* :ref:`tap-github`
* :ref:`tap-slack`
* :ref:`tap-shopify`
* :ref:`target-postgres`
* :ref:`target-redshift`
Expand Down
3 changes: 2 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ DEFAULT_CONNECTORS=(
tap-zendesk
tap-mongodb
tap-github
tap-slack
target-s3-csv
target-snowflake
target-redshift
Expand All @@ -194,7 +195,7 @@ if [[ -z $CONNECTORS ]]; then
done


# Install every avaliable connectors if --connectors=all passed
# Install every available connectors if --connectors=all passed
elif [[ $CONNECTORS == "all" ]]; then
for i in ${DEFAULT_CONNECTORS[@]}; do
install_connector $i
Expand Down
75 changes: 75 additions & 0 deletions pipelinewise/cli/samples/tap_slack.yml.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---

# ------------------------------------------------------------------------------
# General Properties
# ------------------------------------------------------------------------------
id: "slack" # Unique identifier of the tap
name: "Slack" # Name of the tap
type: "tap-slack" # !! THIS SHOULD NOT CHANGE !!
owner: "[email protected]" # Data owner to contact
#send_alert: False # Optional: Disable all configured alerts on this tap


# ------------------------------------------------------------------------------
# Source (Tap) - Github connection details
# ------------------------------------------------------------------------------
db_conn:
token: "<SLACK_TOKEN>" # Slack API token
start_date: "2020-09-01" # Start date. Data will be synced incrementally starting from this data

#channels: ["ID1", "ID2", "ID3"] # Optional: 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
#exclude_archived: "false" # Optional: You can control whether or not the tap will sync archived channels
# by including the following in the tap config
#private_channels: "false" # Optional:, you can also specify whether you want to sync private
# channels. By default private channels not synced
#join_public_channels: "false" # Optional: Auto-join every public channel.
# 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.
#date_window_size: "5" # Optional: 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.

# ------------------------------------------------------------------------------
# Destination (Target) - Target properties
# Connection details should be in the relevant target YAML file
# ------------------------------------------------------------------------------
target: "snowflake" # ID of the target connector where the data will be loaded
batch_size_rows: 20000 # Batch size for the stream to optimise load performance
stream_buffer_size: 0 # In-memory buffer size (MB) between taps and targets for asynchronous data pipes
default_target_schema: "slack" # Target schema where the data will be loaded
#default_target_schema_select_permission: # Optional: Grant SELECT on schema and tables that created
# - grp_power


# ------------------------------------------------------------------------------
# Source to target Schema mapping
# ------------------------------------------------------------------------------
schemas:

- source_schema: "slack" # This is mandatory, but can be anything in this tap type
target_schema: "slack" # Target schema in the destination Data Warehouse
target_schema_select_permissions: # Optional: Grant SELECT on schema and tables that created
- grp_stats

# List of Slack tables to load into destination Data Warehouse
# Tap-Slack will use the best incremental strategies automatically to replicate data
tables:
# Supported tables
- table_name: "channels"
- table_name: "users"
- table_name: "channel_members"
- table_name: "messages"
- table_name: "threads"
- table_name: "user_groups"
- table_name: "teams"

# Additional supported tables
#- table_name: "files"
#- table_name: "remote_files"

# OPTIONAL: Load time transformations - you can add it to any table
#transformations:
# - column: "some_column_to_transform" # Column to transform
# type: "SET-NULL" # Transformation type
3 changes: 2 additions & 1 deletion pipelinewise/cli/schemas/tap.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"tap-zuora",
"tap-google-analytics",
"tap-github",
"tap-shopify"
"tap-shopify",
"tap-slack"
]
},
"db_conn": {
Expand Down
8 changes: 8 additions & 0 deletions pipelinewise/cli/tap_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@ def get_tap_properties(tap=None, temp_dir=None):
'default_replication_method': 'INCREMENTAL',
'default_data_flattening_max_level': 0
},
'tap-slack': {
'tap_config_extras': {},
'tap_stream_id_pattern': '{{table_name}}',
'tap_stream_name_pattern': '{{table_name}}',
'tap_catalog_argument': '--catalog',
'default_replication_method': 'LOG_BASED',
'default_data_flattening_max_level': 0
},
# Default values to use as a fallback method
'DEFAULT': {
'tap_config_extras': {},
Expand Down
1 change: 1 addition & 0 deletions singer-connectors/tap-slack/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pipelinewise-tap-slack==1.0.0

0 comments on commit fbce3e5

Please sign in to comment.