# How can we help?

## Overview

Cordial seamlessly connects to [mParticle](https://www.mparticle.com/), empowering you to get the most out of your data. With our bi-directional integration, you can easily stream all of your data in and out of Cordial in real time.

mParticle streams Cordial's real-time contact, behavioral, and eCommerce event data from brand properties, also providing audiences and profile enrichment. Cordial uses mParticle’s data—combined with other business data—to quickly build compelling messaging and create meaningful engagement across channels.

You can [learn how to send data from Cordial to mParticle here](https://support.cordial.com/hc/en-us/articles/4700779825549).

## Enable mParticle as a source

To send data from mParticle to Cordial, you need to enable mParticle as a source.

1. Log in to Cordial and navigate to **Integrations > Partners**.

2. Locate the mParticle card and click **Enable**.

## Configure identifiers

1. To configure identifier mapping for inbound and outbound data, click **Configure** in the **Identifier Mapping** pane.

2. Select the **mParticle Identifier** you want to use, which can be either customer ID or email, and the corresponding **Cordial Identifier** (customer ID).

3. Click **Continue**.

## Configure attributes

1. To configure attributes between Cordial and mParticle, select **Edit** in the **Attribute Mapping** pane.

2. Select the attributes you want to pass to mParticle from the **Outbound Attributes** dropdown.

3. Map mParticle keys to your Cordial attributes using the **Select mParticle Attribute** and **Select Cordial Attribute** dropdowns.

4. Click **Continue**.

## Scriptable API

Our scriptable API offers asynchronous methods for sending data from mParticle to Cordial. This allows you to stream data, send multiple API requests at the same time, and have more precise control over how Cordial interacts with mParticle.

You can [use Swagger to access and test our scriptable API offerings](https://integrations-ingest-svc.cordial.com/docs#/). In order to do so, you'll need an API key.

- [Visit this article to learn how to create an API key from within Cordial](https://support.cordial.com/hc/en-us/articles/115005365087-API-Keys).

### Supported actions

- [POST/mparticle/moduleRegistration](https://support.cordial.com/hc/en-us/articles/9136941752717-Send-data-from-mParticle-to-Cordial#h_01H1CGTR9DG0G41E6D2YA442ZP)
- [POST/mparticle/eventProcessing](https://support.cordial.com/hc/en-us/articles/9136941752717-Send-data-from-mParticle-to-Cordial#h_01H1YX9VB55Z1TKM49JWGQ1VWQ)
- [POST/mparticle/audienceMembershipChange](https://support.cordial.com/hc/en-us/articles/9136941752717-Send-data-from-mParticle-to-Cordial#h_01H2663VW939SCPD9N9C3ARYBY)
- [POST/mparticle/audienceSubscription](https://support.cordial.com/hc/en-us/articles/9136941752717-Send-data-from-mParticle-to-Cordial#h_01H2664G7Z46H81H4XPWJ3VHHC)

### POST/mparticle/moduleRegistration

| Method | URI path |
| --- | --- |
| POST | mparticle/moduleRegistration |
| Update module registration status in real time. |  |

- [Parameters](https://support.cordial.com/hc/en-us/articles/9136941752717-Send-data-from-mParticle-to-Cordial#zp-1-0)
- [Example JSON request](https://support.cordial.com/hc/en-us/articles/9136941752717-Send-data-from-mParticle-to-Cordial#zp-1-1)

* Required

| Parameters | Type | Description | Example |
| --- | --- | --- | --- |
| *type | string | Type of registration update. | See example request. |
| *id | string | Customer ID. | See example request. |
| *timestamp_ms | number | Time of request. | See example request. |
| *firehose_version | string | Version of firehose used. | See example request. |

```json
{
  "type": "module_registration_request",
  "id": "e91ec0c6-69f3-4dae-b1a1-b0c29f27ba6e",
  "timestamp_ms": 1644244051358,
  "firehose_version": "2.8.0"
}
```

### POST/mparticle/eventProcessing

| Method | URI path |
| --- | --- |
| POST | mparticle/eventProcessing |
| Process events in real time. |  |

- [Parameters](https://support.cordial.com/hc/en-us/articles/9136941752717-Send-data-from-mParticle-to-Cordial#zp-2-0)
- [Example JSON request](https://support.cordial.com/hc/en-us/articles/9136941752717-Send-data-from-mParticle-to-Cordial#zp-2-1)

* Required

| Parameters | Type | Description | Example |
| --- | --- | --- | --- |
| *type | string | Type of event request to process. | See example request. |
| *id | string | Customer ID. | See example request. |
| *timestamp_ms | number | Time of request. | See example request. |
| *fireshose_version | string | Version of firehose used. | See example request. |
| source_id | string | Unique source identification. | See example request. |
| account | object | Account ID and settings. Schema:<br>- account_id<br>- account_settings<br>  - string<br>  - boolean<br>  - number<br>  - apiKey | See example request. |
| partner_identities | array | Partner identification properties. Schema:<br>- type<br>- encoding<br>- value | See example request. |
| user_identities | object | User identities across platforms. Schema:<br>- type<br>- encoding<br>- value | See example request. |
| user_attributes | array | Contact attributes. Example schema:<br>- $City<br>- $FirstName<br>- $Country<br>- $State<br>- $Zip<br>- $Gender<br>- $LastName | See example request. |
| runtime_environment | object | Device information. | See example request. |
| events | object | Specific event details including type, id, timestamp, source, name, etc. | See example request. |
| mpid | string | mParticle ID. | See example request. |

```json
{
  "type": "event_processing_request",
  "id": "e4d2dc7d-6970-4149-9ed7-9ac32022668b",
  "timestamp_ms": 1644244051356,
  "firehose_version": "2.8.0",
  "source_id": "a2037396-6b0a-4182-961d-0c058b405786",
  "account": {
    "account_id": 123456,
    "account_settings": {
      "Example String Setting": "Example Setting Value",
      "Example Boolean Setting": "false",
      "Example Integer Setting": "123",
      "apiKey": "sample API Key"
    }
  },
  "partner_identities": [
    {
      "type": "a_partner_id",
      "encoding": "raw",
      "value": "partnerId"
    }
  ],
  "user_identities": [
    {
      "type": "email",
      "encoding": "md5",
      "value": "e179e95c00e7718ab4a23840f992ea63"
    },
    {
      "type": "google",
      "encoding": "raw",
      "value": "1234567890"
    },
    {
      "type": "facebook",
      "encoding": "raw",
      "value": "1234567890"
    },
    {
      "type": "other",
      "encoding": "raw",
      "value": "1234567890"
    },
    {
      "type": "customer",
      "encoding": "md5",
      "value": "4739c5c11d833bb199c16ff95a92b267"
    }
  ],
  "user_attributes": {
    "$City": "Boca Raton",
    "$FirstName": "Brian",
    "$Country": "USA",
    "$State": "FL",
    "$Zip": "33431",
    "$Gender": "M",
    "$LastName": "O'Brian"
  },
  "runtime_environment": {
    "type": "android",
    "client_ip_address": "192.168.1.15",
    "sdk_version": "6.12.1",
    "http_header_user_agent": "user-agent",
    "identities": [
      {
        "type": "android_id",
        "encoding": "raw",
        "value": "a0504a8cfa15ce2c"
      },
      {
        "type": "google_advertising_id",
        "encoding": "raw",
        "value": "31a22ef0-f119-48d4-b009-a217a26a862a"
      },
      {
        "type": "google_cloud_messaging_token",
        "encoding": "raw",
        "value": "1234567890"
      }
    ],
    "build_id": "M4=rc20",
    "brand": "Samsung",
    "product": "Galaxy S3",
    "name": "My Galaxy S3",
    "manufacturer": "Samsung",
    "os_version": "4.1.1",
    "model": "Galaxy S3",
    "screen_height": 736,
    "screen_width": 1280,
    "screen_dpi": 160,
    "country": "US",
    "locale_language": "en",
    "locale_country": "en_US",
    "network_country": "US",
    "network_carrier": "Verizon",
    "network_code": "MobileNetworkCode",
    "network_mobile_country_code": "MobileCountryCode",
    "timezone_offset": -5,
    "timezone_name": "UTC-5",
    "is_tablet": false,
    "android_sdk_level": 0,
    "application_name": "App Name",
    "application_version": "1.2.001-dbg",
    "application_package": "com.mparticle.TravelApp",
    "install_referrer": "utm_source%3Dgoogle%26utm_medium%3Dcpc%26utm_term%3Drunning%252Bshoes%26utm_content%3Dlogolink%26utm_campaign%3Dspring_sale"
  },
  "events": [
    {
      "type": "custom_event",
      "id": "6957b85a-b0df-4cce-8b26-b64d38eebaec",
      "timestamp_ms": 1644244051349,
      "source_id": "f0fb3db6-0b98-4135-931b-06c2b20aac9e",
      "session_id": 123456789,
      "location": {
        "latitude": 47.6062,
        "longitude": 122.3231,
        "accuracy": 0
      },
      "name": "customEvent",
      "custom_event_type": "other",
      "attributes": {
        "event_attribute": "value"
      }
    },
    {
      "type": "product_action",
      "id": "aa3dfffd-6906-4097-b23c-f04881d3c31d",
      "timestamp_ms": 1644244051349,
      "source_id": "920c59b9-e722-4e36-a8a8-3f60857aa98b",
      "session_id": 123456789,
      "action": "add_to_cart",
      "transaction_id": "transactionId",
      "total_amount": 11,
      "tax_amount": 1,
      "shipping_amount": 0,
      "currency_code": "USD",
      "coupon_code": "coupon",
      "products": [
        {
          "id": "id",
          "name": "name",
          "brand": "brand",
          "category": "category",
          "variant": "variant",
          "position": 1,
          "price": 10,
          "quantity": 1,
          "total_amount": 10
        }
      ],
      "attributes": {
        "event_attribute": "value"
      }
    }
  ],
  "source_channel": "native",
  "device_application_stamp": "33ebfefa-bf9e-485f-8a03-e8149da91f1d",
  "consent_state": {
    "gdpr_consent_state": {
      "consentPurpose": {
        "consented": true,
        "document": "document",
        "timestamp_unixtime_ms": 1644244051349,
        "location": "location",
        "hardware_id": "hardware id"
      }
    },
    "ccpa_consent_state": {
      "data_sale_opt_out": {
        "consented": true,
        "document": "document",
        "timestamp_unixtime_ms": 1644244051349,
        "location": "location",
        "hardware_id": "hardware id"
      }
    }
  },
  "system_notifications": [
    {
      "type": "gdpr_consent_state",
      "purpose": "consentPurpose",
      "old_gdpr_consent_state": {
        "consented": false,
        "document": "document",
        "timestamp_unixtime_ms": 1644244051349,
        "location": "location",
        "hardware_id": "hardware id"
      },
      "new_gdpr_consent_state": {
        "consented": true,
        "document": "document",
        "timestamp_unixtime_ms": 1644244051349,
        "location": "location",
        "hardware_id": "hardware id"
      }
    },
    {
      "type": "ccpa_consent_state",
      "purpose": "data_sale_opt_out",
      "old_ccpa_consent_state": {
        "consented": false,
        "document": "document",
        "timestamp_unixtime_ms": 1644244051349,
        "location": "location",
        "hardware_id": "hardware id"
      },
      "new_ccpa_consent_state": {
        "consented": true,
        "document": "document",
        "timestamp_unixtime_ms": 1644244051349,
        "location": "location",
        "hardware_id": "hardware id"
      }
    }
  ],
  "mpid": "12345"
}
```

### POST/mparticle/audienceMembershipChange

| Method | URI path |
| --- | --- |
| POST | mparticle/audienceMembershipChange |
| Change contacts' audience membership status in real time. |  |

- [Parameters](https://support.cordial.com/hc/en-us/articles/9136941752717-Send-data-from-mParticle-to-Cordial#zp-3-0)
- [Example JSON request](https://support.cordial.com/hc/en-us/articles/9136941752717-Send-data-from-mParticle-to-Cordial#zp-3-1)

* Required

| Parameters | Type | Description | Example |
| --- | --- | --- | --- |
| *type | string | Type of membership update to process. | See example request. |
| *id | string | Customer ID. | See example request. |
| *timestamp_ms | number | Time of update. | See example request. |
| *fireshose_version | string | Version of firehose used. | See example request. |
| account | object | Account ID and settings. Schema:<br>- account_id<br>- account_settings<br>  - string<br>  - boolean<br>  - integer | See example request. |
| user_profiles | object | Contact information, including audience membership status and device ID. Example schema:<br>- user_identities<br>- device_identities<br>- partner_identities<br>- audiences | See example request. |

```json
{
  "type": "audience_membership_change_request",
  "id": "9d76a904-b5cf-4eb1-b8b5-ae8302d3f4fc",
  "timestamp_ms": 1644244051343,
  "firehose_version": "2.8.0",
  "account": {
    "account_id": 123456,
    "account_settings": {
      "Example String Setting": "Example Setting Value",
      "Example Boolean Setting": "false",
      "Example Integer Setting": "123"
    }
  },
  "user_profiles": [
    {
      "user_identities": [
        {
          "type": "email",
          "encoding": "md5",
          "value": "e179e95c00e7718ab4a23840f992ea63"
        },
        {
          "type": "customer",
          "encoding": "md5",
          "value": "4739c5c11d833bb199c16ff95a92b267"
        }
      ],
      "device_identities": [
        {
          "type": "ios_advertising_id",
          "encoding": "raw",
          "value": "66b728c2-f9a4-4d87-82ef-ce07414fe3f7"
        },
        {
          "type": "ios_vendor_id",
          "encoding": "raw",
          "value": "97b826c2-ab80-4876-a184-db36cc39b1ee"
        },
        {
          "type": "google_advertising_id",
          "encoding": "raw",
          "value": "31a22ef0-f119-48d4-b009-a217a26a862a"
        },
        {
          "type": "android_id",
          "encoding": "raw",
          "value": "a0504a8cfa15ce2c"
        }
      ],
      "partner_identities": [
        {
          "type": "partner_id",
          "encoding": "raw",
          "value": "partnerId"
        }
      ],
      "audiences": [
        {
          "audience_id": 456,
          "audience_name": "Example Audience Name",
          "audience_subscription_settings": {
            "Example Audience-specific setting": "Example Value"
          },
          "action": "add"
        },
        {
          "audience_id": 789,
          "audience_name": "Example Audience Name 2",
          "audience_subscription_settings": {
            "Example Audience-specific setting": "Example Value 2"
          },
          "action": "attribute_update",
          "user_attributes": [
            {
              "key": "Some Key",
              "value": "9999999",
              "action": "upsert"
            },
            {
              "key": "Churned",
              "action": "delete"
            },
            []
          ]
        },
        {
          "audience_id": 654,
          "audience_name": "Example Audience Name 4",
          "audience_subscription_settings": {
            "Example Audience-specific setting": "Example Value 4"
          },
          "action": "delete"
        }
      ],
      "mpid": "12345"
    }
  ]
}
```

### POST/mparticle/audienceSubscription

| Method | URI path |
| --- | --- |
| POST | mparticle/audienceSubscription |
| Change contacts' subscription status in real time. |  |

- [Parameters](https://support.cordial.com/hc/en-us/articles/9136941752717-Send-data-from-mParticle-to-Cordial#zp-4-0)
- [Example JSON request](https://support.cordial.com/hc/en-us/articles/9136941752717-Send-data-from-mParticle-to-Cordial#zp-4-1)

* Required

| Parameters | Type | Description | Example |
| --- | --- | --- | --- |
| *type | string | Type of membership update to process. | See example request. |
| *id | string | Customer ID. | See example request. |
| *timestamp_ms | number | Time of update. | See example request. |
| *fireshose_version | string | Version of firehose used. | See example request. |
| account | object | Account ID and settings. Schema:<br>- account_id<br>- account_settings<br>  - string<br>  - boolean<br>  - integer<br>  - apiKey | See example request. |
| audience_id | integer | Audience ID. | See example request. |
| audience_name | string | Name of audience. | See example request. |
| action | string | Subscription action, such as add. | See example request. |

```json
{
  "type": "audience_subscription_request",
  "id": "8c820e89-3e34-48c7-affc-7bd87f7a1e28",
  "timestamp_ms": 1644244051347,
  "firehose_version": "2.8.0",
  "account": {
    "account_id": 123456,
    "account_settings": {
      "Example String Setting": "Example Setting Value",
      "Example Boolean Setting": "false",
      "Example Integer Setting": "123",
      "apiKey": "sample API Key"
    }
  },
  "audience_id": 1234,
  "audience_name": "New Users Low Engagement",
  "action": "add"
}
```
