## Example JSON Payloads

Visits HistoricalVisits DepartureVisits ArrivalGeofence ExitGeofence EnterGeofence Dwell

```json
{
    "userId": "{String}",
    "context": {
        "traits": {},
        "localeactions": "en",
        "device": {
            "advertisingId": "{String}"
        }
    },
    "event": "placeHistorical",
    "properties": {
        "visitType": "historical",
        "probability": "{Double}",
        "confidence": "{String}",
        "lat": "{Double}",
        "lng": "{Double}",
        "locationType": "{String}",
        "visitId": "{String}",
        "timestamp": "{YYYY-MM-DDTHH:MM:SS.XXXZ}",
        "venueName": "{String}",
        "venueId": "{String}",
        "primaryCategoryName": "{String}",
        "primaryCategoryId": "{String}",
        "primaryChainName": "{String}",
        "primaryChainID": "{String}",
        "address": "{String}",
        "crossStreet": "{String}",
        "city": "{String}",
        "state": "{String}",
        "zipCode": "{String}",
        "country": "{String}",
        "supervenueId": "{String}",
        "supervenueName": "{String}",
        "supervenuePrimaryCategoryId": "{String}",
        "supervenuePrimaryCategoryName": "{String}",
        "supervenuePrimaryChainId": "{String}",
        "supervenuePrimaryChainName": "{String}"
    },
    "type": "track"
}
```

```json
{
    "EventDefinitionKey": "pilgrimArrivalEntrySource",
    "ContactKey": "{String}",
    "Data": {
        "visitType": "departure",
        "confidence": "{ConfidenceLevel}",
        "lat": "{lat}",
        "lng": "{long}",
        "locationType": "venue",
        "visitId": "{VisitID}",
        "timestamp": "{Timestamp}",
        "venueName": "{VenueName}",
        "venueId": "{VenueID}",
        "primaryCategoryName": "{PrimaryCategoryName}",
        "primaryCategoryId": "{PrimaryCategoryID}",
        "address": "{Address}",
        "crossStreet": "{Cross Street}",
        "city": "{CityName}",
        "state": "{StateCode}",
        "zipCode": "{ZipCode}",
        "country": "{CountryCode}",
        "ContactKey": "{String}",
        "userId": "{String}"
    }
}
```

```json
{
    "EventDefinitionKey": "pilgrimArrivalEntrySource",
    "ContactKey": "{String}",
    "Data": {
        "visitType": "arrival",
        "confidence": "{ConfidenceLevel}",
        "lat": "{lat}",
        "lng": "{long}",
        "locationType": "venue",
        "visitId": "{VisitID}",
        "timestamp": "{Timestamp}",
        "venueName": "{VenueName}",
        "venueId": "{VenueID}",
        "primaryCategoryName": "{PrimaryCategoryName}",
        "primaryCategoryId": "{PrimaryCategoryID}",
        "address": "{Address}",
        "crossStreet": "{Cross Street}",
        "city": "{CityName}",
        "state": "{StateCode}",
        "zipCode": "{ZipCode}",
        "country": "{CountryCode}",
        "ContactKey": "{String}",
        "userId": "{String}"
    }
}
```

```json
{
    "EventDefinitionKey": "pilgrimArrivalEntrySource",
    "ContactKey": "{String}",
    "Data": {
        "geofenceEventType": "exit",
        "geofenceLat": "{Double}",
        "geofenceLng": "{Double}",
        "radius": "{Double}",
        "venueId": "{String}",
        "categoryIds": "{String}",
        "venueChainIds": "{String}",
        "partnerVenueId": "{String}",
        "eventLat": "{Double}",
        "eventLng": "{Double}",
        "geofenceId": "{String}",
        "geofenceName": "{String}",
        "geofenceProperties": {},
        "ContactKey": "{String}",
        "userId": "{String}"
    }
}
```

```json
{
    "userId": "{String}",
    "eventName": "geofenceEnter",
    "createdAt": 1646691428,
    "dataFields": {
        "geofenceEventType": "entrance",
        "geofenceLat": "{Double}",
        "geofenceLng": "{Double}",
        "radius": "{Double}",
        "venueId": "{String}",
        "categoryIds": "{String}",
        "venueChainIds": "{String}",
        "partnerVenueId": "{String}",
        "eventLat": "{Double}",
        "eventLng": "{Double}",
        "geofenceId": "{String}",
        "geofenceName": "{String}"
    }
}
```

```json
{
    "userId": "{String}",
    "eventName": "geofenceDwell",
    "createdAt": 1646691515,
    "dataFields": {
        "geofenceEventType": "dwell",
        "geofenceLat": "{Double}",
        "geofenceLng": "{Double}",
        "radius": "{Double}",
        "venueId": "{String}",
        "categoryIds": "{String}",
        "venueChainIds": "{String}",
        "partnerVenueId": "{String}",
        "eventLat": "{Double}",
        "eventLng": "{Double}",
        "geofenceId": "{String}",
        "geofenceName": "{String}"
    }
}
```

## Integration Details

1. Make sure both **OneSignal** and the **Movement SDK** are properly setup.
2. In order to properly map your OneSignal users to Foursquare, you will need to:
   - Associate your own User Ids to each of their corresponding OneSignal device records via the **external_user_id**.
   - Set the associated OneSignal `external_user_id`s by using the `setUserId method` of `UserInfo` in the Movement SDK.
3. Enter your **OneSignal App ID** in to your app's **Foursquare Developer Console**.
4. Once you have configured the Developer Console, the Movement SDK will automatically track location events and forward them to OneSignal, allowing you to retarget and segment your customers.
