Conversation and inbox webhook payloads now include the account object
(`{ id, name }`) so integrations can reliably identify the account
without depending on nested message data.
## Closes
Closes #11753
Closes #12442
## Why
Message, contact, and contact inbox webhook payloads already expose
`account`. Conversation and inbox webhook payloads were outliers, which
forced webhook consumers to infer account context from nested messages
or other fields that may not always be present.
## What changed
- Adds `account: { id, name }` to conversation webhook payloads.
- Adds webhook-specific inbox payload data with `account: { id, name }`
for inbox created/updated events.
- Keeps non-webhook conversation and inbox push payload behavior
unchanged.
## How to test
- Configure an account webhook for `conversation_created`, trigger a new
conversation, and confirm the webhook payload includes `account.id` and
`account.name`.
- Configure an account webhook for `inbox_created`, create a new inbox,
and confirm the webhook payload includes `account.id` and
`account.name`.
- Configure a webhook agent bot and update a conversation status, then
confirm the bot webhook payload includes the same account object.
---------
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Sojan Jose <sojan@pepalo.com>
40 lines
1.1 KiB
Ruby
40 lines
1.1 KiB
Ruby
class Inbox::EventDataPresenter < SimpleDelegator
|
|
def push_data
|
|
{
|
|
# Conversation thread config
|
|
allow_messages_after_resolved: allow_messages_after_resolved,
|
|
lock_to_single_conversation: lock_to_single_conversation,
|
|
|
|
# Auto Assignment config
|
|
auto_assignment_config: auto_assignment_config,
|
|
enable_auto_assignment: enable_auto_assignment,
|
|
|
|
# Feature flag for message events
|
|
enable_email_collect: enable_email_collect,
|
|
greeting_enabled: greeting_enabled,
|
|
greeting_message: greeting_message,
|
|
csat_survey_enabled: csat_survey_enabled,
|
|
|
|
# Outbound email sender config
|
|
business_name: business_name,
|
|
sender_name_type: sender_name_type,
|
|
|
|
# Business hour config
|
|
timezone: timezone,
|
|
out_of_office_message: out_of_office_message,
|
|
working_hours_enabled: working_hours_enabled,
|
|
working_hours: working_hours.as_json,
|
|
|
|
created_at: created_at,
|
|
updated_at: updated_at,
|
|
|
|
# Associated channel attributes
|
|
channel: channel
|
|
}
|
|
end
|
|
|
|
def webhook_data
|
|
push_data.merge(account: account.webhook_data)
|
|
end
|
|
end
|