Skip to main content

OneSignal

Radar can send tags to and trigger notifications in OneSignal. You can create notifications triggered by tag changes.

Use the OneSignal integration to send location-triggered and location-targeted messages to increase engagement and conversion.

Configuration#

On the OneSignal Settings page under Keys & IDs, copy your REST API key.

Then, on the Radar Integrations page under OneSignal, set Enabled to Yes and paste your API key. Note that you can set separate API keys for the Test and Live environments.

Whenever events are generated, Radar will call the edit device API and set tags in OneSignal. You can create notifications triggered by tag changes.

By default, Radar userId and deviceId do not map to OneSignal. To map users in Radar to devices in OneSignal, you must send the OneSignal player ID to Radar by setting metadata.oneSignalPlayerId. For example, on iOS:

let playerId = OneSignal.getPermissionSubscriptionState().subscriptionStatus.userIdRadar.setMetadata(["oneSignalPlayerId": playerId])

On Android:

String playerId = OneSignal.getPermissionSubscriptionState().getSubscriptionStatus().getUserId();JSONObject metadata = new JSONObject();metadata.put("oneSignalPlayerId",playerId);Radar.setMetadata(metadata);

Event mapping#

Because OneSignal does not support associating custom events with a user, the most recent event types triggered from a location update are sent as a comma-separated list under the Onesignal tag radar_events. For example, if a user has exited a geofence and entered a place, the value for the radar_events tag would be exited_geofence,entered_place.

Radar EventContext TypeOnesignal Tag Value
user.entered_geofenceGeofencesentered_geofence
user.exited_geofenceGeofencesexited_geofence
user.dwelled_in_geofenceGeofencesdwelled_in_geofence
user.entered_placePlacesplace_entered
user.exited_placePlacesplace_exited
user.entered_region_countryRegionsentered_region_country
user.exited_region_countryRegionsexited_region_country
user.entered_region_stateRegionsentered_region_state
user.exited_region_stateRegionsexited_region_state
user.entered_region_dmaRegionsentered_region_dma
user.exited_region_dmaRegionsexited_region_dma
user.started_tripTripsstarted_trip
user.updated_tripTripsupdated_trip
user.approaching_trip_destinationTripsapproaching_trip_destination
user.arrived_at_trip_destinationTripsarrived_at_trip_destination
user.stopped_tripTripsstopped_trip
user.entered_beaconBeaconsentered_beacon
user.exited_beaconBeaconsexited_beacon

User mapping#

Radar User FieldOneSignal Tag NameTypeExample TagContext Type
location.coordinates[1]latnumber39.525665
location.coordinates[0]longnumber-76.350663
locationAuthorizationradar_location_authorizationstring"GRANTED_FOREGROUND"
locationAccuracyAuthorizationradar_location_accuracy_authorizationstring"FULL"
segments[*].externalIdradar_segment_external_idsstring (comma-separated)"starbucks-visitors"
topChains[*].slugradar_top_chain_slugsstring (comma-separated)"starbucks"
topChains[*].externalIdradar_top_chain_external_idsstring (comma-separated)"123"
geofences[*]._idradar_geofence_idsstring (comma-separated)"5b2c0906f5874b001aecfd8e"Geofences
geofences[*].descriptionradar_geofence_descriptionsstring (comma-separated)"Store #123"Geofences
geofences[*].tagradar_geofence_tagsstring (comma-separated)"store"Geofences
geofences[*].externalIdradar_geofence_external_idsstring (comma-separated)"123"Geofences
place._idradar_place_idstring"59302bcf8f27e8a156bd4f91"Places
place.nameradar_place_namestring"Starbucks"Places
place.categoriesradar_place_categoriesstring"coffee-shop"Places
place.chain.slugradar_place_chain_slugstring"starbucks"Places
place.chain.nameradar_place_chain_namestring"Starbucks"Places
country.coderadar_region_country_codestring"US"Regions
country.nameradar_region_country_namestring"United States"Regions
state.coderadar_region_state_codestring"MD"Regions
state.nameradar_region_state_namestring"Maryland"Regions
dma.coderadar_region_dma_codestring"26"Regions
dma.nameradar_region_dma_namestring"Baltimore"Regions
postalCode.coderadar_region_postal_codestring"21014"Regions
trip.externalIdradar_trip_external_idstring"123"Trip tracking
trip.destinationGeofenceTagradar_trip_destination_geofence_tagstring"store"Trip tracking
trip.destinationGeofenceExternalIdradar_trip_destination_geofence_external_idstring"123"Trip tracking
trip.approachedradar_trip_approachedbooleantrueTrip tracking
trip.arrivedradar_trip_arrivedbooleanfalseTrip tracking
beacons[*]._idradar_beacon_idsstring (comma-separated)"5b2c0906f5874b001aecfd8f"Beacons
beacons[*].descriptionradar_beacon_descriptionsstring (comma-separated)"Store #123 - Drive-Thru"Beacons
beacons[*].tagradar_beacon_tagsstring (comma-separated)"drive-thru"Beacons
beacons[*].externalIdradar_beacon_external_idsstring (comma-separated)"123"Beacons