{"id":22793352,"url":"https://github.com/fivetran/dbt_intercom","last_synced_at":"2025-12-29T17:30:48.010Z","repository":{"id":40289955,"uuid":"303495908","full_name":"fivetran/dbt_intercom","owner":"fivetran","description":"Data models for Fivetran's Intercom connector built using dbt.","archived":false,"fork":false,"pushed_at":"2025-01-22T20:56:04.000Z","size":1765,"stargazers_count":4,"open_issues_count":4,"forks_count":6,"subscribers_count":39,"default_branch":"main","last_synced_at":"2025-03-29T05:33:55.549Z","etag":null,"topics":["dbt","dbt-packages","fivetran","intercom"],"latest_commit_sha":null,"homepage":"https://fivetran.github.io/dbt_intercom/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fivetran.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-12T19:42:34.000Z","updated_at":"2025-01-22T20:56:06.000Z","dependencies_parsed_at":"2023-02-15T12:35:27.564Z","dependency_job_id":"b6833caa-bbd3-4975-a3d7-065fab328b75","html_url":"https://github.com/fivetran/dbt_intercom","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fdbt_intercom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fdbt_intercom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fdbt_intercom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fivetran%2Fdbt_intercom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fivetran","download_url":"https://codeload.github.com/fivetran/dbt_intercom/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249266533,"owners_count":21240771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dbt","dbt-packages","fivetran","intercom"],"created_at":"2024-12-12T03:19:34.300Z","updated_at":"2025-12-29T17:30:47.997Z","avatar_url":"https://github.com/fivetran.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Intercom dbt Package ([Docs](https://fivetran.github.io/dbt_intercom/))\n\n\u003cp align=\"left\"\u003e\n    \u003ca alt=\"License\"\n        href=\"https://github.com/fivetran/dbt_intercom/blob/main/LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\" /\u003e\u003c/a\u003e\n    \u003ca alt=\"dbt-core\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/dbt_Core™_version-\u003e=1.3.0,_\u003c3.0.0-orange.svg\" /\u003e\u003c/a\u003e\n    \u003ca alt=\"Maintained?\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Maintained%3F-yes-green.svg\" /\u003e\u003c/a\u003e\n    \u003ca alt=\"PRs\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Contributions-welcome-blueviolet\" /\u003e\u003c/a\u003e\n    \u003ca alt=\"Fivetran Quickstart Compatible\"\n        href=\"https://fivetran.com/docs/transformations/dbt/quickstart\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Fivetran_Quickstart_Compatible%3F-yes-green.svg\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## What does this dbt package do?\n- Produces modeled tables that leverage Intercom data from [Fivetran's connector](https://fivetran.com/docs/applications/intercom) in the format described by [this ERD](https://fivetran.com/docs/applications/intercom#schemainformation).\n\n- Enables you to better understand the performance, responsiveness, and effectiveness of your team's conversations with customers via Intercom. It achieves this by:\n  - Creating an enhanced conversations table to enable large-scale reporting on all current and closed conversations\n  - Enriching conversation data with relevant contacts data\n  - Aggregating your team's performance data across all conversations\n  - Providing aggregate rating and timeliness metrics for customer conversations to enable company-level conversation performance reporting\n\n\u003c!--section=\"intercom_transformation_model\"--\u003e\nThe following table provides a detailed list of all tables materialized within this package by default.\n\n| **Table**                | **Description**                                                                                                                            |\n| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |\n| [intercom__admin_metrics](https://github.com/fivetran/dbt_intercom/blob/main/models/intercom__admin_metrics.sql)                                               | Each record represents an individual admin (employee) and a unique team they are assigned on, enriched with admin-specific conversation data like total conversations, average rating, and median response times by specific team. |\n| [intercom__article_enhanced](https://github.com/fivetran/dbt_intercom/blob/main/models/intercom__article_enhanced.sql)                                         | Each record represents a single help center article, enriched with data from collections, authors, and help centers. |\n| [intercom__company_enhanced](https://github.com/fivetran/dbt_intercom/blob/main/models/intercom__company_enhanced.sql)                                         | Each record represents a single company, enriched with data related to the company industry, monthly spend, and user count. |\n| [intercom__company_metrics](https://github.com/fivetran/dbt_intercom/blob/main/models/intercom__company_metrics.sql)                                           | Each record represents a single row from `intercom__company_enhanced`, enriched with data like total conversation count, average satisfaction rating, median time to first response, and median time to last close with contacts associated to a single company. |\n| [intercom__contact_enhanced](https://github.com/fivetran/dbt_intercom/blob/main/models/intercom__contact_enhanced.sql)                                         | Each record represents a single contact, enriched with data like the contact's role, company, last contacted information, and email list subscription status. |\n| [intercom__conversation_enhanced](https://github.com/fivetran/dbt_intercom/blob/main/models/intercom__conversation_enhanced.sql)                               | Each record represents a single conversation, enriched with conversation part data like who was assigned to the conversation, which contact the conversation was with, the current conversation state, who closed the conversation, and the final conversation ratings from the contact. |\n| [intercom__conversation_metrics](https://github.com/fivetran/dbt_intercom/blob/main/models/intercom__conversation_metrics.sql)                                 | Each record represents a single row from `intercom__conversation_enhanced`, enriched with data like time to first response, time to first close, and time to last close. |\n\n### Materialized Models\nEach Quickstart transformation job run materializes 42 models if all components of this data model are enabled. This count includes all staging, intermediate, and final models materialized as `view`, `table`, or `incremental`.\n\u003c!--section-end--\u003e\n\n## How do I use the dbt package?\n\n### Step 1: Prerequisites\nTo use this dbt package, you must have the following:\n\n- At least one Fivetran Intercom connection syncing data into your destination.\n- A **BigQuery**, **Snowflake**, **Redshift** or **PostgreSQL** destination.\n\n### Step 2: Install the package\nInclude the following intercom package version in your `packages.yml` file:\n\u003e TIP: Check [dbt Hub](https://hub.getdbt.com/) for the latest installation instructions or [read the dbt docs](https://docs.getdbt.com/docs/package-management) for more information on installing packages.\n```yaml\npackages:\n  - package: fivetran/intercom\n    version: [\"\u003e=1.4.0\", \"\u003c1.5.0\"]\n```\n### Step 3: Define database and schema variables\n\n#### Option A: Single connection\nBy default, this package runs using your destination and the `intercom` schema. If this is not where your Intercom data is (for example, if your Intercom schema is named `intercom_fivetran`), add the following configuration to your root `dbt_project.yml` file:\n\n```yml\nvars:\n  intercom:\n    intercom_database: your_database_name\n    intercom_schema: your_schema_name\n```\n\n#### Option B: Union multiple connections\nIf you have multiple Intercom connections in Fivetran and would like to use this package on all of them simultaneously, we have provided functionality to do so. For each source table, the package will union all of the data together and pass the unioned table into the transformations. The `source_relation` column in each model indicates the origin of each record.\n\nTo use this functionality, you will need to set the `intercom_sources` variable in your root `dbt_project.yml` file:\n\n```yml\n# dbt_project.yml\n\nvars:\n  intercom:\n    intercom_sources:\n      - database: connection_1_destination_name # Required\n        schema: connection_1_schema_name # Required\n        name: connection_1_source_name # Required only if following the step in the following subsection\n\n      - database: connection_2_destination_name\n        schema: connection_2_schema_name\n        name: connection_2_source_name\n```\n\n##### Recommended: Incorporate unioned sources into DAG\n\u003e *If you are running the package through [Fivetran Transformations for dbt Core™](https://fivetran.com/docs/transformations/dbt#transformationsfordbtcore), the below step is necessary in order to synchronize model runs with your Intercom connections. Alternatively, you may choose to run the package through Fivetran [Quickstart](https://fivetran.com/docs/transformations/quickstart), which would create separate sets of models for each Intercom source rather than one set of unioned models.*\n\nBy default, this package defines one single-connection source, called `intercom`, which will be disabled if you are unioning multiple connections. This means that your DAG will not include your Intercom sources, though the package will run successfully.\n\nTo properly incorporate all of your Intercom connections into your project's DAG:\n1. Define each of your sources in a `.yml` file in your project. Utilize the following template for the `source`-level configurations, and, **most importantly**, copy and paste the table and column-level definitions from the package's `src_intercom.yml` [file](https://github.com/fivetran/dbt_intercom/blob/main/models/staging/src_intercom.yml).\n\n```yml\n# a .yml file in your root project\n\nversion: 2\n\nsources:\n  - name: \u003cname\u003e # ex: Should match name in intercom_sources\n    schema: \u003cschema_name\u003e\n    database: \u003cdatabase_name\u003e\n    loader: fivetran\n    config:\n      loaded_at_field: _fivetran_synced\n      freshness: # feel free to adjust to your liking\n        warn_after: {count: 72, period: hour}\n        error_after: {count: 168, period: hour}\n\n    tables: # copy and paste from intercom/models/staging/src_intercom.yml - see https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/ for how to use anchors to only do so once\n```\n\n\u003e **Note**: If there are source tables you do not have (see [Step 4](https://github.com/fivetran/dbt_intercom?tab=readme-ov-file#optional-step-4-additional-configurations)), you may still include them, as long as you have set the right variables to `False`.\n\n2. Set the `has_defined_sources` variable (scoped to the `intercom` package) to `True`, like such:\n```yml\n# dbt_project.yml\nvars:\n  intercom:\n    has_defined_sources: true\n```\n### (Optional) Step 4: Additional configurations\n\u003cdetails open\u003e\u003csummary\u003eExpand/Collapse details\u003c/summary\u003e\n\n#### Adding passthrough metrics\nYou can add additional columns to the `intercom__article_enhanced`, `intercom__company_enhanced`, `intercom__contact_enhanced`, and `intercom__conversation_enhanced` tables using our pass-through column variables. These variables allow for the pass-through fields to be aliased (`alias`) and casted (`transform_sql`) if desired, but not required. Datatype casting is configured via a sql snippet within the `transform_sql` key. You may add the desired sql while omitting the `as field_name` at the end and your custom pass-though fields will be casted accordingly. Use the below format for declaring the respective pass-through variables in your root `dbt_project.yml`.\n\n```yml\nvars:\n  intercom__company_history_pass_through_columns:\n    - name: company_history_custom_field\n      alias: new_name_for_this_field\n      transform_sql:  \"cast(new_name_for_this_field as int64)\"\n    - name:           \"this_other_field\"\n      transform_sql:  \"cast(this_other_field as string)\"\n    - name: custom_monthly_spend\n    - name: custom_paid_subscriber\n  # a similar pattern can be applied to the rest of the following variables.\n  intercom__contact_history_pass_through_columns:\n  intercom__conversation_history_pass_through_columns:\n  intercom__article_history_pass_through_columns:\n```\n#### Disabling Models\nThis package assumes that you use Intercom's help center functionality (`article`, `collection_history`, `help_center_history`) and mapping tables (`company tag`, `contact tag`, `contact company`, `conversation tag`, `team`, `team admin`). If you do not use these tables, add the configuration below to your `dbt_project.yml`. By default, these variables are set to `True`:\n\n```yml\n# dbt_project.yml\n\n...\nvars:\n  intercom__using_articles: False # This disables all help center functionality\n  intercom__using_collection_history: False # Also requires articles to be enabled\n  intercom__using_help_center_history: False # Also requires articles and collection_history to be enabled\n  intercom__using_contact_company: False\n  intercom__using_company_tags: False\n  intercom__using_contact_tags: False\n  intercom__using_conversation_tags: False\n  intercom__using_team: False\n```\n\n#### Changing the build schema\nBy default this package will build the Intercom staging models within a schema titled (\u003ctarget_schema\u003e + `_stg_intercom`) and the Intercom final models with a schema titled (\u003ctarget_schema\u003e + `_intercom`) in your target database. If this is not where you would like your modeled Intercom data to be written to, add the following configuration to your `dbt_project.yml` file:\n\n```yml\nmodels:\n    intercom:\n      +schema: my_new_schema_name # Leave +schema: blank to use the default target_schema.\n      staging:\n        +schema: my_new_schema_name # Leave +schema: blank to use the default target_schema.\n```\n#### Change the source table references\nIf an individual source table has a different name than the package expects, add the table name as it appears in your destination to the respective variable:\n\n\u003e IMPORTANT: See this project's [`dbt_project.yml`](https://github.com/fivetran/dbt_intercom/blob/main/dbt_project.yml) variable declarations to see the expected names.\n\n```yml\nvars:\n    intercom_\u003cdefault_source_table_name\u003e_identifier: your_table_name \n```\n\n\u003c/details\u003e\n\n### Limitations\nIntercom V2.0 does not support API exposure to company-defined business hours. We therefore calculate all `time_to` metrics in their entirety without subtracting business hours.\n\n## Does this package have dependencies?\nThis dbt package is dependent on the following dbt packages. These dependencies are installed by default within this package. For more information on the following packages, refer to the [dbt hub](https://hub.getdbt.com/) site.\n\u003e IMPORTANT: If you have any of these dependent packages in your own `packages.yml` file, we highly recommend that you remove them from your root `packages.yml` to avoid package version conflicts.\n\n```yml\npackages:\n    - package: fivetran/fivetran_utils\n      version: [\"\u003e=0.4.0\", \"\u003c0.5.0\"]\n\n    - package: dbt-labs/dbt_utils\n      version: [\"\u003e=1.0.0\", \"\u003c2.0.0\"]\n```\n## How is this package maintained and can I contribute?\n### Package Maintenance\nThe Fivetran team maintaining this package _only_ maintains the latest version of the package. We highly recommend you stay consistent with the [latest version](https://hub.getdbt.com/fivetran/intercom/latest/) of the package and refer to the [CHANGELOG](https://github.com/fivetran/dbt_intercom/blob/main/CHANGELOG.md) and release notes for more information on changes across versions.\n\n### Contributions\nA small team of analytics engineers at Fivetran develops these dbt packages. However, the packages are made better by community contributions.\n\nWe highly encourage and welcome contributions to this package. Check out [this dbt Discourse article](https://discourse.getdbt.com/t/contributing-to-a-dbt-package/657) on the best workflow for contributing to a package.\n\n## Are there any resources available?\n- If you have questions or want to reach out for help, see the [GitHub Issue](https://github.com/fivetran/dbt_intercom/issues/new/choose) section to find the right avenue of support for you.\n- If you would like to provide feedback to the dbt package team at Fivetran or would like to request a new dbt package, fill out our [Feedback Form](https://www.surveymonkey.com/r/DQ7K7WW).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffivetran%2Fdbt_intercom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffivetran%2Fdbt_intercom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffivetran%2Fdbt_intercom/lists"}