chore: Add resolve action in Dialogflow Integration (#3900)
This commit is contained in:
parent
dbb50e5923
commit
8dcb4a5ed4
2 changed files with 16 additions and 0 deletions
|
@ -77,6 +77,8 @@ class Integrations::Dialogflow::ProcessorService
|
||||||
case action
|
case action
|
||||||
when 'handoff'
|
when 'handoff'
|
||||||
message.conversation.open!
|
message.conversation.open!
|
||||||
|
when 'resolve'
|
||||||
|
message.conversation.resolved!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -75,6 +75,20 @@ describe Integrations::Dialogflow::ProcessorService do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when dialogflow returns resolve action' do
|
||||||
|
let(:dialogflow_response) do
|
||||||
|
ActiveSupport::HashWithIndifferentAccess.new(
|
||||||
|
fulfillment_messages: [{ payload: { action: 'resolve' } }, { text: dialogflow_text_double }]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'resolves the conversation without moving it to an agent' do
|
||||||
|
processor.perform
|
||||||
|
expect(conversation.reload.status).to eql('resolved')
|
||||||
|
expect(conversation.messages.last.content).to eql('hello payload')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'when conversation is not bot' do
|
context 'when conversation is not bot' do
|
||||||
let(:conversation) { create(:conversation, account: account, status: :open) }
|
let(:conversation) { create(:conversation, account: account, status: :open) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue