mirror of https://github.com/caronc/apprise
Page:
Notify_onesignal
Pages
CLI_Usage
DemoPlugin_Basic
DemoPlugin_WebRequest
Development_API
Development_Apprise_Details
Development_Contribution
Development_LogCapture
Home
Notification_Graveyard
Notify_Custom_Form
Notify_Custom_JSON
Notify_Custom_XML
Notify_Revolt
Notify_africas_talking
Notify_apprise_api
Notify_aprs
Notify_bark
Notify_boxcar
Notify_bulksms
Notify_bulkvs
Notify_burst_sms
Notify_chantify
Notify_clicksend
Notify_d7networks
Notify_dapnet
Notify_dbus
Notify_dingtalk
Notify_discord
Notify_email Fastmail
Notify_email
Notify_emby
Notify_enigma2
Notify_faast
Notify_fcm
Notify_feishu
Notify_flock
Notify_freemobile
Notify_gitter
Notify_gnome
Notify_googlechat
Notify_gotify
Notify_growl
Notify_guilded
Notify_homeassistant
Notify_httpsms
Notify_ifttt
Notify_join
Notify_kavenegar
Notify_kodi
Notify_kumulos
Notify_lametric
Notify_line
Notify_lunasea
Notify_macosx
Notify_mailgun
Notify_mastodon
Notify_matrix
Notify_mattermost
Notify_messagebird
Notify_misskey
Notify_mqtt
Notify_msg91
Notify_msteams
Notify_nexmo
Notify_nextcloud
Notify_nextcloudtalk
Notify_notica
Notify_notifiarr
Notify_notifico
Notify_ntfy
Notify_office365
Notify_onesignal
Notify_opsgenie
Notify_pagerduty
Notify_pagertree
Notify_parseplatform
Notify_plivo
Notify_popcornnotify
Notify_prowl
Notify_pushalot
Notify_pushbullet
Notify_pushdeer
Notify_pushed
Notify_pushjet
Notify_pushme
Notify_pushover
Notify_pushsafer
Notify_pushy
Notify_reddit
Notify_rocketchat
Notify_rsyslog
Notify_ryver
Notify_sendgrid
Notify_serverchan
Notify_ses
Notify_seven
Notify_sfr
Notify_signal
Notify_simplepush
Notify_sinch
Notify_slack
Notify_sms_manager
Notify_smseagle
Notify_smtp2go
Notify_sns
Notify_sparkpost
Notify_splunk
Notify_spontit
Notify_streamlabs
Notify_stride
Notify_synology_chat
Notify_syslog
Notify_techulus
Notify_telegram
Notify_threema
Notify_toasty
Notify_twilio
Notify_twist
Notify_twitter
Notify_voipms
Notify_wecombot
Notify_whatsapp
Notify_windows
Notify_workflows
Notify_wxpusher
Notify_wxteams
Notify_xbmc
Notify_xmpp
Notify_zulip
Sponsors
Troubleshooting
URLBasics
config
config_text
config_yaml
decorator_notify
persistent_storage
showcase
4
Notify_onesignal
Chris Caron edited this page 2024-07-28 08:35:42 -04:00
Table of Contents
OneSignal Notifications
- Source: https://onesignal.com
- Icon Support: Yes
- Message Format: Text
- Message Limit: 32768 Characters per Message
Account Setup
- Visit https://onesignal.com to create your account.
- To acquire your
{appid}
and{apikey}
Clic on the Keys and IDs.
Syntax
The syntax is as follows:
onesignal://{app_id}@{apikey}/#{include_segment}
onesignal://{app_id}@{apikey}/#{include_segment1}/#{include_segment2}/#{include_segmentN}
onesignal://{app_id}@{apikey}/{player_id}/
onesignal://{app_id}@{apikey}/{player_id1}/{player_id2}/{player_idN}
onesignal://{app_id}@{apikey}/@{user_id}/
onesignal://{app_id}@{apikey}/@{user_id1}/@{user_id2}/@{user_idN}
onesignal://{app_id}@{apikey}/{email}/
onesignal://{app_id}@{apikey}/{email1}/{email2}/{emailN}
You can also mix/match the targets:
onesignal://{app_id}@{apikey}/{email}/@{user_id}/#{include_segment}/{player_id}
If you defined a template with OneSignal, you can use it as well:
onesignal://{template_id}:{app_id}@{apikey}/#{include_segment}
onesignal://{template_id}:{app_id}@{apikey}/#{include_segment1}/#{include_segment2}/#{include_segmentN}
onesignal://{template_id}:{app_id}@{apikey}/{player_id}/
onesignal://{template_id}:{app_id}@{apikey}/{player_id1}/{player_id2}/{player_idN}
onesignal://{template_id}:{app_id}@{apikey}/@{user_id}/
onesignal://{template_id}:{app_id}@{apikey}/@{user_id1}/@{user_id2}/@{user_idN}
onesignal://{template_id}:{app_id}@{apikey}/{email}/
onesignal://{template_id}:{app_id}@{apikey}/{email1}/{email2}/{emailN}
Parameter Breakdown
Variable | Required | Description |
---|---|---|
app_id | Yes | This is the Application ID associated with your OneSignal account. |
apikey | Yes | This is the API Key associated with your OneSignal account. |
template_id | No | The UUID Template ID you wish to use |
player_id | No | A Player ID to notify |
user_id | No | A User ID to notify. Note: these must be prefixed with an @ symbol or it will be interpreted as a Player ID |
include_segment | No | An include segment. Note: these must be prefixed with an # symbol or it will be interpreted as a Player ID |
No | An email to notify. | |
subtitle | No | The subtitle of your push. Only appears on iOS devices. |
language | No | The 2 character language code to push your message as. By default this is set to en if not specified. |
image | No | to include the icon/image associated with the message. By default this is set to yes . |
batch | No | Set it to Yes if you want all identified targets to be notified notified in batches (instead of individually). By default this is set to No. |
Example
Send a OneSignal notification to all devices associated with a project:
# Assume:
# - our {app_id} is abc123
# - our {apikey} is a6k4ABnck26hDh8AA3EDHoOVdDEUlw3nty
# - our {player_id} is 3456-2345-a3ef
apprise -vv -t "Test Message Title" -b "Test Message Body" \
onesignal://abc123@a6k4ABnck26hDh8AA3EDHoOVdDEUlw3nty/3456-2345-a3ef
# Override the subtitle (Mac users only) by doing the following:
# You must use URL encoded strings, below the spaces are swapped with %20
apprise -vv -t "Test Message Title" -b "Test Message Body" \
onesignal://abc123@a6k4ABnck26hDh8AA3EDHoOVdDEUlw3nty/3456-2345-a3ef?subtitle=A%20Different%20Subtitle
Custom Data (Templates)
Making use of the :
on the Apprise URL allows you to alter and add to the payload of your onesignal post.
# As an example:
apprise -vv -b "Test Message Body" \
"onesignal://credentials/?:key1=value1"
The above would additional these assignments into the payload as `custom_data':
{
... previous payload elements... and then:
"custom_data": {"key1": "value1"}
}
Data
Making use of the +
on the Apprise URL allows you to alter and add to the payload of your onesignal post.
# As an example:
apprise -vv -b "Test Message Body" \
"onesignal://credentials/?+key1=value1"
The above would additional these assignments into the payload as `data':
{
... previous payload elements... and then:
"data": {"key1": "value1"}
}