fix: Send push notification on bot_handoff (#7636)

Send a 'Conversation Created' push notification when the bot does a hand_off.
fixes: #7587

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
Jatin
2024-02-08 00:15:08 +10:30
committed by GitHub
parent 1b21e0d429
commit 98eddd0532
2 changed files with 50 additions and 0 deletions

View File

@@ -1,4 +1,18 @@
class NotificationListener < BaseListener
def conversation_bot_handoff(event)
conversation, account = extract_conversation_and_account(event)
return if conversation.pending?
conversation.inbox.members.each do |agent|
NotificationBuilder.new(
notification_type: 'conversation_creation',
user: agent,
account: account,
primary_actor: conversation
).perform
end
end
def conversation_created(event)
conversation, account = extract_conversation_and_account(event)
return if conversation.pending?