This is a Singer tap that produces JSON-formatted data following the Singer spec.
This tap:
- Pulls raw data from the Microsoft Graph API
- Extracts the following resources:
- Outputs the schema for each resource
- Incrementally pulls data based on the input state
- users
- Data key: value
- Primary keys: id
- Replication strategy: Full Table
- Transformations: camelCase to snake_case
- groups
- Data key: value
- Primary keys: id
- Replication strategy: Full Table
- Transformations: camelCase to snake_case
- group_members
- Data key: value
- Primary keys: id
- Replication strategy: Full Table
- Transformations: camelCase to snake_case
- group_owners
- Data key: value
- Primary keys: id
- Replication strategy: Full Table
- Transformations: camelCase to snake_case
- channels
- Data key: value
- Primary keys: id
- Replication strategy: Full Table
- Transformations: camelCase to snake_case
- channel_members
- Data key: value
- Primary keys: id
- Replication strategy: Full Table
- Transformations: camelCase to snake_case
- channel_tabs
- Data key: value
- Primary keys: id
- Replication strategy: Full Table
- Transformations: camelCase to snake_case
- channel_messages
- Data key: value
- Primary keys: id
- Replication strategy: Incremental (query all, filter results)
- Bookmark: ucreatedDateTime OR lastModifiedDateTime OR deletedDateTime
- Transformations: camelCase to snake_case
- channel_message_replies
- Data key: value
- Primary keys: id
- Replication strategy: Incremental (query all, filter results)
- Bookmark: ucreatedDateTime OR lastModifiedDateTime OR deletedDateTime
- Transformations: camelCase to snake_case
- conversations
- Data key: value
- Primary keys: id
- Replication strategy: Incremental (query all, filter results)
- Bookmark: lastDeliveredDateTime
- Transformations: camelCase to snake_case
- conversation_threads
- Data key: value
- Primary keys: id
- Replication strategy: Incremental (query all, filter results)
- Bookmark: lastDeliveredDateTime
- Transformations: camelCase to snake_case
- conversation_posts
- Data key: value
- Primary keys: id
- Replication strategy: Incremental (query all, filter results)
- Bookmark: lastDeliveredDateTime
- Transformations: camelCase to snake_case
- team_drives
- Data key: value
- Primary keys: id
- Replication strategy: Incremental (query all, filter results)
- Bookmark: lastModifiedDateTime
- Transformations: camelCase to snake_case
- team_device_usage_report
- Primary keys: id
- Replication strategy: Incremental (query all, filter results)
- Bookmark: report_refresh_date
- Transformations: camelCase to snake_case
The Microsoft Graph API uses OAuth for authentication. Follow these instructions for creating an app in the Azure portal. This process will produce the client_id
, client_secret
, and tenant_id
needed for the tap configuration file.
Register a new application with the Azure portal
- Login to Azure Portal
- Click upper-left menu icon and select Azure Active Directory
- Select App Registrations
- Click New registration
- Register an application
- Name: tap-microsoft-teams
- Supported account types: Accounts in this organizational directory only
- Redirect URL: Web - https://YOURDOMAIN/callback
- Register (button)
- Record the client_id, tenant_id, and application_id (Object ID) which will be used by the tap for authentication and API integration.
- Select Branding
- Name: tap-microsoft-teams
- Logo: [singer-io-logo.png, 512x512 px]
- Homepage URL: https://YOURDOMAIN
- ToS URL: https://www.stitchdata.com/eula/
- Privacy URL: https://www.stitchdata.com/privacy/
- Save
- Select Authentication
- Platform configurations: Web (already setup)
- Supported account types: (already setup)
- Logout URL: https://app.stitchdata.com/session/create
- Access tokens: checked
- Public client: No
- Save
- Select Certificates & secrets
- Provide Description and Expires
- Description: tap-microsoft-teams client secret
- Expires: Never
- Add
- Copy the client secret Value, this will be the client_secret
- Select API permissions
- Click Add a permission
- Select Microsoft Graph
- Select Application permissions
- Select the following permissions:
- Application > Application.Read.All
- Calendars > Calendars.Read?
- Chat > Chat.Read.All
- Files > Files.Read.All
- Group > Group.Read.All
- Notes > Notes.Read.All
- OnlineMeetings > OnlineMeetings.Read.All
- Reports > Reports.Read.All
- Schedule > Schedule.Read.All
- Team > Team.ReadBasic.All
- User > User.Read.All
- Click Add permissions
-
Install
Clone this repository, and then install using setup.py. We recommend using a virtualenv:
> virtualenv -p python3 venv > source venv/bin/activate > python setup.py install OR > cd .../tap-ms-teams > pip install .
-
Dependent libraries The following dependent libraries were installed.
> pip install singer-python > pip install singer-tools > pip install target-stitch > pip install target-json
-
Create your tap's
config.json
file which should look like the following:{ "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_API_TOKEN", "tenant_id": "YOUR_TENANT_ID", "start_date": "2020-05-01T00:00:00Z", "user_agent": "tap-ms-teams<api_user_email@your_company.com>" }
Optionally, also create a
state.json
file.currently_syncing
is an optional attribute used for identifying the last object to be synced in case the job is interrupted mid-stream. The next run would begin where the last job left off.{ "bookmarks": { "conversation_threads": "2020-08-03T14:21:40.000000Z", "team_drives": "2020-07-13T16:55:39.000000Z", "channel_messages": "2020-08-12T23:18:03.915000Z", "conversation_posts": "2020-08-03T14:21:40.000000Z", "conversations": "2020-08-03T14:21:40.000000Z", "channel_message_replies": "2020-08-12T23:38:57.582000Z" } }
-
Run the Tap in Discovery Mode This creates a catalog.json for selecting objects/fields to integrate:
tap-ms-teams --config config.json --discover > catalog.json
See the Singer docs on discovery mode here.
-
Run the Tap in Sync Mode (with catalog) and write out to state file
For Sync mode:
> tap-ms-teams --config tap_config.json --catalog catalog.json > state.json > tail -1 state.json > state.json.tmp && mv state.json.tmp state.json
To load to json files to verify outputs:
> tap-ms-teams --config tap_config.json --catalog catalog.json | target-json > state.json > tail -1 state.json > state.json.tmp && mv state.json.tmp state.json
To pseudo-load to Stitch Import API with dry run:
> tap-ms-teams --config tap_config.json --catalog catalog.json | target-stitch --config target_config.json --dry-run > state.json > tail -1 state.json > state.json.tmp && mv state.json.tmp state.json
-
Test the Tap
To check the tap and verify working:
> tap-ms-teams --config tap_config.json --catalog catalog.json | singer-check-tap > state.json > tail -1 state.json > state.json.tmp && mv state.json.tmp state.json
Check tap resulted in the following:
The output is valid. It contained 114 messages for 13 streams. 13 schema messages 75 record messages 26 state messages Details by stream: +-------------------------+---------+---------+ | stream | records | schemas | +-------------------------+---------+---------+ | users | 10 | 1 | | groups | 3 | 1 | | group_members | 13 | 1 | | group_owners | 7 | 1 | | channels | 5 | 1 | | channel_members | 5 | 1 | | channel_tabs | 5 | 1 | | channel_messages | 8 | 1 | | channel_message_replies | 6 | 1 | | conversations | 3 | 1 | | conversation_threads | 3 | 1 | | conversation_posts | 3 | 1 | | team_drives | 4 | 1 | +-------------------------+---------+---------+
Copyright © 2020 Stitch