Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# dbt_intercom v1.4.0
[PR #72](https://github.com/fivetran/dbt_intercom/pull/73) includes the following updates:

## Feature
- Adds staging and intermediate models for Intercom Help Center articles and related entities.

# dbt_intercom v1.3.0
[PR #71](https://github.com/fivetran/dbt_intercom/pull/71) includes the following updates:

Expand Down
8 changes: 7 additions & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config-version: 2
name: 'intercom'
version: '1.3.0'
version: '1.4.0'
require-dbt-version: [">=1.3.0", "<3.0.0"]
models:
intercom:
Expand Down Expand Up @@ -28,9 +28,15 @@ vars:
tag: "{{ source('intercom', 'tag') }}"
team_admin: "{{ source('intercom', 'team_admin') }}"
team: "{{ source('intercom', 'team') }}"
article_history: "{{ source('intercom', 'article_history') }}"
collection_history: "{{ source('intercom', 'collection_history') }}"
help_center_history: "{{ source('intercom', 'help_center_history') }}"
intercom__company_history_pass_through_columns: []
intercom__contact_history_pass_through_columns: []
intercom__conversation_history_pass_through_columns: []
intercom__article_history_pass_through_columns: []
intercom__collection_history_pass_through_columns: []
intercom__help_center_history_pass_through_columns: []
clean-targets:
- target
- dbt_modules
Expand Down
29 changes: 29 additions & 0 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ vars:
intercom_tag_identifier: "tag_data"
intercom_team_admin_identifier: "team_admin_data"
intercom_team_identifier: "team_data"
intercom_article_history_identifier: "article_history_data"
intercom_collection_history_identifier: "collection_history_data"
intercom_help_center_history_identifier: "help_center_history_data"

seeds:
+docs:
Expand Down Expand Up @@ -95,6 +98,32 @@ seeds:
team_data:
+column_types:
id: "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}"
article_history_data:
+column_types:
id: "{{ 'varchar(100)' if target.type in ('redshift', 'postgres') else 'string' }}"
collection_id: "{{ 'varchar(100)' if target.type in ('redshift', 'postgres') else 'string' }}"
section_id: "{{ 'varchar(100)' if target.type in ('redshift', 'postgres') else 'string' }}"
author_id: "{{ 'varchar(100)' if target.type in ('redshift', 'postgres') else 'string' }}"
workspace_id: "{{ 'varchar(100)' if target.type in ('redshift', 'postgres') else 'string' }}"
created_at: timestamp
updated_at: timestamp
statistics_happy_reaction_percentage: float
statistics_neutral_reaction_percentage: float
statistics_sad_reaction_percentage: float
collection_history_data:
+column_types:
id: "{{ 'varchar(100)' if target.type in ('redshift', 'postgres') else 'string' }}"
help_center_id: "{{ 'varchar(100)' if target.type in ('redshift', 'postgres') else 'string' }}"
parent_id: "{{ 'varchar(100)' if target.type in ('redshift', 'postgres') else 'string' }}"
workspace_id: "{{ 'varchar(100)' if target.type in ('redshift', 'postgres') else 'string' }}"
created_at: timestamp
updated_at: timestamp
help_center_history_data:
+column_types:
id: "{{ 'varchar(100)' if target.type in ('redshift', 'postgres') else 'string' }}"
workspace_id: "{{ 'varchar(100)' if target.type in ('redshift', 'postgres') else 'string' }}"
created_at: timestamp
updated_at: timestamp

dispatch:
- macro_namespace: dbt_utils
Expand Down
5 changes: 5 additions & 0 deletions integration_tests/seeds/article_history_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
id,collection_id,section_id,author_id,title,description,body,url,type,state,parent_type,default_locale,workspace_id,statistics_type,statistics_views,statistics_conversations,statistics_reactions,statistics_happy_reaction_percentage,statistics_neutral_reaction_percentage,statistics_sad_reaction_percentage,created_at,updated_at,_fivetran_active,_fivetran_start,_fivetran_end,_fivetran_synced
article_001,collection_001,,4077639,Getting Started Guide,A comprehensive guide to getting started,<p>Welcome to our getting started guide...</p>,https://help.example.com/articles/getting-started,article,published,collection,en,ws_001,article_statistics,150,5,20,0.8,0.15,0.05,2023-01-15 10:00:00,2023-06-20 14:30:00,true,2023-01-15 10:00:00,,2023-06-20 15:00:00
article_002,collection_001,,4079659,FAQ - Common Questions,Frequently asked questions,<p>Here are answers to common questions...</p>,https://help.example.com/articles/faq,article,published,collection,en,ws_001,article_statistics,300,12,45,0.75,0.2,0.05,2023-02-01 09:00:00,2023-07-10 11:00:00,true,2023-02-01 09:00:00,,2023-07-10 12:00:00
article_003,collection_002,section_001,4077640,API Reference,Complete API documentation,<p>This document covers our REST API...</p>,https://help.example.com/articles/api-reference,article,published,section,en,ws_001,article_statistics,500,3,30,0.9,0.08,0.02,2023-03-10 08:00:00,2023-08-15 16:45:00,true,2023-03-10 08:00:00,,2023-08-15 17:00:00
article_004,collection_002,,4077639,Troubleshooting Guide,How to resolve common issues,<p>If you encounter problems...</p>,https://help.example.com/articles/troubleshooting,article,draft,collection,en,ws_001,article_statistics,50,1,5,0.6,0.3,0.1,2023-04-20 13:00:00,2023-09-01 10:00:00,true,2023-04-20 13:00:00,,2023-09-01 11:00:00
5 changes: 5 additions & 0 deletions integration_tests/seeds/collection_history_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
id,help_center_id,parent_id,name,description,url,icon,type,default_locale,workspace_id,order,created_at,updated_at,_fivetran_active,_fivetran_start,_fivetran_end,_fivetran_synced
collection_001,hc_001,,Getting Started,Resources to help you get started,https://help.example.com/collections/getting-started,rocket,collection,en,ws_001,1,2023-01-01 08:00:00,2023-06-15 12:00:00,true,2023-01-01 08:00:00,,2023-06-15 13:00:00
collection_002,hc_001,,Developer Resources,Technical documentation for developers,https://help.example.com/collections/developer,code,collection,en,ws_001,2,2023-01-05 09:00:00,2023-07-20 10:00:00,true,2023-01-05 09:00:00,,2023-07-20 11:00:00
section_001,hc_001,collection_002,API Documentation,Detailed API guides,https://help.example.com/collections/developer/api,book,collection,en,ws_001,1,2023-02-15 11:00:00,2023-08-10 14:00:00,true,2023-02-15 11:00:00,,2023-08-10 15:00:00
collection_003,hc_001,,Account & Billing,Account management and billing info,https://help.example.com/collections/billing,credit-card,collection,en,ws_001,3,2023-03-01 07:00:00,2023-09-05 09:00:00,true,2023-03-01 07:00:00,,2023-09-05 10:00:00
3 changes: 3 additions & 0 deletions integration_tests/seeds/help_center_history_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,display_name,identifier,workspace_id,website_turned_on,created_at,updated_at,_fivetran_active,_fivetran_start,_fivetran_end,_fivetran_synced
hc_001,Example Help Center,example-help,ws_001,true,2022-06-01 08:00:00,2023-05-15 10:00:00,true,2022-06-01 08:00:00,,2023-05-15 11:00:00
hc_002,Partner Portal Help,partner-help,ws_001,false,2022-09-15 09:00:00,2023-04-20 14:00:00,true,2022-09-15 09:00:00,,2023-04-20 15:00:00
40 changes: 40 additions & 0 deletions macros/staging/get_article_history_columns.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{% macro get_article_history_columns() %}

{% set columns = [
{"name": "_fivetran_active", "datatype": "boolean"},
{"name": "_fivetran_start", "datatype": dbt.type_timestamp()},
{"name": "_fivetran_end", "datatype": dbt.type_timestamp()},
{"name": "_fivetran_synced", "datatype": dbt.type_timestamp()},
{"name": "author_id", "datatype": dbt.type_string()},
{"name": "body", "datatype": dbt.type_string()},
{"name": "collection_id", "datatype": dbt.type_string()},
{"name": "created_at", "datatype": dbt.type_timestamp()},
{"name": "default_locale", "datatype": dbt.type_string()},
{"name": "description", "datatype": dbt.type_string()},
{"name": "id", "datatype": dbt.type_string()},
{"name": "parent_type", "datatype": dbt.type_string()},
{"name": "section_id", "datatype": dbt.type_string()},
{"name": "state", "datatype": dbt.type_string()},
{"name": "statistics_conversations", "datatype": dbt.type_int()},
{"name": "statistics_happy_reaction_percentage", "datatype": dbt.type_float()},
{"name": "statistics_neutral_reaction_percentage", "datatype": dbt.type_float()},
{"name": "statistics_reactions", "datatype": dbt.type_int()},
{"name": "statistics_sad_reaction_percentage", "datatype": dbt.type_float()},
{"name": "statistics_type", "datatype": dbt.type_string()},
{"name": "statistics_views", "datatype": dbt.type_int()},
{"name": "title", "datatype": dbt.type_string()},
{"name": "type", "datatype": dbt.type_string()},
{"name": "updated_at", "datatype": dbt.type_timestamp()},
{"name": "url", "datatype": dbt.type_string()},
{"name": "workspace_id", "datatype": dbt.type_string()}
] %}

{{ fivetran_utils.add_pass_through_columns(columns, var('intercom__article_history_pass_through_columns')) }}

{{ return(columns) }}

{% endmacro %}




31 changes: 31 additions & 0 deletions macros/staging/get_collection_history_columns.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{% macro get_collection_history_columns() %}

{% set columns = [
{"name": "_fivetran_active", "datatype": "boolean"},
{"name": "_fivetran_start", "datatype": dbt.type_timestamp()},
{"name": "_fivetran_end", "datatype": dbt.type_timestamp()},
{"name": "_fivetran_synced", "datatype": dbt.type_timestamp()},
{"name": "created_at", "datatype": dbt.type_timestamp()},
{"name": "default_locale", "datatype": dbt.type_string()},
{"name": "description", "datatype": dbt.type_string()},
{"name": "help_center_id", "datatype": dbt.type_string()},
{"name": "icon", "datatype": dbt.type_string()},
{"name": "id", "datatype": dbt.type_string()},
{"name": "name", "datatype": dbt.type_string()},
{"name": "order", "datatype": dbt.type_int()},
{"name": "parent_id", "datatype": dbt.type_string()},
{"name": "type", "datatype": dbt.type_string()},
{"name": "updated_at", "datatype": dbt.type_timestamp()},
{"name": "url", "datatype": dbt.type_string()},
{"name": "workspace_id", "datatype": dbt.type_string()}
] %}

{{ fivetran_utils.add_pass_through_columns(columns, var('intercom__collection_history_pass_through_columns')) }}

{{ return(columns) }}

{% endmacro %}




25 changes: 25 additions & 0 deletions macros/staging/get_help_center_history_columns.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% macro get_help_center_history_columns() %}

{% set columns = [
{"name": "_fivetran_active", "datatype": "boolean"},
{"name": "_fivetran_start", "datatype": dbt.type_timestamp()},
{"name": "_fivetran_end", "datatype": dbt.type_timestamp()},
{"name": "_fivetran_synced", "datatype": dbt.type_timestamp()},
{"name": "created_at", "datatype": dbt.type_timestamp()},
{"name": "display_name", "datatype": dbt.type_string()},
{"name": "id", "datatype": dbt.type_string()},
{"name": "identifier", "datatype": dbt.type_string()},
{"name": "updated_at", "datatype": dbt.type_timestamp()},
{"name": "website_turned_on", "datatype": "boolean"},
{"name": "workspace_id", "datatype": dbt.type_string()}
] %}

{{ fivetran_utils.add_pass_through_columns(columns, var('intercom__help_center_history_pass_through_columns')) }}

{{ return(columns) }}

{% endmacro %}




90 changes: 89 additions & 1 deletion models/intercom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ models:
- name: sla_name
description: The name of the SLA as given by the teammate when it was created.
- name: sla_status
description: One of hit”, ”missed, or cancelled.
description: One of "hit", "missed", or "cancelled".
- name: all_conversation_admins
description: String aggregate of all admins that contributed to the conversation.
- name: all_conversation_contacts
Expand All @@ -354,3 +354,91 @@ models:
description: An optional field for the customer to rate the conversation which will be between 1 and 5.
- name: conversation_remark
description: An optional field to add a remark to correspond to the number rating.

- name: intercom__article_enhanced
description: >
Each record represents a single help center article, enriched with data from collections, parent collections,
authors (admins), and help centers. This model provides a denormalized view of articles with all related
entity information for easier reporting and analysis on help center content performance.
columns:
- name: source_relation
description: "{{ doc('source_relation') }}"
- name: article_id
description: The unique identifier for the article.
tests:
- unique
- not_null
- name: article_title
description: The title of the article.
- name: article_description
description: The description or summary of the article.
- name: article_body
description: The full body content of the article (HTML).
- name: article_url
description: The public URL of the article.
- name: article_type
description: The type of the article (e.g., 'article').
- name: article_state
description: The publication state of the article (draft, published).
- name: default_locale
description: The default locale/language of the article.
- name: workspace_id
description: The Intercom workspace identifier.
- name: statistics_views
description: The number of article views.
- name: statistics_conversations
description: The number of conversations started from this article.
- name: statistics_reactions
description: The total number of reactions.
- name: statistics_happy_reaction_percentage
description: The percentage of happy reactions.
- name: statistics_neutral_reaction_percentage
description: The percentage of neutral reactions.
- name: statistics_sad_reaction_percentage
description: The percentage of sad reactions.
- name: collection_id
description: The unique identifier of the collection this article belongs to.
- name: collection_name
description: The name of the collection containing this article.
- name: collection_description
description: The description of the collection.
- name: collection_url
description: The public URL of the collection.
- name: collection_icon
description: The icon identifier for the collection.
- name: collection_display_order
description: The display order of the collection within its parent.
- name: parent_collection_id
description: The unique identifier of the parent collection (for nested sections).
- name: parent_collection_name
description: The name of the parent collection.
- name: parent_collection_url
description: The URL of the parent collection.
- name: author_id
description: The unique identifier of the admin who authored the article.
- name: author_name
description: The name of the article author.
- name: author_job_title
description: The job title of the article author.
- name: help_center_id
description: The unique identifier of the help center.
- name: help_center_name
description: The name of the help center.
- name: help_center_identifier
description: The URL-friendly identifier for the help center.
- name: is_help_center_website_enabled
description: Boolean indicating whether the help center website is enabled.
- name: article_created_at
description: The time the article was created.
- name: article_updated_at
description: The time the article was last updated.
- name: is_published
description: Boolean flag indicating if article state is 'published'.
- name: is_in_nested_section
description: Boolean flag indicating if the article is in a nested section (collection with parent).
- name: _fivetran_active
description: Boolean to identify an active record.
- name: _fivetran_start
description: Timestamp to record the time that a record is ingested by Fivetran.
- name: _fivetran_end
description: Timestamp to record the time when a record became inactive in the source system.
Loading