chore: Disable message hooks for conversations without incoming message (#7620)
When using client APIs to create conversations and auto-assignment is turned on, welcome messages were getting triggered. This PR disable the behaviour and ensure template hooks are triggered only if there are incoming messages present. Fixes: https://linear.app/chatwoot/issue/CW-2187
This commit is contained in:
@@ -60,11 +60,7 @@ class Facebook::SendOnFacebookService < Base::SendOnChannelService
|
||||
|
||||
def sent_first_outgoing_message_after_24_hours?
|
||||
# we can send max 1 message after 24 hour window
|
||||
conversation.messages.outgoing.where('id > ?', last_incoming_message.id).count == 1
|
||||
end
|
||||
|
||||
def last_incoming_message
|
||||
conversation.messages.incoming.last
|
||||
conversation.messages.outgoing.where('id > ?', conversation.last_incoming_message.id).count == 1
|
||||
end
|
||||
|
||||
def handle_facebook_error(exception)
|
||||
|
||||
Reference in New Issue
Block a user