Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Source Instagram: add new fields for streams StoryInsights and MediaInsights #41937

Merged
merged 12 commits into from
Jul 29, 2024
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
2 changes: 2 additions & 0 deletions airbyte-integrations/connectors/source-instagram/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
NEW_SOURCE_CHECKLIST.md
.python-version
.venv
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 6acf6b55-4f1e-4fca-944e-1a3caef8aba8
dockerImageTag: 3.0.22
dockerImageTag: 3.1.0
dockerRepository: airbyte/source-instagram
githubIssueLabel: source-instagram
icon: instagram.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
version = "3.0.22"
version = "3.1.0"
im-voracity marked this conversation as resolved.
Show resolved Hide resolved
name = "source-instagram"
description = "Source implementation for Instagram."
authors = [ "Airbyte <[email protected]>",]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,16 @@ definitions:
metric: >-
{% if stream_partition.media_insights_info.media_product_type ==
"REELS" %}{{
'comments,ig_reels_avg_watch_time,ig_reels_video_view_total_time,likes,plays,reach,saved,shares'
'comments,ig_reels_avg_watch_time,ig_reels_video_view_total_time,likes,plays,reach,saved,shares,ig_reels_aggregated_all_plays_count,clips_replays_count'
}}{% elif stream_partition.media_insights_info.media_type ==
"VIDEO" and
stream_partition.media_insights_info.media_product_type == "FEED"
%}{{ 'impressions,reach,saved,video_views'}}{% elif
stream_partition.media_insights_info.media_type == "VIDEO" %}{{
'impressions,reach,saved,video_views,likes,comments,shares'
'impressions,reach,saved,video_views,likes,comments,shares,follows,profile_visits'
}}{%elif stream_partition.media_insights_info.media_type ==
"CAROUSEL_ALBUM"%}{{ 'impressions,reach,saved,video_views' }}{% else %}{{
'impressions,reach,saved,video_views,likes,comments,shares' }}{%
"CAROUSEL_ALBUM"%}{{ 'impressions,reach,saved,video_views,shares,follows,profile_visits' }}{% else %}{{
'impressions,reach,saved,video_views,likes,comments,shares,follows,profile_visits' }}{%
endif %}
error_handler:
type: CompositeErrorHandler
Expand Down Expand Up @@ -448,7 +448,7 @@ definitions:
path: "{{ stream_partition.story_insights_info.story_id }}/insights"
http_method: GET
request_parameters:
metric: impressions,reach,replies
metric: impressions,reach,replies,follows,profile_visits,shares,total_interactions
error_handler:
type: CompositeErrorHandler
error_handlers:
Expand Down Expand Up @@ -854,6 +854,26 @@ schemas:
type:
- "null"
- integer
ig_reels_aggregated_all_plays_count:
description: The number of times of Instagram Reels gets reproduced after an impression is counted.
type:
- "null"
- integer
clips_replays_count:
description: The number of times the reel gets reproduced after the first one.
type:
- "null"
- integer
follows:
description: The number of accounts that started to follow the profile.
type:
- "null"
- integer
profile_visits:
description: The number of times the profile has been visited.
type:
- "null"
- integer
required:
- id
Users:
Expand Down Expand Up @@ -1076,6 +1096,26 @@ schemas:
type:
- "null"
- integer
follows:
description: The number of accounts that started to follow the account.
type:
- "null"
- integer
profile_visits:
description: The number of times the profile was visited.
type:
- "null"
- integer
shares:
description: The number of times the story has been shared.
type:
- "null"
- integer
total_interactions:
description¨: The number of replies and shares of the story.
type:
- "null"
- integer
Api:
type: object
$schema: http://json-schema.org/schema#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"type": ["null", "string"]
},
"ig_reels_avg_watch_time": {
"description": "The average watch time of Instagram Reels videos in seconds.",
"description": "The average watch time of Instagram Reels videos in milliseconds.",
"type": ["null", "number"]
},
"ig_reels_video_view_total_time": {
"description": "The total watch time of Instagram Reels videos in seconds.",
"description": "The total watch time of Instagram Reels videos in milliseconds.",
"type": ["null", "number"]
},
"impressions": {
Expand Down Expand Up @@ -56,6 +56,22 @@
"plays": {
"description": "The number of times the media has been played.",
"type": ["null", "integer"]
},
"ig_reels_aggregated_all_plays_count": {
"description": "The number of times of Instagram Reels gets reproduced after an impression is counted.",
"type": ["null", "integer"]
},
"clips_replays_count": {
"description": "The number of times the reel gets reproduced again.",
"type": ["null", "integer"]
},
"follows": {
"description": "The number of accounts that started to follow the profile.",
"type": ["null", "integer"]
},
"profile_visits": {
"description": "The number of times the profile has been visited.",
"type": ["null", "integer"]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@
"replies": {
"description": "The number of replies or interactions generated by the story.",
"type": ["null", "integer"]
},
"follows": {
"description": "The number of accounts that started to follow the account.",
"type": ["null", "integer"]
},
"profile_visits": {
"description": "The number of times the profile was visited.",
"type": ["null", "integer"]
},
"shares": {
"description": "The number of times the story has been shared.",
"type": ["null", "integer"]
},
"total_interactions": {
"description": "The number of replies and shares of the story.",
"type": ["null", "integer"]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
_STREAM_NAME = "media_insights"



MEDIA_ID_REELS = "84386203808767123"
MEDIA_ID_VIDEO_FEED = "90014330517797123"
MEDIA_ID_VIDEO = "09894619573775123"
Expand All @@ -72,13 +71,14 @@
GENERAL_MEDIA: MEDIA_ID_GENERAL_MEDIA
}

METRICS_GENERAL_MEDIA = ["impressions", "reach", "saved", "video_views", "likes", "comments", "shares"]
METRICS_GENERAL_MEDIA = ["impressions", "reach", "saved", "video_views", "likes", "comments", "shares", "follows", "profile_visits"]

_METRICS = {
MEDIA_ID_REELS: ["comments", "ig_reels_avg_watch_time", "ig_reels_video_view_total_time", "likes", "plays", "reach", "saved", "shares"],
MEDIA_ID_REELS: ["comments", "ig_reels_avg_watch_time", "ig_reels_video_view_total_time", "likes", "plays", "reach", "saved", "shares",
"ig_reels_aggregated_all_plays_count", "clips_replays_count"],
MEDIA_ID_VIDEO_FEED: ["impressions", "reach", "saved", "video_views"],
MEDIA_ID_VIDEO: ["impressions", "reach", "saved", "video_views", "likes", "comments", "shares"],
MEDIA_ID_CAROUSEL_ALBUM: ["impressions", "reach", "saved", "video_views"],
MEDIA_ID_VIDEO: ["impressions", "reach", "saved", "video_views", "likes", "comments", "shares", "follows", "profile_visits"],
MEDIA_ID_CAROUSEL_ALBUM: ["impressions", "reach", "saved", "video_views", "shares", "follows", "profile_visits"],
MEDIA_ID_GENERAL_MEDIA: METRICS_GENERAL_MEDIA,
# Reusing general media metrics for error scenarios
MEDIA_ID_ERROR_POSTED_BEFORE_BUSINESS: METRICS_GENERAL_MEDIA,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
HAPPY_PATH = 'story_insights_happy_path'
ERROR_10 = 'story_insights_error_code_10'

_METRICS = ["impressions", "reach", "replies"]
_METRICS = ["impressions", "reach", "replies", "follows", "profile_visits", "shares", "total_interactions"]



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,42 @@
"title": "Video Views",
"description": "The number of times videos in your carousel album were viewed.",
"id": "66123508374641123/insights/video_views/lifetime"
},
{
"name": "shares",
"period": "lifetime",
"values": [
{
"value": 3
}
],
"title": "Shares title",
"description": "Shares description.",
"id": "66123508374641123/insights/shares/lifetime"
},
{
"name": "follows",
"period": "lifetime",
"values": [
{
"value": 53
}
],
"title": "Follows title",
"description": "Follows description.",
"id": "66123508374641123/insights/follows/lifetime"
},
{
"name": "profile_visits",
"period": "lifetime",
"values": [
{
"value": 9
}
],
"title": "Profile visits title",
"description": "Profile visits description.",
"id": "66123508374641123/insights/profile_visits/lifetime"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,30 @@
"title": "Shares",
"description": "The number of shares of your media.",
"id": "35076616084176123/insights/shares/lifetime"
},
{
"name": "follows",
"period": "lifetime",
"values": [
{
"value": 53
}
],
"title": "Follows title",
"description": "Follows description.",
"id": "35076616084176123/insights/follows/lifetime"
},
{
"name": "profile_visits",
"period": "lifetime",
"values": [
{
"value": 9
}
],
"title": "Profile visits title",
"description": "Profile visits description.",
"id": "35076616084176123/insights/profile_visits/lifetime"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,30 @@
"title": "Shares",
"description": "The number of shares of your reel.",
"id": "84386203808767123/insights/shares/lifetime"
},
{
"name": "ig_reels_aggregated_all_plays_count",
"period": "lifetime",
"values": [
{
"value": 383
}
],
"title": "IG reels aggregated all plays count title",
"description": "IG reels aggregated all plays count description.",
"id": "84386203808767123/insights/ig_reels_aggregated_all_plays_count/lifetime"
},
{
"name": "clips_replays_count",
"period": "lifetime",
"values": [
{
"value": 102
}
],
"title": "Clip Replays Count title",
"description": "Clip Replays Count description.",
"id": "84386203808767123/insights/clips_replays_count/lifetime"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,30 @@
"title": "Shares",
"description": "The number of shares of your video.",
"id": "09894619573775123/insights/shares/lifetime"
},
{
"name": "follows",
"period": "lifetime",
"values": [
{
"value": 53
}
],
"title": "Follows title",
"description": "Follows description.",
"id": "09894619573775123/insights/follows/lifetime"
},
{
"name": "profile_visits",
"period": "lifetime",
"values": [
{
"value": 9
}
],
"title": "Profile visits title",
"description": "Profile visits description.",
"id": "09894619573775123/insights/profile_visits/lifetime"
}
]
}
Loading
Loading