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:
Sojan Jose
2023-07-26 20:38:49 +03:00
committed by GitHub
parent 6c1ee4d965
commit 6cbe1ed911
4 changed files with 26 additions and 11 deletions

View File

@@ -3,6 +3,7 @@ class MessageTemplates::HookExecutionService
def perform
return if conversation.campaign.present?
return if conversation.last_incoming_message.blank?
trigger_templates
end