1.0.0 • Published 3 years ago
ato-machine-messaging v1.0.0
Messaging SDK
node js SDK for messaging
Installation
# From npm server
$ npm install messaging
# From local machine
$ npm install local_path_of_package
Methods
Example
Import sdk
require('messaging')({client_id:'CLIENT_ID',client_secret:'CLIENT_SECRET'});
Get Message
await Messaging.getMessageList("task_status", "started", {key1: "tag1", key2: "tag2"}, false, "en");
Result:
{
"id": 7,
"event": "task_status",
"action": "started",
"param": "param1,param2",
"note": null,
"redirection": null,
"created": "1635424248326",
"additional_data": null,
"messageLocale": {
"id": 11,
"message_id": 7,
"locale": "en",
"message": "Your project task has been updated to status started"
}
}
Get Messages
await Messaging.getMessages([{event:"task_status",action:"started",param:{key1: "tag1", key2: "tag2"}},{event:"task_status",action:"completed",param:{key1: "tag1", key2: "tag2"}}], false, "en"));
Result:
[
{
"id": 8,
"event": "task_status",
"action": "completed",
"param": "param1,param2",
"note": null,
"redirection": null,
"created": "1635483229763",
"additional_data": null,
"messageLocale": {
"id": 15,
"message_id": 8,
"locale": "en",
"message": "Your project task has been updated to status completed"
}
},
{
"id": 7,
"event": "task_status",
"action": "started",
"param": "param1,param2",
"note": null,
"redirection": null,
"created": "1635424248326",
"additional_data": null,
"messageLocale": {
"id": 11,
"message_id": 7,
"locale": "en",
"message": "Your project task has been updated to status started"
}
}
]
Dispatch Event
var messageEvent = await Messaging.dispatchEvent("task_status", "started", {key1: "tag1", key2: "tag2"}, false, "en");
Result:
success
1.0.0
3 years ago