# Sprig Cloud Mode Integration

RudderStack lets you send your event data to Sprig via [cloud mode]({{< ref "destinations/rudderstack-connection-modes.md#cloud-mode" >}}).

Find the open source code for this destination in the [GitHub repository](https://github.com/rudderlabs/rudder-transformer/tree/main/src/cdk/v2/destinations/sprig).

## Identify

You can use the [`identify`]({{< ref "event-spec/standard-events/identify.md" >}}) call to create a user in Sprig.

A sample `identify` call is shown:

```javascript
rudderanalytics.identify('1hKOmRA4GRlm', {
  firstName: 'Alex',
  lastName: 'Keener',
  email: "alex@example.com"
});
```

### Traits mapping

RudderStack maps the following user attributes in the `identify` events to the corresponding Sprig fields:

| RudderStack property | Sprig property |
| :----| :-----|
| `userId` <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span> | `userId` |
| `email` | `emailAddress` | 
| `context.traits` | `attributes` |

### Deleting a user

You can delete a user in Sprig using the [Suppression with Delete regulation]({{< ref "api/user-suppression-api/_index.md#adding-a-suppression-with-delete-regulation" >}}) of RudderStack's [User Suppression API]({{< ref "api/user-suppression-api/_index.md" >}}). 

{{< info >}}
To delete a user, you must specify their `userId` and the [Sprig API key]({{< ref "destinations/streaming-destinations/sprig/setup.md#connection-settings" >}}) in the event.
{{< /info >}}

A sample regulation request body for deleting a user in Intercom is shown below:

```json
{
  "regulationType": "suppress_with_delete",
  "destinationIds": [
    "2FIKkByqn37FhzczP23eZmURciA"
  ],
  "users": [{
    "userId": "1hKOmRA4GRlm",
    "apiKey": "<your_sprig_apiKey>"
  }]
}
```

See the [Destinations]({{< ref "dashboard-guides/destinations.md#destination-details" >}}) guide for more information on obtaining the `destinationId`.

## Track

The [`track`]({{< ref "event-spec/standard-events/track.md" >}}) call lets you record any user events along with the associated properties and send the information to Sprig.

A sample `track` call is shown:

```javascript
rudderanalytics.track('Signup', {
  firstName: "Alex",
  lastName: "Keener",
  email: "alex@example.com"
});
```

### Property mapping

RudderStack maps the following event properties in the `track` events to the corresponding Sprig fields:

| RudderStack property | Sprig property |
| :----| :-----|
| `userId` <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span> | `userId` |
| `event` <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span>| `events[0].event` |
| `timestamp` <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span>| `events[0].timestamp` |
| `email` | `emailAddress` | 

<br />
