/
Status

Status

Get Notification by ID

GET /notification/status/{project}/{clientId}/{notificationID}

The get Notifications endpoint retrieves a single notification associated with a client in a specified project.

Path Parameters

Name

Type

Required

Description

Name

Type

Required

Description

{project}

string

Yes

The name of the project where the client is going to be searched on.

{clientId}

string

Yes

Id assigned to a client.

{notificationID}

string

Yes

ID assigned to a notification.

Response

{ "notifications": [ { "channel": "", "clientId": "", "notificationId": "", "msg": "", "notificationDate": "", "project": "", "status": "", "templateId": "", "templateParams": ", "to": "" } ] }

Parameter Name

Type

Description

Parameter Name

Type

Description

project

string

Reference project to send notifications. This allows the app to store data in a different data persistence tool.

Supported values:

  • LAC-FP

  • LAC-HIV

clientId

string

Could be:

  • ID associated to a DHIS2 TrackedEntityInstance.

  • _id associated to a mongoDB client document.

msg

string

Message to be linked to the notification.

channel

string

Way of communication where the scheduled message will be sent:

Current supported values:

  • facebook

  • whatsapp

  • SMS

to

string

Identifier used by the specified channel to send the message.

templateID

string

Identifier used by the specified channel to use a pre-defined template.

templateParams

string

Parameters to be used in the template specified.

notificationDate

string

Date on which the notification will be sent.

status

cancelled | sent | scheduled | error | unsent

Current status of the notification.

  • Cancelled: Cancelled by the cancel endpoint

  • Sent: Sent to the user successfully.

  • Scheduled: Pending to be sent.

  • Error: Try to send the notification, but an error occurs.

  • Replied: the client replied using one of the included quick replies of the original notification

  • Unsent: Try to send the notification, but client does not consent to receive messages.

Responses

200: Success

{ "notifications": [ { "channel": "facebook", "clientId": "CEWRFqwe123", "notificationId": "aosfACOaqw213", "msg": "Created from openHIM 22", "notificationDate": "2024-02-19T10:15:08.093", "project": "LAC-FP", "status": "canceled", "templateId": "template_4", "templateParams": "{\"quick_replies\":[{\"content_type\":\"text\",\"image_url\":\"http://example.com/img/red.png\",\"payload\":\"<POSTBACK_PAYLOAD>\",\"title\":\"Red\"},{\"content_type\":\"text\",\"image_url\":\"http://example.com/img/green.png\",\"payload\":\"<POSTBACK_PAYLOAD><\",\"title\":\"Green\"}],\"text\":\"Pick a color:\"}", "to": "123456767" } ] }

404: Not Found. Request was procesed but entity was not found.

{ "timestamp": "2024-02-29T04:12:17.603Z", "statusCode": 404, "message": "Client, project or notification not found.", "errors": [] }

409: Conflict. Request was processed but resource was not found.

500: Internal Server Error.


Related content