feat: Add Instagram Channel (#2955)

This commit is contained in:
Tejaswini Chile
2021-10-05 14:35:32 +05:30
committed by GitHub
parent 30244f79a6
commit 40d0b2faf3
30 changed files with 825 additions and 50 deletions

View File

@@ -0,0 +1,10 @@
# frozen_string_literal: true
FactoryBot.define do
factory :channel_instagram_fb_page, class: 'Channel::FacebookPage' do
page_access_token { SecureRandom.uuid }
user_access_token { SecureRandom.uuid }
page_id { SecureRandom.uuid }
account
end
end

View File

@@ -0,0 +1,58 @@
FactoryBot.define do
factory :instagram_message_create_event, class: Hash do
entry do
[
{
'id': 'instagram-message-id-123',
'time': '2021-09-08T06:34:04+0000',
'messaging': [
{
'sender': {
'id': 'Sender-id-1'
},
'recipient': {
'id': 'chatwoot-app-user-id-1'
},
'timestamp': '2021-09-08T06:34:04+0000',
'message': {
'mid': 'message-id-1',
'text': 'This is the first message from the customer'
}
}
]
}
]
end
initialize_with { attributes }
end
factory :instagram_test_text_event, class: Hash do
entry do
[
{
'id': 'instagram-message-id-123',
'time': '2021-09-08T06:34:04+0000',
'changes': [
{
'field': 'messages',
'value': {
'event_type': 'TEXT',
'event_timestamp': '1527459824',
'event_data': {
'message_id': 'vcvacopiufqwehfawdnb',
'sender': {
'username': 'sender_username'
},
'recipient': {
'thread_id': 'faeoqiehrkbfadsfawd'
}
}
}
}
]
}
]
end
initialize_with { attributes }
end
end

View File

@@ -0,0 +1,31 @@
# frozen_string_literal: true
FactoryBot.define do
factory :incoming_ig_text_message, class: Hash do
messaging do
[
{
'id': 'instagram-message-id-123',
'time': '2021-09-08T06:34:04+0000',
'messaging': [
{
'sender': {
'id': 'Sender-id-1'
},
'recipient': {
'id': 'chatwoot-app-user-id-1'
},
'timestamp': '2021-09-08T06:34:04+0000',
'message': {
'mid': 'message-id-1',
'text': 'This is the first message from the customer'
}
}
]
}
]
end
initialize_with { attributes }
end
end