iachat/app/models/channel
Shivam Mishra 95463230cb
feat: sign webhooks for API channel and agentbots (#13892)
Account webhooks sign outgoing payloads with HMAC-SHA256, but agent bot
and API inbox webhooks were delivered unsigned. This PR adds the same
signing to both.

Each model gets a dedicated `secret` column rather than reusing the
agent bot's `access_token` (for API auth back into Chatwoot) or the API
inbox's `hmac_token` (for inbound contact identity verification). These
serve different trust boundaries and shouldn't be coupled — rotating a
signing secret shouldn't invalidate API access or contact verification.

The existing `Webhooks::Trigger` already signs when a secret is present,
so the backend change is just passing `secret:` through to the jobs.
Shared token logic is extracted into a `WebhookSecretable` concern
included by `Webhook`, `AgentBot`, and `Channel::Api`. The frontend
reuses the existing `AccessToken` component for secret display. Secrets
are admin-only and excluded from enterprise audit logs.

### How to test

Point an agent bot or API inbox webhook URL at a request inspector. Send
a message and verify `X-Chatwoot-Signature` and `X-Chatwoot-Timestamp`
headers are present. Reset the secret from settings and confirm
subsequent deliveries use the new value.

---------

Co-authored-by: Sojan Jose <sojan@pepalo.com>
2026-04-06 15:28:25 +05:30
..
api.rb feat: sign webhooks for API channel and agentbots (#13892) 2026-04-06 15:28:25 +05:30
email.rb fix: call authorization_error! on IMAP auth failures (#13560) (revert) (#13671) 2026-02-26 18:45:18 -08:00
facebook_page.rb feat: Secure external credentials with database encryption (#12648) 2025-10-13 18:05:12 +05:30
instagram.rb feat: Secure external credentials with database encryption (#12648) 2025-10-13 18:05:12 +05:30
line.rb fix: Disable SSL verification for LINE webhooks in development (#12960) 2025-11-26 22:38:26 +05:30
sms.rb feat: hide CSAT survey URLs from agents in dashboard (#11622) 2025-06-11 23:39:47 +05:30
telegram.rb feat: Standardize rich editor across all channels (#12600) 2025-12-08 14:43:45 +05:30
tiktok.rb feat: TikTok channel (#12741) 2025-12-17 07:54:50 -08:00
twilio_sms.rb feat: Secure external credentials with database encryption (#12648) 2025-10-13 18:05:12 +05:30
twitter_profile.rb feat: Secure external credentials with database encryption (#12648) 2025-10-13 18:05:12 +05:30
web_widget.rb feat(widget): Allow widget loading in mobile app WebViews when domain restrictions are set (#13763) 2026-03-17 14:29:41 +04:00
whatsapp.rb fix: Setup webhooks for manual WhatsApp Cloud channel creation (#13278) 2026-01-19 14:12:36 +04:00