> ## Documentation Index
> Fetch the complete documentation index at: https://radarlabs-rob-onesignal-api-migration.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Salesforce Marketing Cloud

<Info>
  The Salesforce Marketing Cloud integration is available on the [**Enterprise plan**](https://radar.com/pricing).
</Info>

Radar can send events to [Salesforce Marketing Cloud](https://www.salesforce.com/products/marketing-cloud/overview/) to trigger journeys in *Journey Builder*.

Use the Salesforce Marketing Cloud integration to send location-triggered messages to increase engagement and conversion.

## Configuration

On the Salesforce Marketing Cloud *Setup* menu, under *Installed Packages*, click *New*. Add an installed package with the name *Radar*. On the package details page, add an *API Integration* component with the *Server-to-Server* integration type and all permissions for the *Automation*, *Contacts*, *Cross Cloud Platform*, and *Data* scopes. Copy your *Client ID*, *Client Secret*, *Authentication Base URI*, and *REST Base URI*.

Then, on the Radar [Integrations page](https://dashboard.radar.com/integrations#salesforce) under *Salesforce Marketing Cloud*, set *Enabled* to *Yes* and paste these values. When you click *Save*, Radar will create an event definition and data extension with the specified event definition key (`radar-event` by default). Whenever events are generated, Radar will send events to your Salesforce Marketing Cloud data extension to trigger journeys.

In Salesforce Marketing Cloud's *Contact Builder*, under *Data Designer*, connect the Radar data extension to your data model by linking the Customer Data's *Contact Key* field to the Radar Data Extension's *contactKey* field in a one to many relationship.

To map a Radar user to a Salesforce Marketing Cloud contact, you must specify a custom mapping by setting Radar `metadata.salesforceContactKey`.

<CodeGroup>
  ```swift Swift theme={null}
  let contactKey = SFMCSdk.mp.contactKey()
  Radar.setMetadata(["salesforceContactKey": contactKey])
  ```

  ```kotlin Kotlin theme={null}
  SFMCSdk.requestSdk { sdk ->
      sdk.mp {
          val contactKey = it.moduleIdentity.profileId
          Radar.setMetadata(JSONObject().put("salesforceContactKey",contactKey))
      }
  }
  ```
</CodeGroup>

## Verify integration data delivery

To test that the integration is configured correctly and can deliver data, use the [Simulator](https://dashboard.radar.com/geofencing/simulate) to generate events. Click *View* on an event row and scroll down to the *Logs* section on the details page to verify delivery. Perform a similar process via a test app build with Radar location tracking enabled by spoofing location or moving into the relevant boundary.

<img src="https://mintcdn.com/radarlabs-rob-onesignal-api-migration/i8UFp_2vvLJvgYzo/images/salesforce-verify-integration.gif?s=f7a9f4663999c78b0b8d2b46ebec45b0" alt="Salesforce Verify Integration Gi" width="1582" height="780" data-path="images/salesforce-verify-integration.gif" />

Additionally, check the Radar data extension in Salesforce's *Contact Builder* to verify records are delivering.

All integration delivery can be monitored via the integration's event logs by clicking *View event logs* on the [Integrations page](https://dashboard.radar.com/integrations#salesforce).

## Example use cases

### Send a personalized push notification when a user arrives at a store[#](#send-a-personalized-push-notification-when-a-user-arrives-at-a-store)

1. Create [Geofences](/geofencing/geofences#create-geofences) in Radar with the geofence tag set to `store`. The geofence tag will be used to trigger messages for the subset of geofence entries where this tag is present.
2. Create a Salesforce Journey triggered by an API Event from the Radar data extension. The Radar data extension will be filtered on `user.entered_geofence` as the `type` attribute and `store` as the `geofenceTag` attribute.

<img src="https://mintcdn.com/radarlabs-rob-onesignal-api-migration/i8UFp_2vvLJvgYzo/images/salesforce-radar-triggered-message.png?fit=max&auto=format&n=i8UFp_2vvLJvgYzo&q=85&s=3c5bbc877f50cb9189ddab0ff5ca819f" alt="Salesforce Radar Triggered Message Pn" width="3840" height="1956" data-path="images/salesforce-radar-triggered-message.png" />

### Message all users who have been nearby a store

1. Create [Geofences](/geofencing/geofences#create-geofences) in Radar to represent nearby store boundaries with geofence tag set to `nearby-store`. The geofence tag will be used to target messages for the subset of geofences where this tag has been present on an event in the last 7 days.
2. Create a Salesforce Mobile List filtered on the Radar data extension attributes of `type` equal to `user.entered_geofence`, `geofenceTag` equal to `nearby` and `createdAt` set to the last 7 days.
3. Create a Salesforce MobilePush Message with audience targeting set to the Salesforce Mobile List created in the step above.

<img src="https://mintcdn.com/radarlabs-rob-onesignal-api-migration/i8UFp_2vvLJvgYzo/images/salesforce-message-all-users.png?fit=max&auto=format&n=i8UFp_2vvLJvgYzo&q=85&s=68dab0bcdf31943e26873284a0e76123" alt="Salesforce Message All Users Pn" width="3840" height="1954" data-path="images/salesforce-message-all-users.png" />

## Event mapping

### user.entered\_geofence

| Radar Event Field      | Salesforce Event Attribute | Type                      | Example                      |
| ---------------------- | -------------------------- | ------------------------- | ---------------------------- |
| `type`                 | `type`                     | string                    | `"user.entered_geofence"`    |
| `user.userId`          | `userUserId`               | string (max length 100)   | `"1"`                        |
| `user.deviceId`        | `userDeviceId`             | string (max length 100)   | `"10974a2ee035770b9"`        |
| `geofence._id`         | `geofenceId`               | string                    | `"5b2c0906f5874b001aecfd8e"` |
| `geofence.description` | `geofenceDescription`      | string (max length 100)   | `"Store #123"`               |
| `geofence.tag`         | `geofenceTag`              | string (max length 100)   | `"store"`                    |
| `geofence.externalId`  | `geofenceExternalId`       | string (max length 100)   | `"123"`                      |
| `geofence.metadata`    | `geofenceMetadata`         | string (max length 4,000) | `'{"parking":false}'`        |
| `confidence`           | `confidence`               | string                    | `"high"`                     |
| `foreground`           | `foreground`               | boolean                   | `true`                       |

If [Regions](/geofencing/regions) is enabled, Radar will also send the following attributes:

| Radar Event Field | Salesforce Event Attribute | Type   | Example           |
| ----------------- | -------------------------- | ------ | ----------------- |
| `country.code`    | `countryCode`              | string | `"US"`            |
| `country.name`    | `countryName`              | string | `"United States"` |
| `state.code`      | `stateCode`                | string | `"MD"`            |
| `state.name`      | `stateName`                | string | `"Maryland"`      |
| `dma.code`        | `dmaCode`                  | string | `"26"`            |
| `dma.name`        | `dmaName`                  | string | `"Baltimore"`     |
| `postalCode.code` | `postalCode`               | string | `"21014"`         |

### user.exited\_geofence

| Radar Event Field      | Salesforce Event Attribute | Type                      | Example                      |
| ---------------------- | -------------------------- | ------------------------- | ---------------------------- |
| `type`                 | `type`                     | string                    | `"user.exited_geofence"`     |
| `user.userId`          | `userUserId`               | string (max length 100)   | `"1"`                        |
| `user.deviceId`        | `userDeviceId`             | string (max length 100)   | `"10974a2ee035770b9"`        |
| `geofence._id`         | `geofenceId`               | string                    | `"5b2c0906f5874b001aecfd8e"` |
| `geofence.description` | `geofenceDescription`      | string (max length 100)   | `"Store #123"`               |
| `geofence.tag`         | `geofenceTag`              | string (max length 100)   | `"store"`                    |
| `geofence.externalId`  | `geofenceExternalId`       | string (max length 100)   | `"123"`                      |
| `geofence.metadata`    | `geofenceMetadata`         | string (max length 4,000) | `'{"parking":false}'`        |
| `confidence`           | `confidence`               | string                    | `"high"`                     |
| `duration`             | `duration`                 | number (minutes)          | `42.1``foreground`           |
| `foreground`           | `foreground`               | boolean                   | `true`                       |

If [Regions](/geofencing/regions) is enabled, Radar will also send the following attributes:

| Radar Event Field | Salesforce Event Attribute | Type   | Example           |
| ----------------- | -------------------------- | ------ | ----------------- |
| `country.code`    | `countryCode`              | string | `"US"`            |
| `country.name`    | `countryName`              | string | `"United States"` |
| `state.code`      | `stateCode`                | string | `"MD"`            |
| `state.name`      | `stateName`                | string | `"Maryland"`      |
| `dma.code`        | `dmaCode`                  | string | `"26"`            |
| `dma.name`        | `dmaName`                  | string | `"Baltimore"`     |
| `postalCode.code` | `postalCode`               | string | `"21014"`         |

### user.dwelled\_in\_geofence

| Radar Event Field      | Salesforce Event Attribute | Type                      | Example                      |
| ---------------------- | -------------------------- | ------------------------- | ---------------------------- |
| `type`                 | `type`                     | string                    | `"user.exited_geofence"`     |
| `user.userId`          | `userUserId`               | string (max length 100)   | `"1"`                        |
| `user.deviceId`        | `userDeviceId`             | string (max length 100)   | `"10974a2ee035770b9"`        |
| `geofence._id`         | `geofenceId`               | string                    | `"5b2c0906f5874b001aecfd8e"` |
| `geofence.description` | `geofenceDescription`      | string (max length 100)   | `"Store #123"`               |
| `geofence.tag`         | `geofenceTag`              | string (max length 100)   | `"store"`                    |
| `geofence.externalId`  | `geofenceExternalId`       | string (max length 100)   | `"123"`                      |
| `geofence.metadata`    | `geofenceMetadata`         | string (max length 4,000) | `'{"parking":false}'`        |
| `confidence`           | `confidence`               | string                    | `"high"`                     |
| `duration`             | `duration`                 | number (minutes)          | `5`                          |
| `foreground`           | `foreground`               | boolean                   | `true`                       |

If [Regions](/geofencing/regions) is enabled, Radar will also send the following attributes:

| Radar Event Field | Salesforce Event Attribute | Type   | Example           |
| ----------------- | -------------------------- | ------ | ----------------- |
| `country.code`    | `countryCode`              | string | `"US"`            |
| `country.name`    | `countryName`              | string | `"United States"` |
| `state.code`      | `stateCode`                | string | `"MD"`            |
| `state.name`      | `stateName`                | string | `"Maryland"`      |
| `dma.code`        | `dmaCode`                  | string | `"26"`            |
| `dma.name`        | `dmaName`                  | string | `"Baltimore"`     |
| `postalCode.code` | `postalCode`               | string | `"21014"`         |

### user.entered\_place

| Radar Event Field      | Salesforce Event Attribute | Type                      | Example                            |
| ---------------------- | -------------------------- | ------------------------- | ---------------------------------- |
| `type`                 | `type`                     | string                    | `"user.entered_place"`             |
| `user.userId`          | `userUserId`               | string (max length 100)   | `"1"`                              |
| `user.deviceId`        | `userDeviceId`             | string (max length 100)   | `"10974a2ee035770b9"`              |
| `place._id`            | `placeId`                  | string                    | `"59302bcf8f27e8a156bd4f91"`       |
| `place.name`           | `placeName`                | string                    | `"Starbucks"`                      |
| `place.chain.slug`     | `placeChainSlug`           | string                    | `"starbucks"`                      |
| `place.chain.name`     | `placeChainName`           | string                    | `"Starbucks"`                      |
| `place.chain.metadata` | `placeChainMetadata`       | string (max length 4,000) | `'{"parking":false}'`              |
| `place.categories`     | `placeCategories`          | string (comma-separated)  | `"food-beverage,cafe,coffee-shop"` |
| `confidence`           | `confidence`               | string                    | `"high"`                           |
| `foreground`           | `foreground`               | boolean                   | `true`                             |

If [Regions](/geofencing/regions) is enabled, Radar will also send the following attributes:

| Radar Event Field | Salesforce Event Attribute | Type   | Example           |
| ----------------- | -------------------------- | ------ | ----------------- |
| `country.code`    | `countryCode`              | string | `"US"`            |
| `country.name`    | `countryName`              | string | `"United States"` |
| `state.code`      | `stateCode`                | string | `"MD"`            |
| `state.name`      | `stateName`                | string | `"Maryland"`      |
| `dma.code`        | `dmaCode`                  | string | `"26"`            |
| `dma.name`        | `dmaName`                  | string | `"Baltimore"`     |
| `postalCode.code` | `postalCode`               | string | `"21014"`         |

### user.exited\_place

| Radar Event Field      | Salesforce Event Attribute | Type                      | Example                            |
| ---------------------- | -------------------------- | ------------------------- | ---------------------------------- |
| `type`                 | `type`                     | string                    | `"user.exited_place"`              |
| `user.userId`          | `userUserId`               | string (max length 100)   | `"1"`                              |
| `user.deviceId`        | `userDeviceId`             | string (max length 100)   | `"10974a2ee035770b9"`              |
| `place._id`            | `placeId`                  | string                    | `"59302bcf8f27e8a156bd4f91"`       |
| `place.name`           | `placeName`                | string                    | `"Starbucks"`                      |
| `place.chain.slug`     | `placeChainSlug`           | string                    | `"starbucks"`                      |
| `place.chain.name`     | `placeChainName`           | string                    | `"Starbucks"`                      |
| `place.chain.metadata` | `placeChainMetadata`       | string (max length 4,000) | `'{"parking":false}'`              |
| `place.categories`     | `placeCategories`          | string (comma-separated)  | `"food-beverage,cafe,coffee-shop"` |
| `confidence`           | `confidence`               | string                    | `"high"`                           |
| `duration`             | `duration`                 | number (minutes)          | `42.1`                             |
| `foreground`           | `foreground`               | boolean                   | `true`                             |

If [Regions](/geofencing/regions) is enabled, Radar will also send the following attributes:

| Radar Event Field | Salesforce Event Attribute | Type   | Example           |
| ----------------- | -------------------------- | ------ | ----------------- |
| `country.code`    | `countryCode`              | string | `"US"`            |
| `country.name`    | `countryName`              | string | `"United States"` |
| `state.code`      | `stateCode`                | string | `"MD"`            |
| `state.name`      | `stateName`                | string | `"Maryland"`      |
| `dma.code`        | `dmaCode`                  | string | `"26"`            |
| `dma.name`        | `dmaName`                  | string | `"Baltimore"`     |
| `postalCode.code` | `postalCode`               | string | `"21014"`         |

### user.entered\_region\_country

| Radar Event Field | Salesforce Event Attribute | Type    | Example Value                   |
| ----------------- | -------------------------- | ------- | ------------------------------- |
| `type`            | `type`                     | string  | `"user.entered_region_country"` |
| `user.userId`     | `userUserId`               | string  | `"1"`                           |
| `user.deviceId`   | `userDeviceId`             | string  | `"10974a2ee035770b9"`           |
| `region.code`     | `regionCode`               | string  | `"US"`                          |
| `region.name`     | `regionName`               | string  | `"United States"`               |
| `confidence`      | `confidence`               | string  | `"high"`                        |
| `foreground`      | `foreground`               | boolean | `true`                          |

### user.exited\_region\_country

| Radar Event Field | Salesforce Event Attribute | Type    | Example Value                  |
| ----------------- | -------------------------- | ------- | ------------------------------ |
| `type`            | `type`                     | string  | `"user.exited_region_country"` |
| `user.userId`     | `userUserId`               | string  | `"1"`                          |
| `user.deviceId`   | `userDeviceId`             | string  | `"10974a2ee035770b9"`          |
| `region.code`     | `regionCode`               | string  | `"US"`                         |
| `region.name`     | `regionName`               | string  | `"United States"`              |
| `confidence`      | `confidence`               | string  | `"high"`                       |
| `foreground`      | `foreground`               | boolean | `true`                         |

### user.entered\_region\_state

| Radar Event Field | Salesforce Event Attribute | Type    | Example Value                 |
| ----------------- | -------------------------- | ------- | ----------------------------- |
| `type`            | `type`                     | string  | `"user.entered_region_state"` |
| `user.userId`     | `userUserId`               | string  | `"1"`                         |
| `user.deviceId`   | `userDeviceId`             | string  | `"10974a2ee035770b9"`         |
| `region.code`     | `regionCode`               | string  | `"MD"`                        |
| `region.name`     | `regionName`               | string  | `"Maryland"`                  |
| `confidence`      | `confidence`               | string  | `"high"`                      |
| `foreground`      | `foreground`               | boolean | `true`                        |

### user.exited\_region\_state

| Radar Event Field | Salesforce Event Attribute | Type    | Example Value                |
| ----------------- | -------------------------- | ------- | ---------------------------- |
| `type`            | `type`                     | string  | `"user.exited_region_state"` |
| `user.userId`     | `userUserId`               | string  | `"1"`                        |
| `user.deviceId`   | `userDeviceId`             | string  | `"10974a2ee035770b9"`        |
| `region.code`     | `regionCode`               | string  | `"MD"`                       |
| `region.name`     | `regionName`               | string  | `"Maryland"`                 |
| `confidence`      | `confidence`               | string  | `"high"`                     |
| `foreground`      | `foreground`               | boolean | `true`                       |

### user.entered\_region\_dma

| Radar Event Field | Salesforce Event Attribute | Type    | Example Value               |
| ----------------- | -------------------------- | ------- | --------------------------- |
| `type`            | `type`                     | string  | `"user.entered_region_dma"` |
| `user.userId`     | `userUserId`               | string  | `"1"`                       |
| `user.deviceId`   | `userDeviceId`             | string  | `"10974a2ee035770b9"`       |
| `region.code`     | `regionCode`               | string  | `"26"`                      |
| `region.name`     | `regionName`               | string  | `"Baltimore"`               |
| `confidence`      | `confidence`               | string  | `"high"`                    |
| `foreground`      | `foreground`               | boolean | `true`                      |

### user.exited\_region\_dma

| Radar Event Field | Salesforce Event Attribute | Type    | Example Value              |
| ----------------- | -------------------------- | ------- | -------------------------- |
| `type`            | `type`                     | string  | `"user.exited_region_dma"` |
| `user.userId`     | `userUserId`               | string  | `"1"`                      |
| `user.deviceId`   | `userDeviceId`             | string  | `"10974a2ee035770b9"`      |
| `region.code`     | `regionCode`               | string  | `"26"`                     |
| `region.name`     | `regionName`               | string  | `"Baltimore"`              |
| `confidence`      | `confidence`               | string  | `"high"`                   |
| `foreground`      | `foreground`               | boolean | `true`                     |

### user.started\_trip

| Radar Event Attribute                | Salesforce Event Attribute          | Type                      | Example Value                         |
| ------------------------------------ | ----------------------------------- | ------------------------- | ------------------------------------- |
| `trip.externalId`                    | `tripExternalId`                    | string (max length 100)   | `"299"`                               |
| `trip.metadata`                      | `tripMetadata`                      | string (max length 4,000) | `'{"Car Model":"Green Honda Civic"}'` |
| `trip.destinationGeofenceTag`        | `tripDestinationGeofenceTag`        | string (max length 100)   | `"store"`                             |
| `trip.destinationGeofenceExternalId` | `tripDestinationGeofenceExternalId` | string (max length 100)   | `"123"`                               |
| `foreground`                         | `foreground`                        | boolean                   | `true`                                |

### user.updated\_trip

| Radar Event Attribute                | Salesforce Event Attribute          | Type                      | Example Value                         |
| ------------------------------------ | ----------------------------------- | ------------------------- | ------------------------------------- |
| `trip.externalId`                    | `tripExternalId`                    | string (max length 100)   | `"299"`                               |
| `trip.metadata`                      | `tripMetadata`                      | string (max length 4,000) | `'{"Car Model":"Green Honda Civic"}'` |
| `trip.destinationGeofenceTag`        | `tripDestinationGeofenceTag`        | string (max length 100)   | `"store"`                             |
| `trip.destinationGeofenceExternalId` | `tripDestinationGeofenceExternalId` | string (max length 100)   | `"123"`                               |
| `foreground`                         | `foreground`                        | boolean                   | `true`                                |

### user.approaching\_trip\_destination

| Radar Event Attribute                | Salesforce Event Attribute          | Type                      | Example Value                         |
| ------------------------------------ | ----------------------------------- | ------------------------- | ------------------------------------- |
| `trip.externalId`                    | `tripExternalId`                    | string (max length 100)   | `"299"`                               |
| `trip.metadata`                      | `tripMetadata`                      | string (max length 4,000) | `'{"Car Model":"Green Honda Civic"}'` |
| `trip.destinationGeofenceTag`        | `tripDestinationGeofenceTag`        | string (max length 100)   | `"store"`                             |
| `trip.destinationGeofenceExternalId` | `tripDestinationGeofenceExternalId` | string (max length 100)   | `"123"`                               |
| `foreground`                         | `foreground`                        | boolean                   | `true`                                |

### user.arrived\_at\_trip\_destination

| Radar Event Attribute                | Salesforce Event Attribute          | Type                      | Example Value                         |
| ------------------------------------ | ----------------------------------- | ------------------------- | ------------------------------------- |
| `trip.externalId`                    | `tripExternalId`                    | string (max length 100)   | `"299"`                               |
| `trip.metadata`                      | `tripMetadata`                      | string (max length 4,000) | `'{"Car Model":"Green Honda Civic"}'` |
| `trip.destinationGeofenceTag`        | `tripDestinationGeofenceTag`        | string (max length 100)   | `"store"`                             |
| `trip.destinationGeofenceExternalId` | `tripDestinationGeofenceExternalId` | string (max length 100)   | `"123"`                               |
| `foreground`                         | `foreground`                        | boolean                   | `true`                                |

### user.stopped\_trip

| Radar Event Attribute                | Salesforce Event Attribute          | Type                      | Example Value                         |
| ------------------------------------ | ----------------------------------- | ------------------------- | ------------------------------------- |
| `trip.externalId`                    | `tripExternalId`                    | string (max length 100)   | `"299"`                               |
| `trip.metadata`                      | `tripMetadata`                      | string (max length 4,000) | `'{"Car Model":"Green Honda Civic"}'` |
| `trip.destinationGeofenceTag`        | `tripDestinationGeofenceTag`        | string (max length 100)   | `"store"`                             |
| `trip.destinationGeofenceExternalId` | `tripDestinationGeofenceExternalId` | string (max length 100)   | `"123"`                               |
| `foreground`                         | `foreground`                        | boolean                   | `true`                                |

### user.entered\_beacon

| Radar Event Attribute | Salesforce Event Attribute | Type                      | Example Value                |
| --------------------- | -------------------------- | ------------------------- | ---------------------------- |
| `beacon._id`          | `beaconId`                 | string                    | `"5b2c0906f5874b001aecfd8f"` |
| `beacon.description`  | `beaconDescription`        | string (max length 100)   | `"Store #123 - Drive-Thru"`  |
| `beacon.tag`          | `beaconTag`                | string (max length 100)   | `"drive-thru"`               |
| `beacon.externalId`   | `beaconExternalId`         | string (max length 100)   | `"123"`                      |
| `beacon.metadata`     | `beaconMetadata`           | string (max length 4,000) | `'{"type":"parking"}'`       |
| `confidence`          | `confidence`               | string                    | `"high"`                     |
| `foreground`          | `foreground`               | boolean                   | `true`                       |

### user.exited\_beacon

| Radar Event Attribute | Salesforce Event Attribute | Type                      | Example Value                |
| --------------------- | -------------------------- | ------------------------- | ---------------------------- |
| `beacon._id`          | `beaconId`                 | string                    | `"5b2c0906f5874b001aecfd8f"` |
| `beacon.description`  | `beaconDescription`        | string (max length 100)   | `"Store #123 - Drive-Thru"`  |
| `beacon.tag`          | `beaconTag`                | string (max length 100)   | `"drive-thru"`               |
| `beacon.externalId`   | `beaconExternalId`         | string (max length 100)   | `"123"`                      |
| `beacon.metadata`     | `beaconMetadata`           | string (max length 4,000) | `'{"type":"parking"}'`       |
| `confidence`          | `confidence`               | string                    | `"high"`                     |
| `duration`            | `duration`                 | number (minutes)          | `1.42`                       |
| `foreground`          | `foreground`               | boolean                   | `true`                       |
