Source: https://developers.woosmap.com/products/geofencing-sdk/integration/marketing-cloud/

> For clean Markdown of any page, append `.md` to the page URL.

> For a complete documentation index, see https://developers.woosmap.com/llms.txt

# Marketing Cloud integration



Woosmap Geofencing SDK can send events to [Salesforce Marketing Cloud](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/get-started-index.html) from different context types:
Geofences, POI, Visits and ZOI.

Whenever location events trigger, you can send custom events with associated properties to your App via a listener
method. Your App can then pass them to Salesforce Marketing Cloud. 

## Marketing Cloud Integration

To push event data to the Salesforce Marketing Cloud API, and [trigger an Entry Event](https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/how-to-fire-an-event.htm)
, subscribe to SDK callbacks and implement API calls in it, or simply initialize the Marketing Cloud connector to let
the Geofencing SDK run API call to push event data.

### Initialize the Marketing Cloud connector

The SDK needs some input like credentials and object key to perform the API call to Salesforce Marketing Cloud API.

**Input to initialize the SFMC connector**

| Parameters                             | Description                                                                                               | Required |
| -------------------------------------- | --------------------------------------------------------------------------------------------------------- | -------- |
| `authenticationBaseURI`                  | Authentication Base URI                                                                                   | Required |
| `restBaseURI`                            | REST Base URI                                                                                             | Required |
| `client_id`                             | `client_id` (`journey_read` and `list_and_subscribers_read` rights are required)                           | Required |
| `client_secret`                         | `client_secret` (`journey_read` and `list_and_subscribers_read` rights are required)                       | Required |
| `contactKey`                             | The ID that uniquely identifies a subscriber/contact                                                      | Required |
| `regionEnteredEventDefinitionKey`        | `EventDefinitionKey` for the Woosmap event `woos_geofence_entered_event`       |          |
| `regionExitedEventDefinitionKey`         | `EventDefinitionKey` for the Woosmap event `woos_geofence_exited_event`        |          |
| `poiEventDefinitionKey`                  | `EventDefinitionKey` for the Woosmap event `woos_POI_event`                    |          |
| `zoiClassifiedEnteredEventDefinitionKey` | `EventDefinitionKey` for the Woosmap event `woos_zoi_classified_entered_event` |          |
| `zoiClassifiedExitedEventDefinitionKey`  | `EventDefinitionKey` for the Woosmap event `woos_zoi_classified_exited_event`  |          |
| `visitEventDefinitionKey`                | `EventDefinitionKey` for the Woosmap event `woos_Visit_event`                  |

**Android - Initialize the connector implementation**
``` java
HashMap<String, String> SFMCInfo = new HashMap<String, String>();

SFMCInfo.put("authenticationBaseURI","https://mcdmfc5rbyc0pxgr4nlpqqy0j-x1.auth.marketingcloudapis.com");
SFMCInfo.put("restBaseURI","https://mcdmfc5rbyc0pxgr4nlpqqy0j-x1.rest.marketingcloudapis.com");
SFMCInfo.put("client_id", "xxxxxxxxxxxxxxx");
SFMCInfo.put("client_secret", "xxxxxxxxxxxxxxx");
SFMCInfo.put("contactKey","ID001");
SFMCInfo.put("regionEnteredEventDefinitionKey","APIEvent-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
SFMCInfo.put("regionExitedEventDefinitionKey","APIEvent-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");

WoosmapSettings.SFMCCredentials = SFMCInfo;
```

**iOS - Initialize the connector implementation**
```swift
WoosmapGeofenceManager.shared.setSFMCCredentials(credentials : [ 
      "authenticationBaseURI": "https://mcdmfc5rbyc0pxgr4nlpqqy0j-x1.auth.marketingcloudapis.com",
      "restBaseURI": "https://mcdmfc5rbyc0pxgr4nlpqqy0j-x1.rest.marketingcloudapis.com",
      "client_id": "xxxxxxxxxxxxxxx",
      "client_secret": "xxxxxxxxxxxxx",
      "contactKey":"ID001",
      "regionEnteredEventDefinitionKey":"APIEvent-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "regionExitedEventDefinitionKey":"APIEvent-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
])
```

## Send Marketing Cloud

### Geofences Events

- Enter eventName: `woos_geofence_entered_event`
- Exit eventName: `woos_geofence_exited_event`

**Event data specification**

| Field name                       | Type   | Only if the region is a POI |
| -------------------------------- | ------ | --------------------------- |
| `date`                             | Datetime  |                             |
| `id`                               | String |                             |
| `latitude`                         | Double |                             |
| `longitude`                        | Double |                             |
| `radius`                           | Double |                             |
| `name`                             | String | X                           |
| `idStore`                          | String | X                           |
| `city`                             | String | X                           |
| `zipCode`                          | String | X                           |
| `country_code`                    | String | X                           |
| `address`                          | String | X                           |
| `tags`                             | String | X                           |
| `types`                            | String | X                           |
| `user_properties.[field_name]` | String | X                           |

### POI Events

- eventName: `woos_POI_event`

**Event data specification**

| Field name                       | Type   |
| -------------------------------- | ------ |
| `date`                             | Datetime   |
| `name`                             | String |
| `idStore`                          | String |
| `city`                             | String |
| `zipCode`                          | String |
| `distance`                         | String |
| `country_code`                    | String |
| `address`                          | String |
| `tags`                             | String |
| `types`                            | String |
| `user_properties.[field_name]` | String |

### Visits Events

- eventName: `woos_Visit_event`

**Event data specification**

| Field name                       | Type   |
| -------------------------------- | ------ |
| `date`                             | Datetime   |
| `arrivalDate`                             | String |
| `departureDate`                          | String |
| `id`                             | String |
| `latitude`                          | String |
| `longitude`                         | String |

### ZOI Events

- Enter eventName: `woos_zoi_classified_entered_event`
- Exit eventName: `woos_zoi_classified_exited_event`

**Event data specification**

| Field name                       | Type   |
| -------------------------------- | ------ |
| `date`                             | Datetime   |
| `id`                             | String |
| `latitude`                          | Double |
| `longitude`                         | Double |
| `radius`                         | Double |
