Notifications

Query Notifications

Queries the history of notifications sent to this participant.

MyDataHelps.queryNotifications(queryParameters)

Parameters

sentBefore date

Filters notifications to those sent before this date.

sentAfter date

Filters notifications to those sent after this date.

identifier string

Name of the configured notification.

type enum

Type of notification. If provided, must be one of “Sms”, “Push”, or “Email”.

statusCode enum

Describes whether the notification was sent. Must be one of:

  • “Succeeded”: The notification was sent. This does not guarantee it was received nor read.
  • “Unsubscribed”: The notification could not be sent because the recipient unsubscribed their contact info from notifications.
  • “MissingContactInfo”: The notification could not be sent because contact info was not available.
  • “NoRegisteredMobileDevice”: The notification could not be sent because a verified mobile device was not available.
  • “NoAssociatedUser”: The notification could not be sent because the participant has not registered an account on MyDataHelps.
  • “ServiceError”: The notification was not sent due to an error.
limit int

How many entries to include in each page of results. Default and maximum is 100.

pageID guid

Each page of results will return a nextPageID if there are additional pages that can be queried. Supply that to pageID to query the next page. When excluded, retrieves the first page.

Returns

Promise<NotificationsPage>

Resolves to a result object containing a page of notifications.

result.notifications collection

A list of notifications filtered by the query parameters.

result.notifications[n].id guid

Identifier for this notification.

result.notifications[n].participantID guid

Auto-generated, globally-unique identifier for the participant that was sent this notification.

result.notifications[n].identifier string

Identifier for the notification configuration.

result.notifications[n].sentDate date

If the notification was sent, the date at which the notification was sent.

result.notifications[n].statusCode enum

Describes whether the notification was sent. Will be one of:

  • “Succeeded”: The notification was sent. This does not guarantee it was received nor read.
  • “Unsubscribed”: The notification could not be sent because the recipient unsubscribed their contact info from notifications.
  • “MissingContactInfo”: The notification could not be sent because contact info was not available.
  • “NoRegisteredMobileDevice”: The notification could not be sent because a verified mobile device was not available.
  • “NoAssociatedUser”: The notification could not be sent because the participant has not registered an account on MyDataHelps.
  • “ServiceError”: The notification was not sent due to an error.
result.notifications[n].type enum

Type of notification. Will be one of “Sms”, “Push”, or “Email”.

result.notifications[n].content dynamic

An object whose fields depend on the type of the notification.

result.notifications[n].content.body string

Sms and Push only. The content of the notification.

result.notifications[n].content.title string

Push only. The title of the notification.

result.notifications[n].content.subject string

Email only. The subject line of the email. The content of the email is not available.

result.nextPageID guid

An ID to be used with subsequent queries. Results from queries using this ID as the pageID parameter will show the next page of results. This field is null if there isn’t a next page.

Availability

MyDataHelps Applications
Web View Steps
Example: Querying Notifications After a Date
var queryParams = {
	sentAfter: "2021-02-15"
};

MyDataHelps.queryNotifications(queryParameters)
	.then( function(result) {
		console.log(result);
	} );
Console Output
{
	"notifications": [
		{
			"id": "d786f2a6-6c71-eb11-aa81-f8e4e3480e0d",
			"participantID": "82320a5b-4d6a-eb11-aa7f-f8e4e3480e0d",
			"identifier": "Weekly Update - Late Notification",
			"sentDate": "2021-02-17T22:08:31.637+00:00",
			"statusCode": "Succeeded",
			"type": "Email",
			"content": { "subject": "Weekly Update due date approaching" }
		} ],
		"nextPageID": null 
}