Skip to content

Commit 9909cd6

Browse files
authored
🎉 Source HubSpot: engagements stream, remove auto-generated properties (#9385)
* extend schemas/engagements.json * fix unix newlines Signed-off-by: Sergey Chvalyuk <[email protected]>
1 parent 4534703 commit 9909cd6

File tree

6 files changed

+176
-16
lines changed

6 files changed

+176
-16
lines changed

‎airbyte-config/init/src/main/resources/seed/source_definitions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@
287287
- name: HubSpot
288288
sourceDefinitionId: 36c891d9-4bd9-43ac-bad2-10e12756272c
289289
dockerRepository: airbyte/source-hubspot
290-
dockerImageTag: 0.1.30
290+
dockerImageTag: 0.1.31
291291
documentationUrl: https://docs.airbyte.io/integrations/sources/hubspot
292292
icon: hubspot.svg
293293
sourceType: api

‎airbyte-config/init/src/main/resources/seed/source_specs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2846,7 +2846,7 @@
28462846
path_in_connector_config:
28472847
- "credentials"
28482848
- "client_secret"
2849-
- dockerImage: "airbyte/source-hubspot:0.1.30"
2849+
- dockerImage: "airbyte/source-hubspot:0.1.31"
28502850
spec:
28512851
documentationUrl: "https://docs.airbyte.io/integrations/sources/hubspot"
28522852
connectionSpecification:

‎airbyte-integrations/connectors/source-hubspot/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ COPY source_hubspot ./source_hubspot
3434
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
3535
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
3636

37-
LABEL io.airbyte.version=0.1.30
37+
LABEL io.airbyte.version=0.1.31
3838
LABEL io.airbyte.name=airbyte/source-hubspot

‎airbyte-integrations/connectors/source-hubspot/source_hubspot/api.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,7 @@ def _cast_value(declared_field_types: List, field_name: str, field_value: Any, d
265265

266266
def _cast_record_fields_if_needed(self, record: Mapping, properties: Mapping[str, Any] = None) -> Mapping:
267267

268-
if self.entity not in {"contact", "engagement", "product", "quote", "ticket", "company", "deal", "line_item"}:
269-
return record
270-
271-
if not record.get("properties"):
268+
if not self.entity or not record.get("properties"):
272269
return record
273270

274271
properties = properties or self.properties
@@ -363,7 +360,7 @@ def parse_response(self, response: Union[Mapping[str, Any], List[dict]]) -> Iter
363360
'message': 'This hapikey (....) does not have proper permissions! (requires any of [automation-access])',
364361
'correlationId': '111111-2222-3333-4444-55555555555'}
365362
"""
366-
logger.warning(f"Stream `{self.entity}` cannot be procced. {response.get('message')}")
363+
logger.warning(f"Stream `{self.name}` cannot be procced. {response.get('message')}")
367364
return
368365

369366
if response.get(self.data_field) is None:
@@ -713,7 +710,6 @@ class EngagementStream(Stream):
713710
Docs: https://legacydocs.hubspot.com/docs/methods/engagements/get-all-engagements
714711
"""
715712

716-
entity = "engagement"
717713
url = "/engagements/v1/engagements/paged"
718714
more_key = "hasMore"
719715
limit = 250

‎airbyte-integrations/connectors/source-hubspot/source_hubspot/schemas/engagements.json

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
"id": {
66
"type": ["null", "integer"]
77
},
8+
"uid": {
9+
"type": ["null", "string"]
10+
},
11+
"teamId": {
12+
"type": ["null", "integer"]
13+
},
814
"portalId": {
915
"type": ["null", "integer"]
1016
},
@@ -14,6 +20,12 @@
1420
"createdAt": {
1521
"type": ["null", "integer"]
1622
},
23+
"createdBy": {
24+
"type": ["null", "integer"]
25+
},
26+
"modifiedBy": {
27+
"type": ["null", "integer"]
28+
},
1729
"lastUpdated": {
1830
"type": ["null", "integer"]
1931
},
@@ -26,6 +38,33 @@
2638
"timestamp": {
2739
"type": ["null", "integer"]
2840
},
41+
"bodyPreview": {
42+
"type": ["null", "string"]
43+
},
44+
"bodyPreviewHtml": {
45+
"type": ["null", "string"]
46+
},
47+
"bodyPreviewIsTruncated": {
48+
"type": ["null", "boolean"]
49+
},
50+
"allAccessibleTeamIds": {
51+
"type": ["null", "array"],
52+
"items": {
53+
"type": ["null", "integer"]
54+
}
55+
},
56+
"activityType": {
57+
"type": ["null", "string"]
58+
},
59+
"gdprDeleted": {
60+
"type": ["null", "boolean"]
61+
},
62+
"source": {
63+
"type": ["null", "string"]
64+
},
65+
"sourceId": {
66+
"type": ["null", "string"]
67+
},
2968
"associations": {
3069
"type": ["null", "object"],
3170
"properties": {
@@ -46,6 +85,24 @@
4685
"items": {
4786
"type": ["null", "integer"]
4887
}
88+
},
89+
"ownerIds": {
90+
"type": ["null", "array"],
91+
"items": {
92+
"type": ["null", "integer"]
93+
}
94+
},
95+
"workflowIds": {
96+
"type": ["null", "array"],
97+
"items": {
98+
"type": ["null", "integer"]
99+
}
100+
},
101+
"ticketIds": {
102+
"type": ["null", "array"],
103+
"items": {
104+
"type": ["null", "integer"]
105+
}
49106
}
50107
}
51108
},
@@ -77,6 +134,17 @@
77134
},
78135
"lastName": {
79136
"type": ["null", "string"]
137+
},
138+
"raw": {
139+
"type": ["null", "string"]
140+
}
141+
}
142+
},
143+
"sender": {
144+
"type": ["null", "object"],
145+
"properties": {
146+
"email": {
147+
"type": ["null", "string"]
80148
}
81149
}
82150
},
@@ -87,6 +155,15 @@
87155
"properties": {
88156
"email": {
89157
"type": ["null", "string"]
158+
},
159+
"firstName": {
160+
"type": ["null", "string"]
161+
},
162+
"lastName": {
163+
"type": ["null", "string"]
164+
},
165+
"raw": {
166+
"type": ["null", "string"]
90167
}
91168
}
92169
}
@@ -98,6 +175,15 @@
98175
"properties": {
99176
"email": {
100177
"type": ["null", "string"]
178+
},
179+
"firstName": {
180+
"type": ["null", "string"]
181+
},
182+
"lastName": {
183+
"type": ["null", "string"]
184+
},
185+
"raw": {
186+
"type": ["null", "string"]
101187
}
102188
}
103189
}
@@ -157,6 +243,84 @@
157243
},
158244
"disposition": {
159245
"type": ["null", "string"]
246+
},
247+
"completionDate": {
248+
"type": ["null", "integer"]
249+
},
250+
"taskType": {
251+
"type": ["null", "string"]
252+
},
253+
"reminders": {
254+
"type": ["null", "array"],
255+
"items": {
256+
"type": ["null", "integer"]
257+
}
258+
},
259+
"threadId": {
260+
"type": ["null", "string", "integer"]
261+
},
262+
"messageId": {
263+
"type": ["null", "string"]
264+
},
265+
"loggedFrom": {
266+
"type": ["null", "string"]
267+
},
268+
"attachedVideoOpened": {
269+
"type": ["null", "boolean"]
270+
},
271+
"attachedVideoWatched": {
272+
"type": ["null", "boolean"]
273+
},
274+
"trackerKey": {
275+
"type": ["null", "string"]
276+
},
277+
"sendDefaultReminder": {
278+
"type": ["null", "boolean"]
279+
},
280+
"source": {
281+
"type": ["null", "string"]
282+
},
283+
"unknownVisitorConversation": {
284+
"type": ["null", "boolean"]
285+
},
286+
"facsimileSendId": {
287+
"type": ["null", "string"]
288+
},
289+
"sentVia": {
290+
"type": ["null", "string"]
291+
},
292+
"sequenceStepOrder": {
293+
"type": ["null", "integer"]
294+
},
295+
"externalUrl": {
296+
"type": ["null", "string"]
297+
},
298+
"postSendStatus": {
299+
"type": ["null", "string"]
300+
},
301+
"errorMessage": {
302+
"type": ["null", "string"]
303+
},
304+
"recipientDropReasons": {
305+
"type": ["null", "string"]
306+
},
307+
"calleeObjectId": {
308+
"type": ["null", "integer"]
309+
},
310+
"calleeObjectType": {
311+
"type": ["null", "string"]
312+
},
313+
"mediaProcessingStatus": {
314+
"type": ["null", "string"]
315+
},
316+
"sourceId": {
317+
"type": ["null", "string"]
318+
},
319+
"priority": {
320+
"type": ["null", "string"]
321+
},
322+
"isAllDay": {
323+
"type": ["null", "boolean"]
160324
}
161325
}
162326
}

