# Tencent Push Notification Service Configuration

The Tencent push notification API has been integrated into the "endpoints.push.tpns" key of the Cortex script notification module send options.&#x20;

All **Android** parameters are available, however, the behavior of a few has been slightly modified.&#x20;

For Tencent's full API specification, please see <https://intl.cloud.tencent.com/document/product/1024/33764>.

### Requirements

* Cortex API 2.15.8
* Axon 4.14.3+
* PATAND 4.13.300 (Android app for study patients)

### Configuration

1. Obtain Tencent Push Notification Service credentials
2. Add credentials to Android Patient App
   * Access ID
   * Secret Key
3. For Cortex 2.16 and earlier, patch the *c\_axon\_room\_event\_library* Axon script
   * In the App Platform open Cortex -> Settings -> Scripts
   * Select the Axon - Room Event Library script&#x20;
   * Patch the `sendIncomingCallNotification` function to explicitly include `messageType` and `customContent` Tencent Push Notification Service options
   * Press the "Save Script" button at the bottom of the screen

#### Verification

* Log in to the Android Patient App and verify the user has a Tencent token
* Send a test notification

### **Modifications**

#### **Android**

* **tpns.audience\_type** defaults to "token"
* **tpns.message.content** defaults to the value of the options.message parameter
* **tpns.message.android.custom\_content** is set to the value of the payload if the payload is provided

### Example

```
const notifications = require('notifications'),
      payload = { key: 'value' },
      options = {
        message: 'message', 
        endpoints: { 
          push: { 
            tpns: { 
              upload_id: 'upload_id', 
              message_type: 'notify', 
              message: { 
                title: 'title', 
                content: 'content', 
                xg_media_resources: 'url', 
                android: {
                  n_ch_id: 'channelId', 
                  n_ch_name: 'channelName', 
                  ring: 1, 
                  ring_raw: 'ringtoneFile',
                  vibrate: 0,
                  lights: 1,
                  clearable: 1
                }
              }
            }
          }
        },
        recipient: 'accountId'
      }

return notifications.send(payload, options)
```
