feat: Add webhook event support for macros (#11235)

Fixes https://github.com/chatwoot/chatwoot/issues/5968

We will not support custom payload in V1.
This commit is contained in:
Pranav
2025-04-02 20:26:55 -07:00
committed by GitHub
parent c35edc9c49
commit 8bf2081aff
6 changed files with 24 additions and 4 deletions

View File

@@ -18,7 +18,8 @@ RSpec.describe Macros::ExecutionService, type: :service do
{ action_name: 'assign_agent', action_params: ['self'] },
{ action_name: 'add_private_note', action_params: ['Test note'] },
{ action_name: 'send_message', action_params: ['Test message'] },
{ action_name: 'send_attachment', action_params: [1, 2] }
{ action_name: 'send_attachment', action_params: [1, 2] },
{ action_name: 'send_webhook_event', action_params: ['https://example.com/webhook'] }
])
end
@@ -147,4 +148,11 @@ RSpec.describe Macros::ExecutionService, type: :service do
end
end
end
describe '#send_webhook_event' do
it 'sends a webhook event' do
expect(WebhookJob).to receive(:perform_later)
service.send(:send_webhook_event, ['https://example.com/webhook'])
end
end
end