#345 — Facade API to send notifications per-tenant

Repo: Twill-AI/facade State: closed | Status: done Assignee: Unassigned

Created: 2025-05-09 · Updated: 2025-09-15

Description

Request

Caused by https://github.com/Twill-AI/business-data/issues/138

We would have Canonical (aka Twill) customers persisted per tenant, not per integration. But current “bdstate” API works only per-integration.

Acceptance criteria

  • Facade has new POST /api/v1/master/bdstate/tenants/{tenant_id} API to notify about per-tenant events. First use case - notify per customer, i.e. need to support “customer_update” notification types in API and send websocket messages with link of “customer” type.
  • https://twillpayments.atlassian.net/wiki/spaces/TD/pages/7929859/Facade+API is updated.
  • Relevant UI task to support is created if needed.
  • Logic above is covered with unit tests.

Implementation details.

Also updated https://twillpayments.atlassian.net/wiki/spaces/TD/pages/101941259/Inter-services+API-s

During implementation have found that make migrations-master-generate command started to fail on changes introduced in https://github.com/Twill-AI/facade/commit/4163f2302f7b53e78daf68c14cf2f43fb14e8dd0

$ make migrations-master-generate 
PICCOLO_CONF=app.db.piccolo_conf piccolo migrations new app.piccolo_app.master --auto --trace

                     APP.PICCOLO_APP.MASTER                     
----------------------------------------------------------------
🚀 Creating new migration ...
The command failed.
Tenant is not set in the current context.
Traceback (most recent call last):
  ...
  .../facade/app/db/piccolo_migrations/master/apppiccolo

## Notes

_Add implementation notes, blockers, and context here_

## Related

_Add wikilinks to related people, meetings, or other tickets_