Skip to content

Commit

Permalink
Add new stream to tap
Browse files Browse the repository at this point in the history
  • Loading branch information
ynaim94-harrys committed Sep 28, 2022
1 parent c27f7b5 commit 132feca
Show file tree
Hide file tree
Showing 7 changed files with 319 additions and 2 deletions.
83 changes: 83 additions & 0 deletions tap_gladly/schemas/export_conversation-customer_activity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"conversationId": {
"type": "string"
},
"content": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"type": {
"type": "string"
},
"title": {
"type": "string"
},
"body": {
"type": "string"
},
"activityType": {
"type": "string"
},
"sourceName": {
"type": "string"
},
"link": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"text": {
"type": "string"
}
}
},
"occurredAt": {
"type": "string"
},
"receivedAt": {
"type": "string"
}
},
"required": [
"activityType",
"type"
]
},
"customerId": {
"type": "string"
},
"initiator": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"type"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"content",
"customerId",
"id",
"timestamp"
]
}
62 changes: 62 additions & 0 deletions tap_gladly/schemas/export_conversation-facebook_message.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"conversationId": {
"type": "string"
},
"content": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"type": {
"type": "string"
},
"pageId": {
"type": "string"
},
"userId": {
"type": "string"
}
},
"required": [
"content",
"pageId",
"userId",
"type"
]
},
"customerId": {
"type": "string"
},
"initiator": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"type"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"content",
"customerId",
"id",
"timestamp"
]
}
54 changes: 54 additions & 0 deletions tap_gladly/schemas/export_conversation-instagram_direct.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"conversationId": {
"type": "string"
},
"content": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"content",
"type"
]
},
"customerId": {
"type": "string"
},
"initiator": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"type"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"content",
"customerId",
"id",
"timestamp"
]
}
54 changes: 54 additions & 0 deletions tap_gladly/schemas/export_conversation-twitter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"conversationId": {
"type": "string"
},
"content": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"content",
"type"
]
},
"customerId": {
"type": "string"
},
"initiator": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"type"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"content",
"customerId",
"id",
"timestamp"
]
}
54 changes: 54 additions & 0 deletions tap_gladly/schemas/export_conversation-whatsapp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"conversationId": {
"type": "string"
},
"content": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"type": {
"type": "string"
}
},
"required": [
"content",
"type"
]
},
"customerId": {
"type": "string"
},
"initiator": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"id": {
"type": "string"
}
},
"required": [
"id",
"type"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"content",
"customerId",
"id",
"timestamp"
]
}
4 changes: 2 additions & 2 deletions tap_gladly/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ExportCompletedJobsStream(gladlyStream):
def post_process(self, row, context):
"""Filter jobs that finished before start_date."""
if pendulum.parse(row["parameters"]["endAt"]) >= pendulum.parse(
self.config["start_date"]
self.config["start_date"]
):
return row
return
Expand Down Expand Up @@ -79,7 +79,7 @@ def schema_filepath(self):
"facebook_message": "export_conversation-facebook_message.json",
"twitter": "export_conversation-twitter.json",
"instagram_direct": "export_conversation-instagram_direct.json",
"whatsapp": "export_conversation-whatsapp.json"
"whatsapp": "export_conversation-whatsapp.json",
}

try:
Expand Down
10 changes: 10 additions & 0 deletions tap_gladly/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@
ExportFileConversationItemsChatMessage,
ExportFileConversationItemsConversationNote,
ExportFileConversationItemsConversationStatusChange,
ExportFileConversationItemsCustomerActivity,
ExportFileConversationItemsFacebookMessage,
ExportFileConversationItemsInstagramDirect,
ExportFileConversationItemsPhoneCall,
ExportFileConversationItemsSms,
ExportFileConversationItemsTopicChange,
ExportFileConversationItemsTwitter,
ExportFileConversationItemsVoiceMail,
ExportFileConversationItemsWhatsapp,
ExportFileTopicsStream,
)

Expand All @@ -28,6 +33,11 @@
ExportFileConversationItemsPhoneCall,
ExportFileConversationItemsVoiceMail,
ExportFileTopicsStream,
ExportFileConversationItemsCustomerActivity,
ExportFileConversationItemsFacebookMessage,
ExportFileConversationItemsTwitter,
ExportFileConversationItemsInstagramDirect,
ExportFileConversationItemsWhatsapp,
]


Expand Down

0 comments on commit 132feca

Please sign in to comment.