Skip to content

Latest commit

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Notifications API

Introduction

Malcom has a communication public interface between software component to make easy the integration of thirds owners platforms with Malcom.

This interface in presented through a REST API (Representation State Transfer).

Objetive

This document introduces the new format of push notifications mechanism of Malcom, which make easy the integration with external platforms to send push notifications to different platforms.

General Notes

###Conection Over HTTPS communication protocol.

###Content codification The "Content-Type" must be "application/json" for request and answer.

###Content limit Notifications are limited to 250 characters

Authentication

HTTP Basic Auth with Malcom's user data.

Manage API Errors

Errors are returned by standard syntax of HTTP codes. Any additional information as result of the error call is included in the body of the answer in JSON format.

List of error codes:

CodeDescription
200Standard response for successful request
401Authentication has failed
404Not exist resource in that path
412The request is invalid or not fulfill a condition to execute it. The answer usually contains a specific description of what have produced the error
500Internal error or when no more specific message is suitable

As we mentioned, with a code 412 API return in the body of the message a JSON object with this format:

{
"response": {
"description": <Error description>,"code": <Error code>
}
}

Resources

This is a list of API REST resources available under the URL api.mymalcom.com

Notifications

/v3/notification/push

####Description It allows the delivery of a Push Notification to all the devices registered on the application, segment or in the specified devices.

####URL's structure api.mymalcom.com/v3/notification/push

####Version v3

####Method POST

####Parameters Request do not require any parameter.

####Request body

FieldDescriptionTypeCharacter
notificationObject containerJSONMandatory
applicationCodeApp UUID identifier in MalcomStringConditional
enviromentEnvironment belong the devices that will receive the push notification. Valid values are SANDBOX: Devices registered in sandbox environment. PRODUCTION: Devices registered in production environment.StringMandatory
messageText of the notification conveniently escapedStringMandatory
segmentIdSegment ID that belong all the devices to receive the notification. This property is exclusive of applicationCode and segmentIds fieldsIntegerConditional
segmentIdsSegment IDs that belong all the devices to receive the notification. This property is exclusive of applicationCode and segmentIds fields. If one device is in several segments only one notification will be sent to it. This property is exclusive of applicationCode and segmentId fieldsJSON Array de IntegerConditional
udidsDevice IDs to send the notification separated by commas. If not specified, will be sent to all devices in the application specified in the applicationCode fieldJSON ArrayConditional
saturationControlActivate or deactivate saturation control. For any device that have received a notification in the time window defined in saturationCtrlDays and saturationCtrlHours fields, will not send the specific request through this message. Value by default is falseBooleanoOptional
saturationCtrlDaysNumber of days since last notification sent to the device. Value by default is 0IntegerOptional
saturationCtrlHoursNumber of hours since last notification sent to the device. Value by default is 0IntegerOptional
notificationCustomizationContainer for the customization of the notificationJSONOptional
badgeNumber plate displayed on the notificationIntegerOptional
customfieldContainer for customized fields. Belong to the parameters sent to the devices to be interpreted by the application. You can send multiple parametersJSON ArrayOptional
entryKey-value pair to be interpreted by the applicationJSONOptional
soundSound of the notificationStringOptional
notificationTypeNotification type to send. In this version just indicate if notification to send is using TAGS filterStringOptional
filterFilter to apply if notification is a TAG typeJSONOptional
tagsTag name or group of tags to filter the notificationArrayOptional

####Answer If the request has been successful, the answer contain the code generated for the notification sent.

{
"response": {
"value": {
"notificationId": 19581
},
"code": "OK"
}
}

####Example 1 - Basic notification

{
"notification":{
"applicationCode":"3eb5fdfd-8045-4111-8889-999999",
"environment":"SANDBOX",
"message":"Este es un mensaje de ejemplo"
}
}

####Example 2 - Notification to different segments

{
"notification":{
"segmentIds":[1637,1638],
"environment":"SANDBOX",
"message":"Este es un mensaje de ejemplo"
}
}

####Example 3 - Notification to specific tags

{
"notification":{
"applicationCode":"3eb5fdfd-8045-4111-8889-999999",
"environment":"SANDBOX",
"message":"Este es una notificacion con filtro de tags", "saturationControl":false,
"saturationCtrlDays":0, "saturationCtrlHours":0, "notificationType":"TAGS",
"filter":{
"tags":["myTag"]
}
}
}

####Example 4 - Notification alert sound

{
"notification":{
"applicationCode":"3eb5fdfd-8045-4111-8889-999999", "environment":"SANDBOX",
"message":"Este es una notificacion con filtro de tags", "notificationCustomization":{
"sound":"default"
}
}
}

####Example 5 - Notification custom fields

{
"notification":{
"applicationCode":"3eb5fdfd-8045-4111-8889-999999", "environment":"SANDBOX",
"message":"Este es una notificacion con filtro de tags", "notificationCustomization":{
"sound":"default",
"customFields":{
"entry" : [{
"key" : "foo",
"value" : "bar"
}]
}
}
}

####Example 6 - Notification to specific devices

{
"notification":{
"applicationCode":"3eb5fdfd-8045-4111-8889-999999",
"environment":"SANDBOX",
"message":"This is a notification to a specific device",
"udids":[1234567890]
}
}

Notifications status

/v3/notification/push/{id}

####Description It allows query the status of a push notification with given {id}

####URL's structure api.mymalcom.com/v3/notification/push/{id}

####Version v3

####Method GET

####Parameters {id} identifier of the push notification

####Response body

FieldDescriptionType
statusObject containerJSON
idNotification identifierLong
candidatesNumber of target devicesInteger
failedPushesTotal falied notificationsInteger
sentOnTimestamp indicating when notification has been delivered to APNS or GCM servicesDate
sentPushesTotal succeed notificationsInteger

####Answer 1 If the request has been successful, the answer contain the information related to notification.

{
"status":{
"candidates":10,
"failedPushes":0,
"id":2000,
"sentOn":"2013-10-04T11:04:44+02:00",
"sentPushes":10
}
}

####Answer 2 If there isn't a notification with given identifier, the answer is:

{
"response":
{
"description":"Notification with id 2200 not found",
"code":"Not Found"
}
}

About

Malcom API Documentation

Resources

Stars

1 star

Watchers

4 watching

Forks

Releases

Packages

Contributors