Notifications

The SDK lets you manage participant 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 as 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

Internal, stable, unique ID for the participant that was sent this notification.

result.notifications[n].participantIdentifier string

Project-set, 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.notifications[n].schedule

Contains details about the schedule that triggered the notification, if applicable. Will be null if the notification was not triggered by a schedule.

result.notifications[n].schedule.id guid

Unique identifier for the schedule.

result.notifications[n].schedule.name string

Schedule name.

result.notifications[n].schedule.category string

User-assigned category for the schedule (optional).

result.notifications[n].schedule.interval integer

How often the notification is delivered, based on the interval type. For example, if intervalType is Weeks and interval is 4, it means the notification repeats every 4 weeks. Will be null if the schedule does not repeat.

result.notifications[n].schedule.intervalType string

Units for interval. May be Days, Weeks, Months, or Years.

result.notifications[n].sourceUser object

For a notification initiated by a coordinator action, this will record the coordinator’s name and email. Will be null for scheduled notifications.

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 Views
MyDataHelps Embeddables
Web View Steps
Querying Notifications After a Date
var queryParams = {
	sentAfter: "2021-02-15"
};

MyDataHelps.queryNotifications(queryParameters)
	.then( function(result) {
		console.log(result);
	} );
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": "WeeklyUpdate-LateNotification",
      "sentDate": "2021-02-17T22:08:31.637+00:00",
      "statusCode": "Succeeded",
      "type": "Email",
      "content": {
        "subject": "Weekly Update due date approaching"
      },
      "sourceUser": null,
      "schedule": {
          "id": "a843df73-07c2-45a3-9808-98745fafc766",
          "name": "Weekly Reminder",
          "category": "Phase 1",
          "interval": 1,
          "intervalType": "Week"
      }
    }
  ],
  "nextPageID": null
}
{ "notifications": [ { "id": "d786f2a6-6c71-eb11-aa81-f8e4e3480e0d", "participantID": "82320a5b-4d6a-eb11-aa7f-f8e4e3480e0d", "identifier": "WeeklyUpdate-LateNotification", "sentDate": "2021-02-17T22:08:31.637+00:00", "statusCode": "Succeeded", "type": "Email", "content": { "subject": "Weekly Update due date approaching" }, "sourceUser": null, "schedule": { "id": "a843df73-07c2-45a3-9808-98745fafc766", "name": "Weekly Reminder", "category": "Phase 1", "interval": 1, "intervalType": "Week" } } ], "nextPageID": null }