# Freshsales

[Freshsales](https://www.freshworks.com/crm) is a CRM and is part of the broader Freshwork suite. With Freshpaint and Freshsales together, you can sync users in Freshpaint to contacts and leads in Freshsales.

## Destination Information

* Accepts [track](https://documentation.freshpaint.io/sources/precision-tracking) and [identify](https://documentation.freshpaint.io/readme/setting-up-identify) calls.
* Connection Modes:

<table><thead><tr><th width="100" align="right"> </th><th data-type="checkbox">Client-side</th><th data-type="checkbox">Server-side</th></tr></thead><tbody><tr><td align="right">Web</td><td>false</td><td>true</td></tr><tr><td align="right">Mobile</td><td>false</td><td>true</td></tr><tr><td align="right">Server</td><td>false</td><td>true</td></tr></tbody></table>

## Getting Started

To set up the Freshsales integration, do the following steps:

1. Go to Freshsales and navigate to Settings > API Settings.&#x20;

   <figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FiXwmsMYvDkE66CIu9Dlh%2FPasted%20Graphic%2075.png?alt=media&#x26;token=a208fd09-98aa-478a-b7af-0ececd395ff8" alt=""><figcaption></figcaption></figure>
2. Copy and paste your API Key, along with your Freshsales subdomain into Freshpaint. Your Subdomain is the part of the URL before myfreshworks.com.
3. If you are using Freshsales Classic (October 2020 and previous), check the Freshsales Classic option.
4. [Enable](https://documentation.freshpaint.io/readme/setting-up-your-destinations/enabling-and-disabling-a-destination) the destination.&#x20;

## Identify

When you call [freshpaint.identify](https://documentation.freshpaint.io/developer/freshpaint-sdk-reference#identify), Freshpaint will create or update either a lead or a contact in Freshsales by calling their leads[ API endpoint](https://developer.freshsales.io/api/#leads) at: https\:/\<yourdomainhere>/crm/sales/api/leads/upsert or by calling their contacts API endpoint at: https\:/\<yourdomainhere>/crm/sales/api/contacts/upsert.

{% hint style="info" %}
In order for Freshsales to properly merge users together, you must use `email` as your user identifier in Freshpaint.
{% endhint %}

If you are using Freshsales Classic (October 2020 and previous), by default, Freshpaint will create users as leads. If you would like to create users as contacts instead pass the property:

```
fs_contact: true
```

{% hint style="warning" %}
If you are using the newer version of Freshsales (post October 2020), it does not have a separate concept of leads. You will need to pass in `"fs_contact": true` in order for the contact to be created in Freshsales.
{% endhint %}

Any user properties passed to Freshpaint will be mapped to the corresponding Freshsales property with the same builtin name. You can see a list of the properties Freshsales supports for [leads here](https://developer.freshsales.io/api/#leads) and for [contacts here](https://developer.freshsales.io/api/#contacts).

<figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2Fdc6CEZW8viUhJGVCIgpZ%2FPasted%20Graphic.png?alt=media&#x26;token=3812d616-e908-415e-9773-5493f791e570" alt=""><figcaption></figcaption></figure>

You can read more about identifying contacts and leads in Freshsales [here](https://developers.freshworks.com/crm/libraries/spec/identify/).

## Events

When you send an event to Freshsales, Freshpaint will create a sales activity in Freshsales by calling their [sales activity API ](https://developers.freshworks.com/crm/api/#create_sales_activity)endpoint at: /api/sales\_activities

You can view your sales activities by going to Settings > Manage Sales Activities

<figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FTcJxcTn1jesNTpgbSk3Q%2Fimage.png?alt=media&#x26;token=270f0b8c-1146-48ae-8ec8-dca5c98e597a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FNC5IJXN305qXr4OuV0Yn%2Fimage.png?alt=media&#x26;token=88311a0a-7294-4e84-a636-2caf2debda50" alt=""><figcaption></figcaption></figure>

Events sent to Freshsales will show up as sales activities under your contact. In order for an event to show up as a sales activity, Freshsales needs a few things:

### Sales Activity Type ID

Events must have one of the following:

1\. The event has a `"sales_activity_type_id": <number>` property corresponding to one of the default sales activity types or a custom sales activity type you've created in your account. Note the value must be a number.

OR

2\. The name of the event must match the internal name of a sales activity type.

{% hint style="warning" %}
Freshsales is unable to process events that do not have a sales activity type provided in one of these two ways
{% endhint %}

See Freshsales' documentation for more about [sales activity types](https://support.freshsales.io/en/support/solutions/articles/230199-how-to-configure-different-sales-activities-in-freshsales-).

### User identity (email address)

In order for Freshsales to properly associate the sales activity with a user in Freshsales, you must first identify the user with the email of the user.

{% hint style="warning" %}
Freshsales is unable to process events that are not associated with users identified by an email address.
{% endhint %}

If you are using an older version of Freshsales (October 2020 and previous), by default, Freshpaint will attach the sales activity to a lead with the user's email. If you add the property `"fs_contact": true` as an event property and Freshpaint will attach the event to a contact with the user's email instead.&#x20;

If you are using a newer version of Freshsales, there is only the concept of contacts - you must add the property`"fs_contact": true` as an event property in order for a contact to be created.

## Configuration Options

### Connection Mode Settings

Only server-side connection mode is available for this destination. All events will be sent to Freshsales using Freshpaint's servers. Your website will not send data directly to Freshsales.&#x20;

### Event Transformations

Set up transformations to modify your data before it's sent to your destination. Read more about transformations [here](https://documentation.freshpaint.io/data-management/transformations).

<figure><img src="https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MA7aDqsXMFbUsWVqonF%2Fuploads%2FK6WG04hQZD1IMAfQFSjA%2Fimage.png?alt=media&#x26;token=ca652fec-4467-4521-9c88-cc347cf20479" alt=""><figcaption></figcaption></figure>
