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:
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user