BZ-4797: feat: template level service callback url for inbound and outbound calls - #919
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughChangesReporting webhook configuration
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Template
participant IVRSelection
participant LeadTrackerAccessor
participant DatabaseQuery
Template->>IVRSelection: resolve configurations.reporting_webhook_url
IVRSelection->>LeadTrackerAccessor: update existing lead with webhook URL
LeadTrackerAccessor->>DatabaseQuery: update lead template
DatabaseQuery->>DatabaseQuery: merge webhook URL into payload JSON
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds support for configuring a reporting_webhook_url at the template level so call-summary reporting can be applied automatically to outbound and inbound calls, with template configuration taking precedence over per-request values.
Changes:
- Introduces
reporting_webhook_urlon the templateConfigurationModeland documents it in the field reference. - For outbound lead pushes, resolves the effective webhook URL by preferring
template.configurations.reporting_webhook_urlover the request field. - For inbound leads, injects the template webhook URL into the lead payload at answer-time, and threads webhook updates into the lead-template update query.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| app/database/queries/breeze_buddy/lead_call_tracker.py | Extends update_lead_template_query to optionally merge reporting_webhook_url into the lead payload via SQL. |
| app/database/accessor/breeze_buddy/lead_call_tracker.py | Threads optional reporting_webhook_url through update_lead_template(...) into the query layer. |
| app/api/routers/breeze_buddy/telephony/answer/handlers.py | Injects template webhook URL into inbound lead payload at lead creation time. |
| app/api/routers/breeze_buddy/leads/handlers.py | Resolves outbound reporting webhook with template-level priority over request-level value. |
| app/ai/voice/agents/breeze_buddy/template/types.py | Adds reporting_webhook_url to template configuration model. |
| app/ai/voice/agents/breeze_buddy/template/field_reference.json | Documents the new reporting_webhook_url template configuration field. |
| app/ai/voice/agents/breeze_buddy/ivr/selection.py | Passes selected template’s webhook URL into update_lead_template (currently only in a specific IVR blocked path). |
74e1ec4 to
16216d1
Compare
16216d1 to
9e49ad3
Compare
9e49ad3 to
ea5185c
Compare
ea5185c to
d132402
Compare
d132402 to
e3248be
Compare
|
In |
e3248be to
ab5015d
Compare
ab5015d to
d28d017
Compare
|
Reviewed at Per-request
reseller_id: str
merchant_id: Optional[str] = None
- reporting_webhook_url: str | None = None
execution_mode: Optional[ExecutionMode] = (( and - # Prepare payload with reporting webhook URL
lead_payload = {**req.payload}
- if req.reporting_webhook_url:
- lead_payload["reporting_webhook_url"] = req.reporting_webhook_url(
That contradicts the PR description's own stated design ("template-level webhook takes priority over the per-request webhook URL; request value is retained as a deprecated fallback") — there's no fallback path left in the code. Since this powers call-summary webhooks for existing merchant integrations, this reads as a silent breaking change for any caller that hasn't migrated to template-level Worth either implementing the fallback the description promises, or explicitly confirming no production caller still relies on the per-request field before this merges. |
4ccc705 to
a47110e
Compare
- Add `configurations.service_callback` with `url` and `max_attempts` - Send completion, pre-check-failure, and no-answer callbacks from the active template - Remove lead-level `reporting_webhook_url` from lead push and callback resolution - Add regression coverage and update callback documentation
a47110e to
6d38243
Compare
Ticket
https://plane.breezehq.dev/breeze/browse/BZ-4797
Impacted Areas
service_callback(url,max_attempts) directly on the template'sconfigurationsservice_callback.urlreporting_webhook_urlfield has been removed fromPushLeadRequest; it is silently ignored if a caller still sends itWhat is done?
Added
service_callback: Optional[ServiceCallbackConfig](url,max_attempts) on the template'sconfigurationsintemplate/types.py.callbacks/service_callback.pyresolves the webhook purely fromcontext.configurations.service_callbackat send-time for completion, pre-check-failure, and no-answer callbacks — for both inbound and outbound calls. The per-requestreporting_webhook_urlfield has been removed fromPushLeadRequest(types/models.py) andpush_lead_handlerno longer reads or forwards it.Why is it done?
Previously,
reporting_webhook_urlhad to be passed explicitly on every outbound lead push request, and there was no equivalent mechanism for inbound calls (no API caller exists at call time). Merchants now configure the callback once on the template and it applies uniformly to all calls, inbound and outbound, removing the need for a per-call/per-request value entirely.How to test it?
configurations.service_callback.url(e.g. a webhook.site URL)service_callback.urlafter the call endsservice_callback.urlservice_callback.urlreceives the call summaryreporting_webhook_urlin the request body has no effect (field is ignored, no error)Priority
high
Environment Variables
No new environment variables.
Dev Proof