> For the complete documentation index, see [llms.txt](https://docs.customerglu.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.customerglu.com/third-party-integrations/send-user-events.md).

# Source

Various methods of sending user events to CustomerGlu for completion of activity based campaigns

## Sending Events directly from Server

The following API can be used to send user events directly from your server

## Sending events from server to server

<mark style="color:green;">`POST`</mark> `https://events.customerglu.com/server/v4`

Sending events using server side integration

#### Headers

| Name                                           | Type   | Description                               |
| ---------------------------------------------- | ------ | ----------------------------------------- |
| X-API-KEY<mark style="color:red;">\*</mark>    | string | \<Write- Key provided by the CustomerGlu> |
| Content-type<mark style="color:red;">\*</mark> | string | application/json                          |

#### Request Body

| Name                                                | Type   | Description                                                                     |
| --------------------------------------------------- | ------ | ------------------------------------------------------------------------------- |
| event\_id<mark style="color:red;">\*</mark>         | string | Unique identifier for the event                                                 |
| event\_properties<mark style="color:red;">\*</mark> | object | Key-value pair of event properties (send empty object in case of no properties) |
| event\_name<mark style="color:red;">\*</mark>       | string | Name of the event                                                               |
| timestamp<mark style="color:red;">\*</mark>         | string | ISO Format Timestamp for the event (UTC is recommended)                         |
| user\_id<mark style="color:red;">\*</mark>          | string | UserId of the user, registered with CG, performing the activity                 |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
To guarantee quick response times, request validations are done at a later stage in the pipeline.&#x20;

Please ensure that all the required fields (marked with '\*') are present in the request payload. Failure to do the same might result in the events not being processed inspite of a success response.
{% endhint %}

## Segment

To send events from segment, set up a webhook for your destination.&#x20;

**Create a new Destination of type "Webhook"**

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FrpZRm48OvFqnkzdn4H1S%2Fimage.png?alt=media&amp;token=a7523f8e-69d4-4fe1-8a7c-47fad45013f4" alt=""><figcaption></figcaption></figure>

**Configure Webhook (Actions)**

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FibQmz95zk5diO5X2mguD%2Fimage.png?alt=media&amp;token=4a725065-9359-4ff1-9089-734ea0b4ecd4" alt=""><figcaption></figcaption></figure>

**Select the source of data to be sent to CustomerGlu**

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FFOFEZVG1PVVGfmmxRDQ6%2Fimage.png?alt=media&amp;token=de92ab86-5709-40fa-9339-8ae4c459d630" alt=""><figcaption></figcaption></figure>

**Set up a name for the webhook**

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2F9PemtkNcZiKKWqFV1MgK%2Fimage.png?alt=media&amp;token=e7b19a3f-0b41-4278-8773-4a0183ffe82a" alt=""><figcaption></figcaption></figure>

**Add mapping to the Webhook**

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FWpnaoTRi0H8LhNQXqveO%2Fimage.png?alt=media&amp;token=05a5761a-1add-4ecb-91c7-2f86159d54f8" alt=""><figcaption></figcaption></figure>

**Select which events to Forward to CustomerGlu**

Choose only the events which are required for Segmentation and completion of Activities in CustomerGlu campaigns.&#x20;

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2F2pfi9zwi9Qklg7EpkjXQ%2Fimage.png?alt=media&amp;token=90716b26-4808-4390-93ba-ef4c91158ecc" alt=""><figcaption></figcaption></figure>

#### Add test event

Load test event from source

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FihsVzllxgJaFNbsGk8ei%2Fimage.png?alt=media&amp;token=869132ed-a10b-454c-b0c1-05935b73f419" alt=""><figcaption></figcaption></figure>

**Configure the webhook request mapping**

* Add the webhook endpoint
* Select batch size as 1
* Add your API Key in the headers with the key name "X-API-KEY"
* Save the webhook

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2Flfvlih0QDUncObKEkxG5%2Fimage.png?alt=media&amp;token=29ece975-3a86-4a15-a8ec-c6578be38bfa" alt=""><figcaption></figcaption></figure>

## Sending events from moengage

<mark style="color:green;">`POST`</mark> `https://events.customerglu.com/segment/v4`

#### Headers

| Name                                        | Type   | Description                      |
| ------------------------------------------- | ------ | -------------------------------- |
| X-API-KEY<mark style="color:red;">\*</mark> | String | WriteKey provided by customerGlu |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Moengage

In order to start sending events from MoEngage to CustomerGlu, MoEngage streams can be used.\
[MoEngage documentation](https://help.moengage.com/hc/en-us/articles/360045896572-MoEngage-Streams#enabling-streams-for-your-account-0-2)

## Sending events from moengage

<mark style="color:green;">`POST`</mark> `https://stream.customerglu.com/v3/moengage`

#### Headers

| Name                                        | Type   | Description                      |
| ------------------------------------------- | ------ | -------------------------------- |
| X-API-KEY<mark style="color:red;">\*</mark> | String | WriteKey provided by customerGlu |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Amplitude <a href="#amplitude" id="amplitude"></a>

You can set up a webhook on Amplitude to forward specific user events to CustomerGlu.

[Check out docs](https://amplitude.com/docs/data/destination-catalog/webhooks)

### Sending Events from Amplitude

**Headers**

| Name                                        | Type   | Description                      |
| ------------------------------------------- | ------ | -------------------------------- |
| X-API-KEY<mark style="color:red;">\*</mark> | String | WriteKey provided by customerGlu |

### Set Up and Activate Your Webhook Integration

1. Login to your Amplitude account and navigate to **Data.**

<div align="center" data-full-width="true"><figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FcBQnj37aRirttwCD5J9R%2FScreenshot%202024-06-25%20at%2012.47.22%E2%80%AFAM.png?alt=media&amp;token=16d8912a-0bd3-43ce-891e-80274c3f3bec" alt="" width="563"><figcaption></figcaption></figure></div>

2. Navigate to **Destinations** and click on **Add Destination**

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FCIgsF2d4gwL4svaBo8dn%2FScreenshot%202024-06-25%20at%2012.51.51%E2%80%AFAM.png?alt=media&amp;token=6bbfb45a-ef8e-42db-881b-99606509ced1" alt="" width="563"><figcaption></figcaption></figure>

3. Search for **Webhook** and click on **Webhook**.

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FVwmbjUv3cbVVqaRB4ax7%2FScreenshot%202024-06-25%20at%2012.53.33%E2%80%AFAM.png?alt=media&amp;token=4552189f-0085-4d8c-a9a4-93ae2dc3263b" alt="" width="563"><figcaption></figcaption></figure>

4. Please provide a relevant **Sync Name**.

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FGj6LR3Rlhw2CONWYchC2%2FScreenshot%202024-06-25%20at%2012.06.33%E2%80%AFPM.png?alt=media&amp;token=1eb6ee71-12e4-420f-83c9-7a7fd468af18" alt="" width="563"><figcaption></figcaption></figure>

5. Log in to **CustomerGlu**, click on the **Dev Console**.

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FsZJEtITlnICcSDqL2PwB%2FScreenshot%202024-06-25%20at%2012.09.39%E2%80%AFPM.png?alt=media&amp;token=98599856-0bb4-4668-9593-4f61aeffa8bb" alt="" width="563"><figcaption></figcaption></figure>

6. Click on **Amplitude** Integration.

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FRtSWmqsyKh4F32LfISxE%2FScreenshot%202024-06-25%20at%2012.17.28%E2%80%AFPM.png?alt=media&amp;token=c9cae139-4785-44a7-b895-060623a2bec1" alt="" width="563"><figcaption></figcaption></figure>

7. Here you will find your **Webhook URL** and **headers**.

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FB8f48MN08yO9TUGdT1BB%2FScreenshot%202024-06-25%20at%2012.58.33%E2%80%AFAM.png?alt=media&amp;token=6d14d785-44ff-44c4-a607-158e15c3deeb" alt="" width="563"><figcaption></figcaption></figure>

8. Enter your **Webhook URL** and **headers**, then click on Test **Connection**.

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FL4O776m4zAtFVCFDJYdj%2FScreenshot%202024-06-25%20at%2012.24.45%E2%80%AFPM.png?alt=media&amp;token=0e4b2ae7-4306-425f-9133-92cf95d2dc14" alt="" width="563"><figcaption></figcaption></figure>

9. Click on **Send Test Events** and you will see a confirmation message. Then click on **Finish** and save your destination.

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FNvISmMnzpr5xZW33H1By%2FScreenshot%202024-06-25%20at%201.10.37%E2%80%AFAM.png?alt=media&amp;token=8cd3c8ad-7366-4396-9ba1-c8c634cc0092" alt="" width="563"><figcaption></figcaption></figure>

## CleverTap

You can set up a webhook on CleverTap to forward specific user events to CustomerGlu.

**Configure CustomerGlu Endpoint as a Webhook on Clevertap**

[Check out docs](https://docs.clevertap.com/docs/setup-webhooks)

## Sending events from clevertap

<mark style="color:green;">`POST`</mark> `https://events.customerglu.com/clevertap/v4`

#### Headers

| Name                                        | Type   | Description                      |
| ------------------------------------------- | ------ | -------------------------------- |
| X-API-KEY<mark style="color:red;">\*</mark> | String | WriteKey provided by customerGlu |

{% tabs %}
{% tab title="200 " %}

{% endtab %}
{% endtabs %}

#### **Create and Launch a Webhook Campaign**&#x20;

[Check out Docs](https://docs.clevertap.com/docs/create-message-webhook#broadcast-message)

1. Create a new Webhook Campaign

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FZDf68BwXUVa63gbbkld5%2Fimage.png?alt=media&amp;token=9ab30501-8a34-42ce-b8d3-f81e6552cb71" alt=""><figcaption></figcaption></figure>

2. Select "Live Behavior" as the qualification Criteria

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2F83QV3h7LqMbjfwn8Qk5q%2Fimage.png?alt=media&amp;token=539f1c24-bc16-4545-af14-f2cda94ce8ea" alt=""><figcaption></figcaption></figure>

3. Select the already configured CustomerGlu Webhook Endpoint

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2Fc341OpHCNtW7tmiEZgjT%2Fimage.png?alt=media&amp;token=e5877a2a-df39-49cd-9c32-2c62482e816b" alt=""><figcaption></figcaption></figure>

4. Select the events that need to be passed to CustomerGlu

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FJNgtdZr9EBO6UcVpP6bE%2Fimage.png?alt=media&amp;token=c64e84e8-c715-48c0-9c12-ad774348cab2" alt=""><figcaption></figcaption></figure>

5. Configure the event names and properties that CustomerGlu will receive and expect for any segmentation/campaign related settings.  [Liquid Tags](https://docs.clevertap.com/docs/liquid-tags) can be used for configuring the values.

<figure><img src="https://1004846827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0ahLW2WavtwcwNbSR9%2Fuploads%2FeXx1bCXzwMRyadczrCoF%2Fimage.png?alt=media&amp;token=24907e45-acd0-4c7f-afcf-692cf14ffbf5" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Note: Please make sure that the resultant payload can be parsed as a valid JSON.
{% endhint %}

## Webengage

**Configure CustomerGlu Endpoint as a Webhook on Webengage**

Webengage allows setting up a webhook url, and forwards all the events to the same.\
The following url can be set up as the Webhook endpoint on your Webengage Dashboard.

[Check out Docs](https://docs.webengage.com/docs/webhook-configuration)

## Sending events from webengage

<mark style="color:green;">`POST`</mark> `https://events.customerglu.com/webengage/v4`

{% tabs %}
{% tab title="200 " %}

{% endtab %}
{% endtabs %}

\
In order to enable webhooks from Webengage, the following inputs from your WebEngage Dashboard need to be added in the Integrations Page of CustomerGlu dashboard:

| Name        | Description                                                                                           |
| ----------- | ----------------------------------------------------------------------------------------------------- |
| licenseCode | Your WebEngage account license code                                                                   |
| Secret      | MD5 Hex of the combination of your WebEngage license code and the Webhook Secret Key separated by `:` |

[Check out docs for getting the required credentials](https://docs.webengage.com/docs/webhooks#section-request-verification)

MD5 Hex of `<Your_Webengage_License_Code>:<Your_Webhook_Secret_Key>` can be generated [here](https://codebeautify.org/md5-hash-generator)
