From c27f7b55e4569e7861df230c1ad331f30fb08ae2 Mon Sep 17 00:00:00 2001 From: ynaim94-harrys Date: Wed, 28 Sep 2022 13:42:29 -0400 Subject: [PATCH 1/2] Init rest of content classes --- tap_gladly/streams.py | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/tap_gladly/streams.py b/tap_gladly/streams.py index 98fed34..63ba1d1 100644 --- a/tap_gladly/streams.py +++ b/tap_gladly/streams.py @@ -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 @@ -75,6 +75,11 @@ def schema_filepath(self): "conversation_status_change": "export_conversation-conversation_status_change.json", # noqa "phone_call": "export_conversation-phone_call.json", "voicemail": "export_conversation-voicemail.json", + "customer_activity": "export_conversation-customer_activity.json", + "facebook_message": "export_conversation-facebook_message.json", + "twitter": "export_conversation-twitter.json", + "instagram_direct": "export_conversation-instagram_direct.json", + "whatsapp": "export_conversation-whatsapp.json" } try: @@ -148,3 +153,38 @@ class ExportFileConversationItemsVoiceMail(ExportFileConversationItemsStream): name = "conversation_voicemail" content_type = "voicemail" + + +class ExportFileConversationItemsCustomerActivity(ExportFileConversationItemsStream): + """Export conversation items stream where content type is voicemail.""" + + name = "conversation_customer_activity" + content_type = "customer_activity" + + +class ExportFileConversationItemsFacebookMessage(ExportFileConversationItemsStream): + """Export conversation items stream where content type is voicemail.""" + + name = "conversation_facebook_message" + content_type = "facebook_message" + + +class ExportFileConversationItemsTwitter(ExportFileConversationItemsStream): + """Export conversation items stream where content type is voicemail.""" + + name = "conversation_twitter" + content_type = "twitter" + + +class ExportFileConversationItemsInstagramDirect(ExportFileConversationItemsStream): + """Export conversation items stream where content type is voicemail.""" + + name = "conversation_instagram_direct" + content_type = "instagram_direct" + + +class ExportFileConversationItemsWhatsapp(ExportFileConversationItemsStream): + """Export conversation items stream where content type is voicemail.""" + + name = "conversation_whatsapp" + content_type = "whatsapp" From 132feca7a8ea5f20f5759cadef03722cbd8ae3b6 Mon Sep 17 00:00:00 2001 From: ynaim94-harrys Date: Wed, 28 Sep 2022 14:46:09 -0400 Subject: [PATCH 2/2] Add new stream to tap --- ...export_conversation-customer_activity.json | 83 +++++++++++++++++++ .../export_conversation-facebook_message.json | 62 ++++++++++++++ .../export_conversation-instagram_direct.json | 54 ++++++++++++ .../schemas/export_conversation-twitter.json | 54 ++++++++++++ .../schemas/export_conversation-whatsapp.json | 54 ++++++++++++ tap_gladly/streams.py | 4 +- tap_gladly/tap.py | 10 +++ 7 files changed, 319 insertions(+), 2 deletions(-) create mode 100644 tap_gladly/schemas/export_conversation-customer_activity.json create mode 100644 tap_gladly/schemas/export_conversation-facebook_message.json create mode 100644 tap_gladly/schemas/export_conversation-instagram_direct.json create mode 100644 tap_gladly/schemas/export_conversation-twitter.json create mode 100644 tap_gladly/schemas/export_conversation-whatsapp.json diff --git a/tap_gladly/schemas/export_conversation-customer_activity.json b/tap_gladly/schemas/export_conversation-customer_activity.json new file mode 100644 index 0000000..9099274 --- /dev/null +++ b/tap_gladly/schemas/export_conversation-customer_activity.json @@ -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" + ] +} diff --git a/tap_gladly/schemas/export_conversation-facebook_message.json b/tap_gladly/schemas/export_conversation-facebook_message.json new file mode 100644 index 0000000..ef01b12 --- /dev/null +++ b/tap_gladly/schemas/export_conversation-facebook_message.json @@ -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" + ] +} diff --git a/tap_gladly/schemas/export_conversation-instagram_direct.json b/tap_gladly/schemas/export_conversation-instagram_direct.json new file mode 100644 index 0000000..c75baa2 --- /dev/null +++ b/tap_gladly/schemas/export_conversation-instagram_direct.json @@ -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" + ] +} diff --git a/tap_gladly/schemas/export_conversation-twitter.json b/tap_gladly/schemas/export_conversation-twitter.json new file mode 100644 index 0000000..c75baa2 --- /dev/null +++ b/tap_gladly/schemas/export_conversation-twitter.json @@ -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" + ] +} diff --git a/tap_gladly/schemas/export_conversation-whatsapp.json b/tap_gladly/schemas/export_conversation-whatsapp.json new file mode 100644 index 0000000..c75baa2 --- /dev/null +++ b/tap_gladly/schemas/export_conversation-whatsapp.json @@ -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" + ] +} diff --git a/tap_gladly/streams.py b/tap_gladly/streams.py index 63ba1d1..8a57c20 100644 --- a/tap_gladly/streams.py +++ b/tap_gladly/streams.py @@ -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 @@ -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: diff --git a/tap_gladly/tap.py b/tap_gladly/tap.py index 07bfe25..9ef3819 100644 --- a/tap_gladly/tap.py +++ b/tap_gladly/tap.py @@ -11,10 +11,15 @@ ExportFileConversationItemsChatMessage, ExportFileConversationItemsConversationNote, ExportFileConversationItemsConversationStatusChange, + ExportFileConversationItemsCustomerActivity, + ExportFileConversationItemsFacebookMessage, + ExportFileConversationItemsInstagramDirect, ExportFileConversationItemsPhoneCall, ExportFileConversationItemsSms, ExportFileConversationItemsTopicChange, + ExportFileConversationItemsTwitter, ExportFileConversationItemsVoiceMail, + ExportFileConversationItemsWhatsapp, ExportFileTopicsStream, ) @@ -28,6 +33,11 @@ ExportFileConversationItemsPhoneCall, ExportFileConversationItemsVoiceMail, ExportFileTopicsStream, + ExportFileConversationItemsCustomerActivity, + ExportFileConversationItemsFacebookMessage, + ExportFileConversationItemsTwitter, + ExportFileConversationItemsInstagramDirect, + ExportFileConversationItemsWhatsapp, ]