Skip to main content

9. API / Integration Documentation

This page documents external and cross-service integrations used by the MoH Helpdesk platform. Detailed REST endpoint definitions are maintained in REST API Specifications.


9.1 Integration Inventory

IntegrationTypePurposeRequired
REST APIsHTTP/JSONFrontend and service communication.Yes
PostgreSQLDatabasePersistent relational storage.Yes
KafkaEvent streamingTicket, notification, and service synchronization events.Recommended
SMTP / MoH Mail GatewayEmailSends platform notifications.Yes
Object Storage / MinIO / S3File storageStores ticket attachments.Yes
JWT/OAuth providerIdentity/securityToken authentication and authorization.Yes
External device/facility systemsData syncOptional synchronization with external registries.Optional

9.2 REST API Integration

REST APIs use HTTP and JSON payloads. The primary ticket endpoints are routed with the /ticket-api/ prefix.

Integration clients should confirm:

  • Base URL for each environment.
  • Authentication header requirements.
  • JSON request/response shape.
  • Error response format.
  • Pagination and filtering behavior.
  • File upload size limits.

Common headers:

HeaderDescription
Authorization: Bearer <token>Authenticates API requests.
Content-Type: application/jsonUsed for JSON request bodies.
Accept: application/jsonRequests JSON responses.

See REST API Specifications for endpoint-level details.


9.3 Kafka Event Integration

Kafka supports asynchronous communication between services and notification workers.

Common event examples:

EventPurpose
TicketCreatedEventPublished after a ticket is created.
TicketAssignedEventPublished after assignment changes.
TicketReassignedEventPublished after reassignment or transfer.
TicketClosedEventPublished after a ticket is closed.
TicketReopenedEventPublished when a closed ticket is reopened.

Implementation guidance:

  • Use stable event names and versioned payloads.
  • Include event ID, timestamp, organization ID, ticket ID, and actor ID.
  • Do not place sensitive secrets in event payloads.
  • Enable TLS/SASL for production Kafka clusters.
  • Retain failed notification events for retry where supported.

Kafka payload examples are available in Technical Appendix & Glossary.


9.4 Email / SMTP Integration

The platform uses SMTP or the MoH Mail Gateway to send email notifications.

Required configuration:

SettingDescription
SMTP hostMail server hostname.
SMTP portUsually 587 for TLS or 465 for SSL.
UsernameMail service account.
PasswordMail service password or app secret.
Sender addressFrom address used in notifications.
TLS/SSLMust be enabled in production.

Notification templates should be configured for:

  • New ticket alert
  • Ticket assignment alert
  • New message alert
  • Internal note alert
  • Overdue ticket alert
  • Ticket closure alert

9.5 Object Storage Integration

Ticket attachments should be stored outside the application server filesystem in object storage.

Supported pattern:

ItemDescription
Bucket/containerStores ticket attachments.
Object keyUnique path or generated file identifier.
File size limitRecommended maximum: 5 MB per file.
Allowed formatsPDF, DOC, DOCX, TXT, JPG, PNG.
Download accessTime-limited signed URL where supported.

Production requirements:

  • Enable access logging.
  • Enable backups or replication.
  • Restrict bucket access to application services.
  • Rotate access keys according to security policy.

9.6 External Synchronization

The data model includes sync-related flags such as IsSynced and IsTPSynced, indicating that some records may synchronize with external or third-party systems.

For each external sync, document:

ItemDescription
Source systemName and owner of the external system.
DirectionImport, export, or bidirectional.
Data objectsFacilities, devices, users, tickets, or lookup data.
ScheduleReal-time, scheduled, or manual.
Retry behaviorHow failed sync attempts are handled.
Conflict handlingWhich system is authoritative.
Audit trailWhere sync results are stored.

If no external synchronization is active in the production environment, record it as not enabled during handover.


9.7 Integration Verification Checklist

TestExpected Result
Login APIReturns a valid JWT for active user credentials.
Ticket APICreates, lists, updates, assigns, and closes tickets.
Kafka eventTicket action publishes the expected event.
SMTPTest notification is received by configured recipient.
Attachment uploadFile uploads successfully and appears on ticket details.
Attachment downloadAuthorized user can download file.
External syncSync status updates correctly, if integration is enabled.