‎docs/integrations/sources/hubspot.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ This source is capable of syncing the following tables and their data:
3737
* [Workflows](https://legacydocs.hubspot.com/docs/methods/workflows/v3/get_workflows)
3838

3939
### A note on the `engagements` stream
40-
Objects in the `engagements` stream can have one of the following types: `note`, `email`, `task`, `meeting`, `call`.
40+
Objects in the `engagements` stream can have one of the following types: `note`, `email`, `task`, `meeting`, `call`.
4141

42-
Depending on the type of engagement, different properties will be set for that object in the `engagements_metadata` table in the destination.
42+
Depending on the type of engagement, different properties will be set for that object in the `engagements_metadata` table in the destination.
4343

4444
* A `call` engagement will have a corresponding `engagements_metadata` object with non-null values in the `toNumber`, `fromNumber`, `status`, `externalId`, `durationMilliseconds`, `externalAccountId`, `recordingUrl`, `body`, and `disposition` columns.
45-
* An `email` engagement will have a corresponding `engagements_metadata` object with with non-null values in the `subject`, `html`, and `text` columns. In addition, there will be records in four related tables, `engagements_metadata_from`, `engagements_metadata_to`, `engagements_metadata_cc`, `engagements_metadata_bcc`.
46-
* A `meeting` engagement will have a corresponding `engagements_metadata` object with non-null values in the `body`, `startTime`, `endTime`, and `title` columns.
47-
* A `note` engagement will have a corresponding `engagements_metadata` object with non-null values in the `body` column.
48-
* A `task` engagement will have a corresponding `engagements_metadata` object with non-null values in the `body`, `status`, and `forObjectType` columns.
45+
* An `email` engagement will have a corresponding `engagements_metadata` object with with non-null values in the `subject`, `html`, and `text` columns. In addition, there will be records in four related tables, `engagements_metadata_from`, `engagements_metadata_to`, `engagements_metadata_cc`, `engagements_metadata_bcc`.
46+
* A `meeting` engagement will have a corresponding `engagements_metadata` object with non-null values in the `body`, `startTime`, `endTime`, and `title` columns.
47+
* A `note` engagement will have a corresponding `engagements_metadata` object with non-null values in the `body` column.
48+
* A `task` engagement will have a corresponding `engagements_metadata` object with non-null values in the `body`, `status`, and `forObjectType` columns.
4949

5050

5151
**Note**: HubSpot API currently only supports `quotes` endpoint using API Key, using Oauth it is impossible to access this stream (as reported by [community.hubspot.com](https://community.hubspot.com/t5/APIs-Integrations/Help-with-using-Feedback-CRM-API-and-Quotes-CRM-API/m-p/449104/highlight/true#M44411)).
@@ -110,6 +110,7 @@ If you are using Oauth, most of the streams require the appropriate [scopes](htt
110110

111111
| Version | Date | Pull Request | Subject |
112112
|:--------|:-----------| :--- |:-----------------------------------------------------------------------------------------------------------------------------------------------|
113+
| 0.1.31 | 2022-01-11 | [9385](https://github.com/airbytehq/airbyte/pull/9385) | Remove auto-generated `properties` from `Engagements` stream |
113114
| 0.1.30 | 2021-01-10 | [9129](https://github.com/airbytehq/airbyte/pull/9129) | Created Contacts list memberships streams |
114115
| 0.1.29 | 2021-12-17 | [8699](https://github.com/airbytehq/airbyte/pull/8699) | Add incremental sync support for `companies`, `contact_lists`, `contacts`, `deals`, `line_items`, `products`, `quotes`, `tickets` streams |
115116
| 0.1.28 | 2021-12-15 | [8429](https://github.com/airbytehq/airbyte/pull/8429) | Update fields and descriptions |
@@ -134,4 +135,3 @@ If you are using Oauth, most of the streams require the appropriate [scopes](htt
134135
| 0.1.9 | 2021-08-11 | [5334](https://github.com/airbytehq/airbyte/pull/5334) | Fix empty strings inside float datatype |
135136
| 0.1.8 | 2021-08-06 | [5250](https://github.com/airbytehq/airbyte/pull/5250) | Fix issue with printing exceptions |
136137
| 0.1.7 | 2021-07-27 | [4913](https://github.com/airbytehq/airbyte/pull/4913) | Update fields schema |
137-

0 commit comments

Comments
 (0)