onesignal-api-ext
Mobile icon

OneSignal API Ext

Stable version 1.1.9 (Compatible with OutSystems 11)
Uploaded
 on 24 May (13 days ago)
 by 
5.0
 (2 ratings)
onesignal-api-ext

OneSignal API Ext

Documentation
1.1.9

Designed to extend part of OneSignalAPI module of the official OneSignal Plugin.

Extended Features:

  • GetPlayerId - Get the Player Id for the current app/device.
  • GetPushNotificationStatus - Retrieve notification status to get status for a single NotificationId
  • Sending returns the new NotificiationId for tracking.
  • Headings addition in Notification.
  • Name - Serves as an internal identifier to help organize your notification campaigns.
  • TTL - The "Time To Live" (TTL) defines the duration in seconds for which a notification remains valid if the device is offline, ensuring that outdated notifications aren't delivered if the device reconnects after some time.
  • Colapse_Id - Prevent duplicate notifications by merging notifications with the same identifier into a single one.
  • Android Background Image (cannot use with action buttons and big picture; small icon and large icon is not displayed, must be baked into background image itself)

          https://documentation.onesignal.com/docs/android-customizations

  • Android Channel Id: can be used to set sound on Android push notification etc. (read more in documentation) and Notification LED colour.
  • Android Accent Color: to gave accent colour in Action Buttons and also small_icon (if alpha channel exists)
  • More to come if we had time (if you want to help, please apply for Team)


Original author mostly only extend Android functionality because they only had an Android device.


Limitation:

Original SendPushNotificationToUserid cannot be extended since it read private entity inside original OneSignalAPI.

So we change the method by using OneSignal's external user id feature to implement SendPushNotificationToUserid.


How to use:

1. Uncheck dependencies from original OneSignalAPI (All PushNotifications folder)


2. Add dependency from OneSignalAPI_Ext


3. Do the usual OneSignal Plugin configuration

4. Call SetExternalUserId client action after calling RegisterWithUser, it will set external user id in OneSignal

Set AsyncRegistration = false in RegisterWithUser, to make sure registration already finished before calling SetExternalUserId

5. Call RemoveExternalUserId client action on Logout, before calling OneSignal Plugin's Unregister

6. Use SendPushNotificationToUserid or other methods.


1.1.8

Original SendPushNotificationToUserid cannot be extended since it read private entity inside original OneSignalAPI.

So we change the method by using OneSignal's external user id feature to implement SendPushNotificationToUserid.


How to use:

1. Uncheck dependencies from original OneSignalAPI (All PushNotifications folder)


2. Add dependency from OneSignalAPI_Ext


3. Do the usual OneSignal Plugin configuration

4. Call SetExternalUserId client action after calling RegisterWithUser, it will set external user id in OneSignal

Set AsyncRegistration = false in RegisterWithUser, to make sure registration already finished before calling SetExternalUserId

5. Call RemoveExternalUserId client action on Logout, before calling OneSignal Plugin's Unregister

6. Use SendPushNotificationToUserid or other methods. How to use Android Notification Channel:1. Read this: https://documentation.onesignal.com/docs/android-notification-categories2. And this for sound: https://documentation.onesignal.com/docs/customize-notification-sounds3. Create your notification group and channel via OneSignal Dashboard -> Setting -> Messaging

4.Set the channel, set sound to custom sound file name if you want (without file extension)5. Copy the channel id

6. In the SendPushNotification action, pass this channel id.

7. Include sound file (wav, mp3, ogg) in the APK folder /res/raw. For this, you need a dummy Cordova android plugin, you can found it here:https://www.outsystems.com/forums/discussion/23123/add-drawable-icons-to-mobile-application/

Find attachment file: dummy-android-plugin.zip

Extract it, create sound folder, copy your sound file to sound folder.

Edit plugin.xml and these line after other resource-file tag.


Zip it back, remember your zip must contain a folder that has all the files.

Import zip file to Service Studio -> Data -> Resources

Set Extensibility Configuration to include the resource as plugin.

{


    "plugin": {

        "resource": "/PushNotificationIcons"

    },

    "resource": "PushNotificationIcons.zip"

}


The resource inside plugin tag is the folder name inside the zip file

The resource below plugin tag is the name of resource in Service Studio -> Data -> Resource


Above step can also be used to create push notification small_icon for OneSignal.

Read about small_icon customization here:

https://www.outsystems.com/forums/discussion/36246/one-signal-notification-icon/ 


1.1.7

Original SendPushNotificationToUserid cannot be extended since it read private entity inside original OneSignalAPI.

So I change the method by using OneSignal's external user id feature to implement SendPushNotificationToUserid.


