🎅🏽 Release Notes - Alpha Platform - Web-hook Configuration for Case Service - 24.12-24.x.x

:wrapped_gift: Enhancements

Case Service Webhooks

This document specifies the necessary configuration required for the Alpha Case Service and their expected format and usage.

Required Environment Variables

  1. CREATE_CASE_WEBHOOK_CONFIG: Specifies the callback URL configurations for the “Create Case” operation.

  2. UPDATE_CASE_WEBHOOK_CONFIG: Specifies the callback URL configurations for the “Update Case” operation.

Format

The value for both CREATE_CASE_WEBHOOK_CONFIG and UPDATE_CASE_WEBHOOK_CONFIG should be a valid JSON string in the following format:

{
    "{project_id}": "{callback_url}"
}

Example

{
    "project123": "http://localhost:5000/webhook-endpoint",
    "project456": "http://example.com/api/webhook"
}
  • project_id: A unique identifier for the project.
  • callback_url: The URL that will receive webhook POST requests.

Callback URL Requirements

  • The callback URL must be a POST endpoint.
  • The endpoint must be accessible without requiring any authentication.
  • It should handle the request body as described below.

Request Body for Webhook Callbacks

For “Create Case” Operation

The CREATE_CASE_WEBHOOK_CONFIG callback will receive a POST request with the following body:

{
    "cid": "{case_instance_id}",
    "piid": "{process_instance_id}",
    "caseType": "{case_type}",
    "operation": "create_case",
    "projectId": "{project_id}"
}

For “Update Case” Operation

The UPDATE_CASE_WEBHOOK_CONFIG callback will receive a POST request with the following body:

{
    "cid": "{case_instance_id}",
    "piid": "{process_instance_id}",
    "caseType": "{case_type}",
    "operation": "update_case",
    "projectId": "{project_id}"
}

Example Configuration in Environment Variables In Helmchart Values File

- name: CREATE_CASE_WEBHOOK_CONFIG
  value: '{"76fde341-b2a0-41d7-a7d8-674a8cd5vbbc": "http://sample-node-sample-nodejs-app.alpha.svc.cluster.local:3000/api/data"}'
- name: UPDATE_CASE_WEBHOOK_CONFIG
  value: '{"76fde341-b2a0-41d7-a7d8-674a8cd5vbbc": "http://sample-node-sample-nodejs-app.alpha.svc.cluster.local:3000/api/data"}'

Notes

  • Ensure the callback URL is reachable and properly configured to handle the expected POST requests.
  • The cid, piid, caseType, and projectId will be dynamically populated based on the operation and project-specific configurations.

Demos:

Case Create Webhook Demo:

CASE_CREATE_HOOK.mov

Case Update Webhook Demo:

CASE_UPDATE_HOOK.mov

Once this is configured, whenever ANY case gets created or case data is updated, the configured endpoint will get called with POST method with the following payload:

{
    cid: 14469, // case id of the case that got created
    piid: 7255, // associated process id
    caseType: 'motor_claim', // onboarded case type
    operation: 'create_case', // operation: 'create_case' or 'update_case'
    projectId: '76fde341-b2a0-41d7-a7d8-674a8cd5vbbc' // projectId for which the URL is configured in the env variable
}

:camera_with_flash: Images

Service Name Image Name Image Version
alpha-caseservice neutrinos.azurecr.io/alpha/alpha-case-service 24.12.0.0.14-prod

:evergreen_tree: Environment Variables

Service Name Env Variable Name Description Example
alpha-caseservice CREATE_CASE_WEBHOOK_CONFIG Per project create case notification callback URL configuration { “{project_id}”:“{callback_url}”}
alpha-caseservice UPDATE_CASE_WEBHOOK_CONFIG Per project update case notification callback URL configuration { “{project_id}”:“{callback_url}”}

3 Likes