Event-driven APIs for the Gemba Finance platform. This specification documents all Kafka-based event streams and message channels used across Gemba services.
Testing environment Kafka cluster
Environment name used in topic naming (e.g., testing-notifications)
Production Kafka cluster
Environment name used in topic naming (e.g., production-notifications)
Channel for notification commands to be processed by the notifications service. Messages are consumed by the notifications service and sent via Courier.
Topic format: {environment}-notifications Examples:
Publish notification command
Published when a service needs to send a notification (email, SMS, push)
Available only on servers:
Accepts one of the following messages:
Command to send notification to a client
Example macrobank outgoing payment notification
{
"type": "CLIENT_NOTIFICATION",
"payload": {
"to": {
"clientId": "bd73b0c9-5816-da4f-27e5-a9bd2736f41c",
"userId": "4cdd598a-bc3f-64e7-1029-0bc4ef85a71d"
},
"template": "OUTGOING_PAYMENT_SENT",
"data": {
"clientName": "John Doe",
"amountWithCurrency": "1,234.56 GBP",
"beneficiaryName": "ACME Corporation Ltd"
}
}
}
Command to send notification to an applicant (pre-client)
{
"type": "APPLICANT_NOTIFICATION",
"notificationId": "2d591c23-85b1-4e8c-a6bd-74d89f8955c5",
"correlationId": "string",
"payload": {
"to": {
"email": "user@example.com"
},
"template": "REMINDER_TO_COMPLETE_ONBOARDING",
"data": {},
"whiteLabel": {
"domain": "string"
}
}
}
Command to send internal notifications (admin, support, etc.)
{
"type": "INTERNAL_NOTIFICATION",
"notificationId": "2d591c23-85b1-4e8c-a6bd-74d89f8955c5",
"correlationId": "string",
"payload": {
"to": {
"staffPerson": "user@example.com",
"channels": [
"email"
]
},
"template": "NEW_APPLICANT_IN_HOLD",
"data": {}
}
}
Channel for notification commands to be processed by the notifications service. Messages are consumed by the notifications service and sent via Courier.
Topic format: {environment}-notifications Examples:
Subscribe to notification commands
Consume notification commands for processing and delivery via Courier
Available only on servers:
Accepts one of the following messages:
Command to send notification to a client
Example macrobank outgoing payment notification
{
"type": "CLIENT_NOTIFICATION",
"payload": {
"to": {
"clientId": "bd73b0c9-5816-da4f-27e5-a9bd2736f41c",
"userId": "4cdd598a-bc3f-64e7-1029-0bc4ef85a71d"
},
"template": "OUTGOING_PAYMENT_SENT",
"data": {
"clientName": "John Doe",
"amountWithCurrency": "1,234.56 GBP",
"beneficiaryName": "ACME Corporation Ltd"
}
}
}
Command to send notification to an applicant (pre-client)
{
"type": "APPLICANT_NOTIFICATION",
"notificationId": "2d591c23-85b1-4e8c-a6bd-74d89f8955c5",
"correlationId": "string",
"payload": {
"to": {
"email": "user@example.com"
},
"template": "REMINDER_TO_COMPLETE_ONBOARDING",
"data": {},
"whiteLabel": {
"domain": "string"
}
}
}
Command to send internal notifications (admin, support, etc.)
{
"type": "INTERNAL_NOTIFICATION",
"notificationId": "2d591c23-85b1-4e8c-a6bd-74d89f8955c5",
"correlationId": "string",
"payload": {
"to": {
"staffPerson": "user@example.com",
"channels": [
"email"
]
},
"template": "NEW_APPLICANT_IN_HOLD",
"data": {}
}
}
Channel for company registry status update to be processed. Messages are published by job-company service when a company's status is updated in the official registry and requires action on Macrobank's site. Topic format: {environment}-company-status Examples:
Update company status
Published when a company's registry status updated and requires action on Macrobanks's site (blocking, freezing).
Available only on servers:
Accepts the following message:
Event published when a company's registry status is updated and requires action
GBR company in liquidation requiring full freeze
{
"clientId": "bd73b0c9-5816-da4f-27e5-a9bd2736f41c",
"companyNumber": "12345678",
"country": "GBR",
"action": "fully_frozen",
"registryStatus": "liquidation",
"registryStatusDetail": "voluntary-liquidation",
"companyName": "Example Ltd",
"timestamp": "2025-11-24T14:30:00Z",
"source": "job-company"
}
GBR company in administration requiring debit blocking
{
"clientId": "4cdd598a-bc3f-64e7-1029-0bc4ef85a71d",
"companyNumber": "87654321",
"country": "GBR",
"action": "blocked_on_debit",
"registryStatus": "administration",
"registryStatusDetail": "voluntary-arrangement",
"companyName": "Another Company Ltd",
"applicantId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2025-11-24T14:35:00Z",
"correlationId": "trace-123-abc",
"source": "job-company"
}
IMN company dissolved requiring blocking
{
"clientId": "7f8d9e0a-1b2c-3d4e-5f6g-7h8i9j0k1l2m",
"companyNumber": "123456C",
"country": "IMN",
"action": "block",
"registryStatus": "dissolved",
"companyName": "Isle of Man Company Ltd",
"timestamp": "2025-11-24T14:40:00Z",
"source": "job-company"
}
Channel for company registry status update to be processed. Messages are published by job-company service when a company's status is updated in the official registry and requires action on Macrobank's site. Topic format: {environment}-company-status Examples:
Subscribe to company status events
Consume company status updates to process blocking actions on Macrobank's site.
Available only on servers:
Accepts the following message:
Event published when a company's registry status is updated and requires action
GBR company in liquidation requiring full freeze
{
"clientId": "bd73b0c9-5816-da4f-27e5-a9bd2736f41c",
"companyNumber": "12345678",
"country": "GBR",
"action": "fully_frozen",
"registryStatus": "liquidation",
"registryStatusDetail": "voluntary-liquidation",
"companyName": "Example Ltd",
"timestamp": "2025-11-24T14:30:00Z",
"source": "job-company"
}
GBR company in administration requiring debit blocking
{
"clientId": "4cdd598a-bc3f-64e7-1029-0bc4ef85a71d",
"companyNumber": "87654321",
"country": "GBR",
"action": "blocked_on_debit",
"registryStatus": "administration",
"registryStatusDetail": "voluntary-arrangement",
"companyName": "Another Company Ltd",
"applicantId": "550e8400-e29b-41d4-a716-446655440000",
"timestamp": "2025-11-24T14:35:00Z",
"correlationId": "trace-123-abc",
"source": "job-company"
}
IMN company dissolved requiring blocking
{
"clientId": "7f8d9e0a-1b2c-3d4e-5f6g-7h8i9j0k1l2m",
"companyNumber": "123456C",
"country": "IMN",
"action": "block",
"registryStatus": "dissolved",
"companyName": "Isle of Man Company Ltd",
"timestamp": "2025-11-24T14:40:00Z",
"source": "job-company"
}
Channel for Change Data Capture (CDC) events from the Macrobank database.
The CDC service monitors SQL Server change tracking tables and publishes events when transfer statuses change. Events are published for:
Messages contain Base64-encoded JSON payloads with routing metadata in Kafka headers.
Topic format: {environment}-cdc-events Examples:
Publish CDC transfer event
Published by the CDC service when a transfer status changes in the Macrobank database.
The CDC service monitors SQL Server change tracking tables for the following document classes:
When a document's status changes to an API-visible state, the CDC service:
For internal transfers, two events are published:
transfer.outgoing.changed to the sendertransfer.incoming.created to the recipientAvailable only on servers:
Accepts the following message:
Change Data Capture event published when transfer statuses change in Macrobank
CDC events are published when transfer statuses change in the Macrobank database. The CDC service monitors SQL Server change tracking tables and publishes events to Kafka for downstream consumers.
The message consists of:
The type header indicates the event type:
transfer.outgoing.changed - Outgoing transfer status changed (sender perspective)transfer.incoming.created - Incoming transfer created (recipient perspective, internal transfers only)The Base64-decoded payload contains one of:
Consumers should:
type header to determine event typeclientId and accountId headers for routing/filteringBase64-encoded JSON payload containing the transfer details.
When decoded, the payload is a JSON object matching one of:
The specific schema depends on the source document class in the CDC change.
Status change for an outgoing internal transfer
eyJpZCI6IjEyM2U0NTY3LWU4OWItMTJkMy1hNDU2LTQyNjYxNDE3NDAwMCIsInN0YXR1cyI6ImRvbmUiLCJhY2NvdW50SWQiOiIyMzRlNTY3OC1lODliLTEyZDMtYTQ1Ni00MjY2MTQxNzQwMDAiLCJhbW91bnQiOjEwMDAwMCwiZmVlIjo1MDAsInRvdGFsIjoxMDA1MDAsImN1cnJlbmN5Q29kZSI6IkVVUiIsImRlc2NyaXB0aW9uIjoiTW9udGhseSByZW50IHBheW1lbnQiLCJyZWNpcGllbnROYW1lIjoiSm9obiBEb2UiLCJyZWNpcGllbnRBY2NvdW50TnVtYmVyIjoiREU4OTM3MDQwMDQ0MDUzMjAxMzAwMCIsImNyZWF0ZWRBdCI6IjIwMjQtMDktMTZUMTQ6MzI6MDBaIn0=
New incoming internal transfer for recipient
eyJpZCI6IjEyM2U0NTY3LWU4OWItMTJkMy1hNDU2LTQyNjYxNDE3NDAwMCIsInN0YXR1cyI6ImRvbmUiLCJhY2NvdW50SWQiOiIzNDVmNjc4OS1lODliLTEyZDMtYTQ1Ni00MjY2MTQxNzQwMDAiLCJhbW91bnQiOjEwMDAwMCwiZmVlIjo1MDAsInRvdGFsIjoxMDA1MDAsImN1cnJlbmN5Q29kZSI6IkVVUiIsImRlc2NyaXB0aW9uIjoiTW9udGhseSByZW50IHBheW1lbnQiLCJyZWNpcGllbnROYW1lIjoiSm9obiBEb2UiLCJyZWNpcGllbnRBY2NvdW50TnVtYmVyIjoiREU4OTM3MDQwMDQ0MDUzMjAxMzAwMCIsImNyZWF0ZWRBdCI6IjIwMjQtMDktMTZUMTQ6MzI6MDBaIn0=
Status change for an outgoing international transfer
eyJpZCI6IjQ1NmE3ODkwLWU4OWItMTJkMy1hNDU2LTQyNjYxNDE3NDAwMCIsInN0YXR1cyI6Imlucm9ncmVzcyIsImFjY291bnRJZCI6IjQ1NmE3ODkwLWU4OWItMTJkMy1hNDU2LTQyNjYxNDE3NDAwMCIsImFtb3VudCI6NTAwMDAwLCJmZWUiOjI1MDAsInRvdGFsIjo1MDI1MDAsImN1cnJlbmN5Q29kZSI6IlVTRCIsImRlc2NyaXB0aW9uIjoiSW52b2ljZSBwYXltZW50IiwicmVjaXBpZW50TmFtZSI6IkFjbWUgQ29ycCIsInJlY2lwaWVudEFjY291bnROdW1iZXIiOiJVUzEyMzQ1Njc4OTAiLCJyZWNpcGllbnRBY2NvdW50VHlwZSI6ImNvbXBhbnkiLCJyZWNpcGllbnRBZGRyZXNzIjoiMTIzIE1haW4gU3QsIE5ldyBZb3JrIiwicmVjaXBpZW50Q291bnRyeSI6IlVTIiwicmVjaXBpZW50UmVnaXN0cmF0aW9uTnVtYmVyIjoiVVMxMjM0NTY3ODkiLCJjaGFyZ2VzVHlwZSI6InNoYXJlZCIsImJhbmtOYW1lIjoiQmFuayBvZiBBbWVyaWNhIiwiYmFua0FkZHJlc3MiOiIxMDAgTiBUcnlvbiBTdCIsImJhbmtDb3VudHJ5IjoiVVMiLCJiYW5rQklDIjoiQk9GQVVTMk4iLCJjcmVhdGVkQXQiOiIyMDI0LTA5LTE2VDE0OjMyOjAwWiJ9
Status change for an outgoing UK transfer
eyJpZCI6IjU2N2I4OTAxLWU4OWItMTJkMy1hNDU2LTQyNjYxNDE3NDAwMCIsInN0YXR1cyI6ImRvbmUiLCJhY2NvdW50SWQiOiI1NjdiODkwMS1lODliLTEyZDMtYTQ1Ni00MjY2MTQxNzQwMDAiLCJhbW91bnQiOjEwMDAwMCwiZmVlIjo1MCwidG90YWwiOjEwMDA1MCwiY3VycmVuY3lDb2RlIjoiR0JQIiwiZGVzY3JpcHRpb24iOiJNb250aGx5IHJlbnQiLCJyZWNpcGllbnROYW1lIjoiSmFuZSBTbWl0aCIsInJlY2lwaWVudEFjY291bnROdW1iZXIiOiIxMjM0NTY3OCIsInJlY2lwaWVudEFjY291bnRUeXBlIjoiaW5kaXZpZHVhbCIsInR5cGUiOiJmYXN0ZXJfcGF5bWVudHMiLCJzb3J0Q29kZSI6IjEyMzQ1NiIsImJhbmtOYW1lIjoiQmFyY2xheXMgQmFuayIsImJhbmtBZGRyZXNzIjoiMSBDaHVyY2hpbGwgUGxhY2UsIExvbmRvbiIsImNyZWF0ZWRBdCI6IjIwMjQtMDktMTZUMTQ6MzI6MDBaIn0=
Status change for an outgoing internal transfer
{
"clientId": "bd73b0c9-5816-da4f-27e5-a9bd2736f41c",
"accountId": "234e5678-e89b-12d3-a456-426614174000",
"type": "transfer.outgoing.changed"
}
New incoming internal transfer for recipient
{
"clientId": "4cdd598a-bc3f-64e7-1029-0bc4ef85a71d",
"accountId": "345f6789-e89b-12d3-a456-426614174000",
"type": "transfer.incoming.created"
}
Status change for an outgoing international transfer
{
"clientId": "7f8d9e0a-1b2c-3d4e-5f6a-7b8c9d0e1f2a",
"accountId": "456a7890-e89b-12d3-a456-426614174000",
"type": "transfer.outgoing.changed"
}
Status change for an outgoing UK transfer
{
"clientId": "8a9b0c1d-2e3f-4a5b-6c7d-8e9f0a1b2c3d",
"accountId": "567b8901-e89b-12d3-a456-426614174000",
"type": "transfer.outgoing.changed"
}
Channel for Change Data Capture (CDC) events from the Macrobank database.
The CDC service monitors SQL Server change tracking tables and publishes events when transfer statuses change. Events are published for:
Messages contain Base64-encoded JSON payloads with routing metadata in Kafka headers.
Topic format: {environment}-cdc-events Examples:
Subscribe to CDC transfer events
Consume CDC events to react to transfer status changes.
id for deduplication.type are ordered within a partition. Different event types may arrive out of order.clientId, accountId, or type.Available only on servers:
Accepts the following message:
Change Data Capture event published when transfer statuses change in Macrobank
CDC events are published when transfer statuses change in the Macrobank database. The CDC service monitors SQL Server change tracking tables and publishes events to Kafka for downstream consumers.
The message consists of:
The type header indicates the event type:
transfer.outgoing.changed - Outgoing transfer status changed (sender perspective)transfer.incoming.created - Incoming transfer created (recipient perspective, internal transfers only)The Base64-decoded payload contains one of:
Consumers should:
type header to determine event typeclientId and accountId headers for routing/filteringBase64-encoded JSON payload containing the transfer details.
When decoded, the payload is a JSON object matching one of:
The specific schema depends on the source document class in the CDC change.
Status change for an outgoing internal transfer
eyJpZCI6IjEyM2U0NTY3LWU4OWItMTJkMy1hNDU2LTQyNjYxNDE3NDAwMCIsInN0YXR1cyI6ImRvbmUiLCJhY2NvdW50SWQiOiIyMzRlNTY3OC1lODliLTEyZDMtYTQ1Ni00MjY2MTQxNzQwMDAiLCJhbW91bnQiOjEwMDAwMCwiZmVlIjo1MDAsInRvdGFsIjoxMDA1MDAsImN1cnJlbmN5Q29kZSI6IkVVUiIsImRlc2NyaXB0aW9uIjoiTW9udGhseSByZW50IHBheW1lbnQiLCJyZWNpcGllbnROYW1lIjoiSm9obiBEb2UiLCJyZWNpcGllbnRBY2NvdW50TnVtYmVyIjoiREU4OTM3MDQwMDQ0MDUzMjAxMzAwMCIsImNyZWF0ZWRBdCI6IjIwMjQtMDktMTZUMTQ6MzI6MDBaIn0=
New incoming internal transfer for recipient
eyJpZCI6IjEyM2U0NTY3LWU4OWItMTJkMy1hNDU2LTQyNjYxNDE3NDAwMCIsInN0YXR1cyI6ImRvbmUiLCJhY2NvdW50SWQiOiIzNDVmNjc4OS1lODliLTEyZDMtYTQ1Ni00MjY2MTQxNzQwMDAiLCJhbW91bnQiOjEwMDAwMCwiZmVlIjo1MDAsInRvdGFsIjoxMDA1MDAsImN1cnJlbmN5Q29kZSI6IkVVUiIsImRlc2NyaXB0aW9uIjoiTW9udGhseSByZW50IHBheW1lbnQiLCJyZWNpcGllbnROYW1lIjoiSm9obiBEb2UiLCJyZWNpcGllbnRBY2NvdW50TnVtYmVyIjoiREU4OTM3MDQwMDQ0MDUzMjAxMzAwMCIsImNyZWF0ZWRBdCI6IjIwMjQtMDktMTZUMTQ6MzI6MDBaIn0=
Status change for an outgoing international transfer
eyJpZCI6IjQ1NmE3ODkwLWU4OWItMTJkMy1hNDU2LTQyNjYxNDE3NDAwMCIsInN0YXR1cyI6Imlucm9ncmVzcyIsImFjY291bnRJZCI6IjQ1NmE3ODkwLWU4OWItMTJkMy1hNDU2LTQyNjYxNDE3NDAwMCIsImFtb3VudCI6NTAwMDAwLCJmZWUiOjI1MDAsInRvdGFsIjo1MDI1MDAsImN1cnJlbmN5Q29kZSI6IlVTRCIsImRlc2NyaXB0aW9uIjoiSW52b2ljZSBwYXltZW50IiwicmVjaXBpZW50TmFtZSI6IkFjbWUgQ29ycCIsInJlY2lwaWVudEFjY291bnROdW1iZXIiOiJVUzEyMzQ1Njc4OTAiLCJyZWNpcGllbnRBY2NvdW50VHlwZSI6ImNvbXBhbnkiLCJyZWNpcGllbnRBZGRyZXNzIjoiMTIzIE1haW4gU3QsIE5ldyBZb3JrIiwicmVjaXBpZW50Q291bnRyeSI6IlVTIiwicmVjaXBpZW50UmVnaXN0cmF0aW9uTnVtYmVyIjoiVVMxMjM0NTY3ODkiLCJjaGFyZ2VzVHlwZSI6InNoYXJlZCIsImJhbmtOYW1lIjoiQmFuayBvZiBBbWVyaWNhIiwiYmFua0FkZHJlc3MiOiIxMDAgTiBUcnlvbiBTdCIsImJhbmtDb3VudHJ5IjoiVVMiLCJiYW5rQklDIjoiQk9GQVVTMk4iLCJjcmVhdGVkQXQiOiIyMDI0LTA5LTE2VDE0OjMyOjAwWiJ9
Status change for an outgoing UK transfer
eyJpZCI6IjU2N2I4OTAxLWU4OWItMTJkMy1hNDU2LTQyNjYxNDE3NDAwMCIsInN0YXR1cyI6ImRvbmUiLCJhY2NvdW50SWQiOiI1NjdiODkwMS1lODliLTEyZDMtYTQ1Ni00MjY2MTQxNzQwMDAiLCJhbW91bnQiOjEwMDAwMCwiZmVlIjo1MCwidG90YWwiOjEwMDA1MCwiY3VycmVuY3lDb2RlIjoiR0JQIiwiZGVzY3JpcHRpb24iOiJNb250aGx5IHJlbnQiLCJyZWNpcGllbnROYW1lIjoiSmFuZSBTbWl0aCIsInJlY2lwaWVudEFjY291bnROdW1iZXIiOiIxMjM0NTY3OCIsInJlY2lwaWVudEFjY291bnRUeXBlIjoiaW5kaXZpZHVhbCIsInR5cGUiOiJmYXN0ZXJfcGF5bWVudHMiLCJzb3J0Q29kZSI6IjEyMzQ1NiIsImJhbmtOYW1lIjoiQmFyY2xheXMgQmFuayIsImJhbmtBZGRyZXNzIjoiMSBDaHVyY2hpbGwgUGxhY2UsIExvbmRvbiIsImNyZWF0ZWRBdCI6IjIwMjQtMDktMTZUMTQ6MzI6MDBaIn0=
Status change for an outgoing internal transfer
{
"clientId": "bd73b0c9-5816-da4f-27e5-a9bd2736f41c",
"accountId": "234e5678-e89b-12d3-a456-426614174000",
"type": "transfer.outgoing.changed"
}
New incoming internal transfer for recipient
{
"clientId": "4cdd598a-bc3f-64e7-1029-0bc4ef85a71d",
"accountId": "345f6789-e89b-12d3-a456-426614174000",
"type": "transfer.incoming.created"
}
Status change for an outgoing international transfer
{
"clientId": "7f8d9e0a-1b2c-3d4e-5f6a-7b8c9d0e1f2a",
"accountId": "456a7890-e89b-12d3-a456-426614174000",
"type": "transfer.outgoing.changed"
}
Status change for an outgoing UK transfer
{
"clientId": "8a9b0c1d-2e3f-4a5b-6c7d-8e9f0a1b2c3d",
"accountId": "567b8901-e89b-12d3-a456-426614174000",
"type": "transfer.outgoing.changed"
}
Channel for user identity events published by the Identity Service.
The Identity Service publishes user events after processing WorkOS webhooks. These events are consumed by Macrobank to create/update remote_user records.
Events include the gemba_services_user_id as the external ID for Macrobank.
Topic format: {environment}-identity-commands Examples:
Event Ordering:
All user-related events (user.created, user.updated, user.deleted, user.suspended) are published to a single topic
to maintain ordering guarantees. Events are partitioned by gemba_services_user_id to
ensure all events for the same user are processed in order.
Partition key: gemba_services_user_id to ensure ordered processing per user.
Publish user.created event
Published by Identity Service when a WorkOS user is created. The event is triggered by a WorkOS webhook and includes the generated gemba_services_user_id for Macrobank consumption.
Available only on servers:
Accepts the following message:
Event published when a new user is created in WorkOS
Published by the Identity Service when a WorkOS user is created.
This event is triggered by a WorkOS user.created webhook. The Identity Service:
gemba_services_user_id (UUID)Macrobank consumes this event to create the corresponding remote_user record
using gemba_services_user_id as the external_id.
When creating the remote_user record, Macrobank should map the following fields:
email → remote_user.email (or remote_user.CliLogin if email not available)first_name → DocDataRemoteAccount.Name (maps to remote_user.FirstName)last_name → DocDataRemoteAccount.Surname (maps to remote_user.LastName)The macrobank_client_id field in the event payload contains the Macrobank client UUID.
This is the recommended way to determine which Macrobank client the user belongs to.
Alternative methods (if macrobank_client_id is not available):
Via WorkOS Organization:
workos_org_id from the eventmacrobank-client-id custom attributeVia Macrobank remote_user (After Creation):
remote_user with external_id = gemba_services_user_idremote_users table by external_idremote_user.client_id (INT) which links to Macrobank clients tableNote: The Identity Service looks up macrobank_client_id from the organization_mappings table
using workos_org_id. This mapping is established when Identity Service provisions WorkOS
organizations from Macrobank client.created events.
Example user.created event
{
"source": "identity-service",
"event_type": "user.created",
"gemba_services_user_id": "550e8400-e29b-41d4-a716-446655440000",
"workos_user_id": "user_01HZJXKQ8N7X9Y2Z3A4B5C6D7",
"workos_org_id": "org_01HZJXKQ8N7X9Y2Z3A4B5C6D7",
"macrobank_client_id": "bd73b0c9-5816-da4f-27e5-a9bd2736f41c",
"profile_data": {
"email": "user@example.com",
"first_name": "John",
"last_name": "Doe",
"created_via": "workos_webhook"
},
"timestamp": "2024-01-15T10:30:00Z"
}
Channel for user identity events published by the Identity Service.
The Identity Service publishes user events after processing WorkOS webhooks. These events are consumed by Macrobank to create/update remote_user records.
Events include the gemba_services_user_id as the external ID for Macrobank.
Topic format: {environment}-identity-commands Examples:
Event Ordering:
All user-related events (user.created, user.updated, user.deleted, user.suspended) are published to a single topic
to maintain ordering guarantees. Events are partitioned by gemba_services_user_id to
ensure all events for the same user are processed in order.
Partition key: gemba_services_user_id to ensure ordered processing per user.
Publish user.updated event
Published by Identity Service when a WorkOS user is updated. The event is triggered by a WorkOS webhook and includes updated profile data for Macrobank consumption.
Available only on servers:
Accepts the following message:
Event published when a user is updated in WorkOS
Published by the Identity Service when a WorkOS user is updated.
This event is triggered by a WorkOS user.updated webhook. The Identity Service:
gemba_services_user_id mappingMacrobank consumes this event to update the corresponding remote_user record.
Users can update their profile information in WorkOS, including:
email - Email addressfirst_name - First namelast_name - Last nameWhen Macrobank receives a user.updated event:
Email Updates:
remote_user.email (or remote_user.CliLogin if email is not available)Name Updates:
DocDataRemoteAccount.Name with first_name (maps to remote_user.FirstName)DocDataRemoteAccount.Surname with last_name (maps to remote_user.LastName)Compliance Considerations:
The macrobank_client_id field in the event payload contains the Macrobank client UUID.
This is the recommended way to determine which Macrobank client the user belongs to.
Alternative methods (if macrobank_client_id is not available):
Via WorkOS Organization:
workos_org_id from the eventmacrobank-client-id custom attributeVia Macrobank remote_user:
remote_users by external_id = gemba_services_user_idremote_user.client_id (INT) which links to Macrobank clients tableExample user.updated event
{
"source": "identity-service",
"event_type": "user.updated",
"gemba_services_user_id": "550e8400-e29b-41d4-a716-446655440000",
"workos_user_id": "user_01HZJXKQ8N7X9Y2Z3A4B5C6D7",
"workos_org_id": "org_01HZJXKQ8N7X9Y2Z3A4B5C6D7",
"macrobank_client_id": "bd73b0c9-5816-da4f-27e5-a9bd2736f41c",
"profile_data": {
"email": "user.updated@example.com",
"first_name": "Jane",
"last_name": "Smith",
"updated_via": "workos_webhook"
},
"timestamp": "2024-01-15T11:45:00Z"
}
Channel for user identity events published by the Identity Service.
The Identity Service publishes user events after processing WorkOS webhooks. These events are consumed by Macrobank to create/update remote_user records.
Events include the gemba_services_user_id as the external ID for Macrobank.
Topic format: {environment}-identity-commands Examples:
Event Ordering:
All user-related events (user.created, user.updated, user.deleted, user.suspended) are published to a single topic
to maintain ordering guarantees. Events are partitioned by gemba_services_user_id to
ensure all events for the same user are processed in order.
Partition key: gemba_services_user_id to ensure ordered processing per user.
Publish user.deleted event
Published by Identity Service when a WorkOS user is deleted. The event is triggered by a WorkOS webhook. Macrobank consumes this event to deactivate or remove the corresponding remote_user record.
Available only on servers:
Accepts the following message:
Event published when a user is deleted in WorkOS
Published by the Identity Service when a WorkOS user is deleted.
This event is triggered by a WorkOS user.deleted webhook. The Identity Service:
gemba_services_user_id mappingMacrobank consumes this event to deactivate or remove the corresponding remote_user record.
Note: The user mapping in user_profile_mappings table is not deleted to maintain
audit trail and historical references. The gemba_services_user_id remains valid for
historical data integrity.
The macrobank_client_id field in the event payload contains the Macrobank client UUID.
This is the recommended way to determine which Macrobank client the user belonged to.
Alternative methods (if macrobank_client_id is not available):
Via WorkOS Organization:
workos_org_id from the eventmacrobank-client-id custom attributeVia Macrobank remote_user:
remote_users by external_id = gemba_services_user_idremote_user.client_id (INT) which links to Macrobank clients tableExample user.deleted event
{
"source": "identity-service",
"event_type": "user.deleted",
"gemba_services_user_id": "550e8400-e29b-41d4-a716-446655440000",
"workos_user_id": "user_01HZJXKQ8N7X9Y2Z3A4B5C6D7",
"workos_org_id": "org_01HZJXKQ8N7X9Y2Z3A4B5C6D7",
"macrobank_client_id": "bd73b0c9-5816-da4f-27e5-a9bd2736f41c",
"timestamp": "2024-01-15T12:00:00Z"
}
Channel for user identity events published by the Identity Service.
The Identity Service publishes user events after processing WorkOS webhooks. These events are consumed by Macrobank to create/update remote_user records.
Events include the gemba_services_user_id as the external ID for Macrobank.
Topic format: {environment}-identity-commands Examples:
Event Ordering:
All user-related events (user.created, user.updated, user.deleted, user.suspended) are published to a single topic
to maintain ordering guarantees. Events are partitioned by gemba_services_user_id to
ensure all events for the same user are processed in order.
Partition key: gemba_services_user_id to ensure ordered processing per user.
Publish user.suspended event
Published by Identity Service when a WorkOS user is suspended. The event is triggered by a WorkOS webhook. Macrobank consumes this event to suspend or deactivate the corresponding remote_user record.
Available only on servers:
Accepts the following message:
Event published when a user is suspended in WorkOS
Published by the Identity Service when a WorkOS user is suspended.
This event is triggered by a WorkOS user.suspended webhook. The Identity Service:
gemba_services_user_id mappingMacrobank consumes this event to suspend or deactivate the corresponding remote_user record.
Note: Suspension is typically a temporary state. The user mapping remains active
in the user_profile_mappings table. If the user is later unsuspended, a user.updated
event will be published.
The macrobank_client_id field in the event payload contains the Macrobank client UUID.
This is the recommended way to determine which Macrobank client the user belongs to.
Alternative methods (if macrobank_client_id is not available):
Via WorkOS Organization:
workos_org_id from the eventmacrobank-client-id custom attributeVia Macrobank remote_user:
remote_users by external_id = gemba_services_user_idremote_user.client_id (INT) which links to Macrobank clients tableExample user.suspended event
{
"source": "identity-service",
"event_type": "user.suspended",
"gemba_services_user_id": "550e8400-e29b-41d4-a716-446655440000",
"workos_user_id": "user_01HZJXKQ8N7X9Y2Z3A4B5C6D7",
"workos_org_id": "org_01HZJXKQ8N7X9Y2Z3A4B5C6D7",
"macrobank_client_id": "bd73b0c9-5816-da4f-27e5-a9bd2736f41c",
"timestamp": "2024-01-15T12:15:00Z"
}
Channel for Macrobank events consumed by the Identity Service.
The Identity Service consumes events from Macrobank to provision and synchronize WorkOS organizations and user permissions. Events are published by Macrobank CDC when client or permission changes occur.
Topic format: {environment}-identity-events Examples:
Note: These events may be published to separate topics (client.created, client.updated, permissions.updated) depending on the Macrobank CDC configuration.
Subscribe to client.created events
Consumes Macrobank client.created events to provision WorkOS organizations. When a new client is created in Macrobank, the Identity Service provisions a corresponding WorkOS organization and stores the mapping.
Available only on servers:
Accepts the following message:
Event published when a new client is created in Macrobank
Published by Macrobank CDC when a new client is created.
The Identity Service consumes this event to:
Macrobank is the source of truth for clients. This event is published via CDC when a new client record is created in the Macrobank database.
Example client.created event
{
"event_type": "client.created",
"client_id": "bd73b0c9-5816-da4f-27e5-a9bd2736f41c",
"client_name": "Acme Corporation",
"domain": "acme.example.com",
"source": "macrobank-cdc",
"timestamp": "2024-01-15T09:00:00Z"
}
Channel for Macrobank events consumed by the Identity Service.
The Identity Service consumes events from Macrobank to provision and synchronize WorkOS organizations and user permissions. Events are published by Macrobank CDC when client or permission changes occur.
Topic format: {environment}-identity-events Examples:
Note: These events may be published to separate topics (client.created, client.updated, permissions.updated) depending on the Macrobank CDC configuration.
Subscribe to client.updated events
Consumes Macrobank client.updated events to update WorkOS organizations. When a client is updated in Macrobank, the Identity Service updates the corresponding WorkOS organization.
Available only on servers:
Accepts the following message:
Event published when a client is updated in Macrobank
Published by Macrobank CDC when a client is updated.
The Identity Service consumes this event to:
Macrobank is the source of truth for clients. This event is published via CDC when a client record is updated in the Macrobank database.
Example client.updated event
{
"event_type": "client.updated",
"client_id": "bd73b0c9-5816-da4f-27e5-a9bd2736f41c",
"client_name": "Acme Corporation Ltd",
"domain": "acme-new.example.com",
"source": "macrobank-cdc",
"timestamp": "2024-01-15T10:15:00Z"
}
Channel for Macrobank events consumed by the Identity Service.
The Identity Service consumes events from Macrobank to provision and synchronize WorkOS organizations and user permissions. Events are published by Macrobank CDC when client or permission changes occur.
Topic format: {environment}-identity-events Examples:
Note: These events may be published to separate topics (client.created, client.updated, permissions.updated) depending on the Macrobank CDC configuration.
Subscribe to permissions.updated events
Consumes Macrobank permissions.updated events to sync permissions to WorkOS. When user permissions are updated in Macrobank, the Identity Service updates the corresponding WorkOS user metadata.
Available only on servers:
Accepts the following message:
Event published when user permissions are updated in Macrobank
Published by Macrobank CDC when user permissions are updated.
The Identity Service consumes this event to:
external_id (gemba_services_user_id)User Identification:
external_id field in remote_users table to store gemba_services_user_idworkos_user_id from user_profile_mappings table using gemba_services_user_idMacrobank is the source of truth for permissions. This event is published via CDC when permission records are updated in the Macrobank database.
Example permissions.updated event
{
"event_type": "permissions.updated",
"external_id": "550e8400-e29b-41d4-a716-446655440000",
"permission_set_id": "premium-user",
"permissions": [
"transactions.view",
"transactions.create",
"accounts.view"
],
"source": "macrobank-cdc",
"timestamp": "2024-01-15T12:00:00Z"
}
Command to send notification to a client
Command to send notification to an applicant (pre-client)
Command to send internal notifications (admin, support, etc.)
Event published when a company's registry status is updated and requires action
Change Data Capture event published when transfer statuses change in Macrobank
CDC events are published when transfer statuses change in the Macrobank database. The CDC service monitors SQL Server change tracking tables and publishes events to Kafka for downstream consumers.
The message consists of:
The type header indicates the event type:
transfer.outgoing.changed - Outgoing transfer status changed (sender perspective)transfer.incoming.created - Incoming transfer created (recipient perspective, internal transfers only)The Base64-decoded payload contains one of:
Consumers should:
type header to determine event typeclientId and accountId headers for routing/filteringBase64-encoded JSON payload containing the transfer details.
When decoded, the payload is a JSON object matching one of:
The specific schema depends on the source document class in the CDC change.
Event published when a new user is created in WorkOS
Published by the Identity Service when a WorkOS user is created.
This event is triggered by a WorkOS user.created webhook. The Identity Service:
gemba_services_user_id (UUID)Macrobank consumes this event to create the corresponding remote_user record
using gemba_services_user_id as the external_id.
When creating the remote_user record, Macrobank should map the following fields:
email → remote_user.email (or remote_user.CliLogin if email not available)first_name → DocDataRemoteAccount.Name (maps to remote_user.FirstName)last_name → DocDataRemoteAccount.Surname (maps to remote_user.LastName)The macrobank_client_id field in the event payload contains the Macrobank client UUID.
This is the recommended way to determine which Macrobank client the user belongs to.
Alternative methods (if macrobank_client_id is not available):
Via WorkOS Organization:
workos_org_id from the eventmacrobank-client-id custom attributeVia Macrobank remote_user (After Creation):
remote_user with external_id = gemba_services_user_idremote_users table by external_idremote_user.client_id (INT) which links to Macrobank clients tableNote: The Identity Service looks up macrobank_client_id from the organization_mappings table
using workos_org_id. This mapping is established when Identity Service provisions WorkOS
organizations from Macrobank client.created events.
Event published when a user is updated in WorkOS
Published by the Identity Service when a WorkOS user is updated.
This event is triggered by a WorkOS user.updated webhook. The Identity Service:
gemba_services_user_id mappingMacrobank consumes this event to update the corresponding remote_user record.
Users can update their profile information in WorkOS, including:
email - Email addressfirst_name - First namelast_name - Last nameWhen Macrobank receives a user.updated event:
Email Updates:
remote_user.email (or remote_user.CliLogin if email is not available)Name Updates:
DocDataRemoteAccount.Name with first_name (maps to remote_user.FirstName)DocDataRemoteAccount.Surname with last_name (maps to remote_user.LastName)Compliance Considerations:
The macrobank_client_id field in the event payload contains the Macrobank client UUID.
This is the recommended way to determine which Macrobank client the user belongs to.
Alternative methods (if macrobank_client_id is not available):
Via WorkOS Organization:
workos_org_id from the eventmacrobank-client-id custom attributeVia Macrobank remote_user:
remote_users by external_id = gemba_services_user_idremote_user.client_id (INT) which links to Macrobank clients tableEvent published when a user is deleted in WorkOS
Published by the Identity Service when a WorkOS user is deleted.
This event is triggered by a WorkOS user.deleted webhook. The Identity Service:
gemba_services_user_id mappingMacrobank consumes this event to deactivate or remove the corresponding remote_user record.
Note: The user mapping in user_profile_mappings table is not deleted to maintain
audit trail and historical references. The gemba_services_user_id remains valid for
historical data integrity.
The macrobank_client_id field in the event payload contains the Macrobank client UUID.
This is the recommended way to determine which Macrobank client the user belonged to.
Alternative methods (if macrobank_client_id is not available):
Via WorkOS Organization:
workos_org_id from the eventmacrobank-client-id custom attributeVia Macrobank remote_user:
remote_users by external_id = gemba_services_user_idremote_user.client_id (INT) which links to Macrobank clients tableEvent published when a user is suspended in WorkOS
Published by the Identity Service when a WorkOS user is suspended.
This event is triggered by a WorkOS user.suspended webhook. The Identity Service:
gemba_services_user_id mappingMacrobank consumes this event to suspend or deactivate the corresponding remote_user record.
Note: Suspension is typically a temporary state. The user mapping remains active
in the user_profile_mappings table. If the user is later unsuspended, a user.updated
event will be published.
The macrobank_client_id field in the event payload contains the Macrobank client UUID.
This is the recommended way to determine which Macrobank client the user belongs to.
Alternative methods (if macrobank_client_id is not available):
Via WorkOS Organization:
workos_org_id from the eventmacrobank-client-id custom attributeVia Macrobank remote_user:
remote_users by external_id = gemba_services_user_idremote_user.client_id (INT) which links to Macrobank clients tableEvent published when a new client is created in Macrobank
Published by Macrobank CDC when a new client is created.
The Identity Service consumes this event to:
Macrobank is the source of truth for clients. This event is published via CDC when a new client record is created in the Macrobank database.
Event published when a client is updated in Macrobank
Published by Macrobank CDC when a client is updated.
The Identity Service consumes this event to:
Macrobank is the source of truth for clients. This event is published via CDC when a client record is updated in the Macrobank database.
Event published when user permissions are updated in Macrobank
Published by Macrobank CDC when user permissions are updated.
The Identity Service consumes this event to:
external_id (gemba_services_user_id)User Identification:
external_id field in remote_users table to store gemba_services_user_idworkos_user_id from user_profile_mappings table using gemba_services_user_idMacrobank is the source of truth for permissions. This event is published via CDC when permission records are updated in the Macrobank database.