{"_id":"@blueraydigital/hms-push","_rev":"1-63635a6a328e958cca022dbefdce12b8","name":"@blueraydigital/hms-push","dist-tags":{"latest":"1.2.2"},"versions":{"1.2.2":{"name":"@blueraydigital/hms-push","version":"1.2.2","description":"HMS push service SDK.","main":"./lib/index.js","scripts":{"build":"tsc"},"keywords":["hms","push","publish","topic","subscribe","unsubscribe"],"author":{"name":"Blueray Digital","email":"ka@blueray.hu","url":"https://github.com/blueraydigital"},"repository":{"type":"git","url":"git+https://github.com/blueraydigital/hms-push.git"},"license":"Apache-2.0","devDependencies":{"@types/mocha":"^8.2.1","@types/node":"^14.14.30","@types/request":"^2.48.5","@types/request-promise":"^4.1.47","mocha":"^8.3.0","typescript":"^4.1.5"},"dependencies":{"request":"^2.88.2","request-promise":"^4.2.6"},"gitHead":"0f873f910f1d08a5d4b075fbec19600538fb4cc9","bugs":{"url":"https://github.com/blueraydigital/hms-push/issues"},"homepage":"https://github.com/blueraydigital/hms-push#readme","_id":"@blueraydigital/hms-push@1.2.2","_nodeVersion":"12.20.1","_npmVersion":"6.14.10","dist":{"integrity":"sha512-7tqFOPTI3jIOvZTFtHG0lP5tX2OWjR8y5Q7pq63VgJbwKBQtRRD0aAnqE4hgvlcINsKDCtNnbu6Z/qQA41TfOA==","shasum":"41a7abf8c33257bd63b7403522a5a35f38aa886d","tarball":"https://registry.npmjs.org/@blueraydigital/hms-push/-/hms-push-1.2.2.tgz","fileCount":41,"unpackedSize":118609,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgM7TfCRA9TVsSAnZWagAA4SwP/RnWXu1EahBAzoJXmFWe\nUKC4smgM64c2BNkv23GJAprTkBCgMvYY7kamDtg4eHkXgaclxbLncAjda5ZN\nBI6NgTDREeLLVC7Z44QVgGI54e4quNXkWtwSXAoqASgltl+H7ame1F8m9LZi\n5EWjCvS6AvofWEbVFHHylcY1hTTAnshcvUkuXBqGwaUdUXPirrg23ydaMBMs\nEyE6eHAd2u5Njcr0JvTFmU/jccec+t3mUvfU/tgMC5ESHofHiDN9ofG412Mh\nXbuuIkV6LbDfT/TZqQ+koqqT2Ndcps/9pa49AAClODx54MA1RqVBzCWItTcF\nCj6TYf75Ika/TXZm1nzEI3V6pmi21iluavrYqM4K7wHiJFIWiYv82oLiAiZh\n8H6mm9hCOUzllfKPqQYN3/BJH+MkU+yxiLjlcBRI/BUFAdLzIlxvPVh3gsnU\nHJS+uFw64afJNrtaDb1tuoPJm5yQVarcc8xpsge1bll6ahQ+3z+oeiyc04Jp\nHZnd6UTrpPkwdrA6hKZnedztgRYNo/56Os3FsPkQqPdrRBn5mQTtZjD2W68U\n3qH9lYZAxi1+NZhqiiwMnXYoZy/OcSciyeKN+SdecZWVNXPZAN8lFaVs3AKq\nopd7EQbVac2hWDpsMsn/ZsIBABRHh+rRh0fus0avEOlyvgkNMg1e+UM3t8IR\nl8yd\r\n=Hux+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAxHWvXT+C+Z2GqHf+9mqxcBMRt6qT+nfD+g+uM+FyT+AiByfN5iomHEnSAj7W73t1gg0pg4ExOdxeH0GVeuWFXn9w=="}]},"_npmUser":{"name":"alfredkoncsag","email":"koncsagalfred@gmail.com"},"directories":{},"maintainers":[{"name":"alfredkoncsag","email":"koncsagalfred@gmail.com"},{"name":"karolz79","email":"horvath.richard@blueray.hu"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hms-push_1.2.2_1614001374552_0.11515505933718351"},"_hasShrinkwrap":false}},"time":{"created":"2021-02-22T13:42:54.266Z","1.2.2":"2021-02-22T13:42:54.788Z","modified":"2022-04-04T19:49:46.832Z"},"maintainers":[{"name":"alfredkoncsag","email":"koncsagalfred@gmail.com"},{"name":"karolz79","email":"horvath.richard@blueray.hu"}],"description":"HMS push service SDK.","homepage":"https://github.com/blueraydigital/hms-push#readme","keywords":["hms","push","publish","topic","subscribe","unsubscribe"],"repository":{"type":"git","url":"git+https://github.com/blueraydigital/hms-push.git"},"author":{"name":"Blueray Digital","email":"ka@blueray.hu","url":"https://github.com/blueraydigital"},"bugs":{"url":"https://github.com/blueraydigital/hms-push/issues"},"license":"Apache-2.0","readme":"# HMS Pushkit\n\n## Table of Contents\n\n * [Installation](#installation)\n * [Configuration ](#configuration )\n * [Examples](#examples)\n * [License](#license)\n\n## Installation\n\n```bash\n$ npm install --save @blueraydigital/hms-push\n```\n\n## Configuration \n\nBefore using functions provided by packages in examples, you need to set parameters for initialization in config.js.\n\n\n\t\n| Initialization Parameter | Description |\n| ---- | ----- |\n| AppId|App ID, which is obtained from app information. |\n| AppSecret|Secret access key of an app, which is obtained from app information. |\n| AuthUrl|URL for the Huawei OAuth 2.0 service to obtain a token, please refer to Generating an App-Level Access Token. |\n| PushUrl|URL for accessing HUAWEI Push Kit, please refer to Sending Messages. |\n\n\n| Request Parameter | Description |\n| ---- | ----- |\n| TargetTopic|Name of a topic to be subscribed to, unsubscribed from, or queried. |\n| TargetCondition|Combination of condition expressions for a message. |\n| TargetToken|Token of a destination device. |\n| TargetTokenArray|Tokens of destination devices. |\n\n\n## Examples\nCall methods on object HmsNamespace: messaging and topic.\n\nThe following table lists methods in HmsNamespace.\n| Method | Description |\n| ---- | ---- |\n| messaging | The entry of the Messaging object, and verify the initialization input parameters. |\n| topic | The entry of the Topic object, and verify the initialization input parameters. |\n---\nThe following table lists methods in Messaging.\n| Method | Description |\n| ---- | ---- |\n| send | Verify if the token needs to be updated and call the method sendRequest. |\n| sendRequest | Sends a message to a device. |\n---\nThe following table lists methods in Topic.\n| Method | Description |\n| ---- | ---- |\n| subScribeTopic | Subscribe to topic. |\n| unSubScribeTopic | Unsubscribe topic. |\n| queryTopicList | Query subject list. |\n\n---\n\n#### 1. Send data message.\n```js \nconst hms = require(\"@blueraydigital/hms-push\").default;\nconst config = require(\"./config\");\n\nhms.init({\n    appId: config.AppId,\n    appSecret: config.AppSecret,\n    authUrl: config.AuthUrl,\n    pushUrl: config.PushUrl\n});\n\nlet mc = hms.messaging().messaging;\n\nlet AndroidConfig = {\n    collapse_key: -1,\n    urgency: \"HIGH\",\n    ttl: \"10000s\",\n    bi_tag: \"the_sample_bi_tag_for_receipt_service\"\n}\nlet message = {\n    data: \"test\",\n    android: AndroidConfig,\n    token: config.AndroidTokenArray\n            \n};    \nmc.send(message, false).then(data => {\n    console.log(data);\n}).catch(err => {\n    console.log(err);\n});\n```\n\n#### 1. Send Test message.\n```js \nconst hcm = require(\"@blueraydigital/hms-push\").default;\nconst config = require(\"./config\");\n\nhcm.init({\n    appId: config.AppId,\n    appSecret: config.AppSecret,\n    authUrl: config.AuthUrl,\n    pushUrl: config.PushUrl\n});\n\nlet mc = hcm.messaging().messaging;\n\nlet notification = {\n    title: \"Test title\",\n    body: \"Test body\"\n}\nlet androidNotification = {\n    icon: '... .png',\n    color: '#AACCDD',\n    sound: '... .mp3',\n    default_sound: true,\n    tag: 'tagBoom',\n    click_action: {\n        type: 1,\n        intent:\"intent\"\n    },\n    body_loc_key: 'M.String.body',\n    body_loc_args: ['boy', 'dog'],\n    title_loc_key: 'RingRing',\n    title_loc_args: [\"Girl\", \"Cat\"],\n    channel_id: 'Your Channel ID',\n    notify_summary: 'some summary',\n    multi_lang_key: {        \n        title_key: {            \n            en: \"Foo Bar\",            \n            zh: \"Foo Bar\",            \n            ru: \"Foo Bar\"        \n        },        \n        body_key: {            \n            en: \"My name is %s, I am from %s.\",            \n            zh: \"My name is %s, I am from %s.\",            \n            ru: \"My name is %s, I am from %s.\"        \n        }\n    },\n    style: 1,\n    big_title: 'test message',\n    big_body: 'Big Boom Body',\n    auto_clear: 86400000,\n    notify_id: 486,\n    group: 'Group1',\n    importance: \"HIGH\",\n    light_settings: {\n        color: {\n            alpha:0, red:0, green:1, blue:1\n        }, \n        light_on_duration: \"3.5\", \n        light_off_duration: \"5S\"\n    },\n    badge:{\n        add_num:99,\n        set_num:99,\n        class:\"Classic\"\n    },\n    ticker:\"i am a ticker\",\n    auto_cancel:false,\n    when:\"2019-11-05\",\n    use_default_vibrate:true,\n    use_default_light:false,\n    visibility: 'PUBLIC',\n    vibrate_config:[\n        \"1.5\",\n        \"2.000000001\",\n        \"3\"\n    ],\n    foreground_show:true\n}\nlet androidConfig = {\n    collapse_key: -1,\n    urgency:\"HIGH\",\n    ttl: \"10000s\",\n    bi_tag: \"the_sample_bi_tag_for_receipt_service\",\n    notification: androidNotification\n}\nlet message = {\n    data:\"{key1:value1}\",\n    notification: notification,\n    android: androidConfig,\n    token: config.AndroidTokenArray\n            \n};    \n\nmc.send(message, false).then(data => {\n    console.log(data);\n}).catch(err => {\n    console.log(err);\n});\n```\n\n\n#### 2. Send data message.\n```js \nconst hms = require(\"@blueraydigital/hms-push\").default;\nconst config = require(\"./config\");\n\nhms.init({\n    appId: config.AppId,\n    appSecret: config.AppSecret,\n    authUrl: config.AuthUrl,\n    pushUrl: config.PushUrl\n});\n\nlet mc = hms.messaging().messaging;\n\nlet AndroidConfig = {\n    collapse_key: -1,\n    urgency: \"HIGH\",\n    ttl: \"10000s\",\n    bi_tag: \"the_sample_bi_tag_for_receipt_service\"\n}\nlet message = {\n    data: \"test\",\n    android: AndroidConfig,\n    token: config.AndroidTokenArray\n            \n};    \nmc.send(message, false).then(data => {\n    console.log(data);\n}).catch(err => {\n    console.log(err);\n});\n```\n\n## License\nHMS Pushkit is licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).\n","readmeFilename":"README.md"}