How to use:

1. Uncheck dependencies from original OneSignalAPI (All PushNotifications folder)


2. Add dependency from OneSignalAPI_Ext


3. Do the usual OneSignal Plugin configuration

4. Call SetExternalUserId client action after calling RegisterWithUser, it will set external user id in OneSignal

Set AsyncRegistration = false in RegisterWithUser, to make sure registration already finished before calling SetExternalUserId

5. Call RemoveExternalUserId client action on Logout, before calling OneSignal Plugin's Unregister

6. Use SendPushNotificationToUserid or other methods. How to use Android Notification Channel:1. Read this: https://documentation.onesignal.com/docs/android-notification-categories2. And this for sound: https://documentation.onesignal.com/docs/customize-notification-sounds3. Create your notification group and channel via OneSignal Dashboard -> Setting -> Messaging

4.Set the channel, set sound to custom sound file name if you want (without file extension)5. Copy the channel id

6. In the SendPushNotification action, pass this channel id.

7. Include sound file (wav, mp3, ogg) in the APK folder /res/raw. For this, you need a dummy Cordova android plugin, you can found it here:https://www.outsystems.com/forums/discussion/23123/add-drawable-icons-to-mobile-application/

Find attachment file: dummy-android-plugin.zip

Extract it, create sound folder, copy your sound file to sound folder.

Edit plugin.xml and these line after other resource-file tag.


Zip it back, remember your zip must contain a folder that has all the files.

Import zip file to Service Studio -> Data -> Resources

Set Extensibility Configuration to include the resource as plugin.

{


    "plugin": {

        "resource": "/PushNotificationIcons"

    },

    "resource": "PushNotificationIcons.zip"

}


The resource inside plugin tag is the folder name inside the zip file

The resource below plugin tag is the name of resource in Service Studio -> Data -> Resource


Above step can also be used to create push notification small_icon for OneSignal.

Read about small_icon customization here:

https://www.outsystems.com/forums/discussion/36246/one-signal-notification-icon/


1.1.6

Original SendPushNotificationToUserid cannot be extended since it read private entity inside original OneSignalAPI.

So I change the method by using OneSignal's external user id feature to implement SendPushNotificationToUserid.


How to use:

1. Uncheck dependencies from original OneSignalAPI (All PushNotifications folder)


2. Add dependency from OneSignalAPI_Ext


3. Do the usual OneSignal Plugin configuration

4. Call SetExternalUserId client action after calling RegisterWithUser, it will set external user id in OneSignal

Set AsyncRegistration = false in RegisterWithUser, to make sure registration already finished before calling SetExternalUserId

5. Call RemoveExternalUserId client action on Logout, before calling OneSignal Plugin's Unregister

6. Use SendPushNotificationToUserid or other methods.  How to use Android Notification Channel:1. Read this: https://documentation.onesignal.com/docs/android-notification-categories2. And this for sound: https://documentation.onesignal.com/docs/customize-notification-sounds3. Create your notification group and channel via OneSignal Dashboard -> Setting -> Messaging

4.Set the channel, set sound to custom sound file name if you want (without file extension)5. Copy the channel id

6. In the SendPushNotification action, pass this channel id.

7. Include sound file (wav, mp3, ogg) in the APK folder /res/raw. For this, you need a dummy Cordova android plugin, you can found it here:https://www.outsystems.com/forums/discussion/23123/add-drawable-icons-to-mobile-application/

Find attachment file: dummy-android-plugin.zip

Extract it, create sound folder, copy your sound file to sound folder.

Edit plugin.xml and these line after other resource-file tag.


Zip it back, remember your zip must contain a folder that has all the files.

Import zip file to Service Studio -> Data -> Resources

Set Extensibility Configuration to include the resource as plugin.

{


    "plugin": {

        "resource": "/PushNotificationIcons"

    },

    "resource": "PushNotificationIcons.zip"

}


The resource inside plugin tag is the folder name inside the zip file

The resource below plugin tag is the name of resource in Service Studio -> Data -> Resource


Above step can also be used to create push notification small_icon for OneSignal.

Read about small_icon customization here:

https://www.outsystems.com/forums/discussion/36246/one-signal-notification-icon/


1.1.5

Original SendPushNotificationToUserid cannot be extended since it read private entity inside original OneSignalAPI.

So I change the method by using OneSignal's external user id feature to implement SendPushNotificationToUserid.


How to use:

1. Uncheck dependencies from original OneSignalAPI (All PushNotifications folder)


2. Add dependency from OneSignalAPI_Ext


3. Do the usual OneSignal Plugin configuration

4. Call SetExternalUserId client action after calling RegisterWithUser, it will set external user id in OneSignal

Set AsyncRegistration = false in RegisterWithUser, to make sure registration already finished before calling SetExternalUserId

5. Call RemoveExternalUserId client action on Logout, before calling OneSignal Plugin's Unregister

6. Use SendPushNotificationToUserid or other methods.How to use Android Notification Channel:1. Read this: https://documentation.onesignal.com/docs/android-notification-categories2. And this for sound: https://documentation.onesignal.com/docs/customize-notification-sounds3. Create your notification group and channel via OneSignal Dashboard -> Setting -> Messaging

4.Set the channel, set sound to custom sound file name if you want (without file extension)5. Copy the channel id

6. In the SendPushNotification action, pass this channel id.

7. Include sound file (wav, mp3, ogg) in the APK folder /res/rawFor this, you need a dummy cordova android plugin, you can found it here:https://www.outsystems.com/forums/discussion/23123/add-drawable-icons-to-mobile-application/

Find attachment file: dummy-android-plugin.zip

Extract it, create sound folder, copy your sound file to sound folder.

Edit plugin.xml and these line after other resource-file tag.


Zip it back, remember your zip must contain a folder that has all the files.

Import zip file to Service Studio -> Data -> Resources

Set Extensibility Configuration to include the resource as plugin.

{


    "plugin": {

        "resource": "/PushNotificationIcons"

    },

    "resource": "PushNotificationIcons.zip"

}


The resource inside plugin tag is the folder name inside the zip file

The resource below plugin tag is the name of resource in Service Studio -> Data -> Resource


Above step can also be used to create push notification small_icon for OneSignal.

Read about small_icon customization here:

https://www.outsystems.com/forums/discussion/36246/one-signal-notification-icon/



1.1.1

Original SendPushNotificationToUserid cannot be extended since it read private entity inside original OneSignalAPI.

So I change the method by using OneSignal's external user id feature to implement SendPushNotificationToUserid.


How to use:

1. Uncheck dependencies from original OneSignalAPI (All PushNotifications folder)


2. Add dependency from OneSignalAPI_Ext


3. Do the usual OneSignal Plugin configuration

4. Call SetExternalUserId client action after calling RegisterWithUser, it will set external user id in OneSignal

Set AsyncRegistration = false in RegisterWithUser, to make sure registration already finished before calling SetExternalUserId

5. Call RemoveExternalUserId client action on Logout, before calling OneSignal Plugin's Unregister

6. Use SendPushNotificationToUserid or other methods.


How to use Android Notification Channel:
1. Read this: https://documentation.onesignal.com/docs/android-notification-categories
2. And this for sound: https://documentation.onesignal.com/docs/customize-notification-sounds
3. Create your notification group and channel via OneSignal Dashboard -> Setting -> Messaging

4.Set the channel, set sound to custom sound file name if you want (without file extension)
5. Copy the channel id

6. In the SendPushNotification action, pass this channel id.

7. Include sound file (wav, mp3, ogg) in the APK folder /res/raw
For this, you need a dummy cordova android plugin, you can found it here:
https://www.outsystems.com/forums/discussion/23123/add-drawable-icons-to-mobile-application/

Find attachment file: dummy-android-plugin.zip

Extract it, create sound folder, copy your sound file to sound folder.

Edit plugin.xml and these line after other resource-file tag.


<resource-file src="sound/pushsound.ogg" target="res/raw/pushsound.ogg" />


Zip it back, remember your zip must contain a folder that has all the files.

Import zip file to Service Studio -> Data -> Resources

Set Extensibility Configuration to include the resource as plugin.

{


    "plugin": {

        "resource": "/PushNotificationIcons"

    },

    "resource": "PushNotificationIcons.zip"

}


The resource inside plugin tag is the folder name inside the zip file

The resource below plugin tag is the name of resource in Service Studio -> Data -> Resource


Above step can also be used to create push notification small_icon for OneSignal.

Read about small_icon customization here:

https://www.outsystems.com/forums/discussion/36246/one-signal-notification-icon/



1.1.0

Original SendPushNotificationToUserid cannot be extended since it read private entity inside original OneSignalAPI.

So I change the method by using OneSignal's external user id feature to implement SendPushNotificationToUserid.


How to use:

1. Uncheck dependencies from original OneSignalAPI (All PushNotifications folder)


2. Add dependency from OneSignalAPI_Ext


3. Do the usual OneSignal Plugin configuration

4. Call SetExternalUserId client action after calling RegisterWithUser, it will set external user id in OneSignal

5. Call RemoveExternalUserId client action on Logout, before calling OneSignal Plugin's Unregister

6. Use SendPushNotificationToUserid or other methods.