# Source

## 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="/files/4svZwkuRRfrBrjvWVR4L" alt=""><figcaption></figcaption></figure>

**Configure Webhook (Actions)**

<figure><img src="/files/T9nOiNsEHWxGo8mTl7dT" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/BdgfIy7piohIN4HCXLQn" alt=""><figcaption></figcaption></figure>

**Set up a name for the webhook**

<figure><img src="/files/ZWeBEC8WVrQ5H3Rqh7vV" alt=""><figcaption></figcaption></figure>

**Add mapping to the Webhook**

<figure><img src="/files/pAQeAFR6lHMZCigRGQdM" 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="/files/TnhnTZQCXRlRMQregNK5" alt=""><figcaption></figcaption></figure>

#### Add test event

Load test event from source

<figure><img src="/files/NXMV6ayfeacEk0wdeSdl" 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="/files/nX5NPwWpJ35E4deRxbJQ" 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="/files/xA2QrKOqO6cYKrNeDMjn" alt="" width="563"><figcaption></figcaption></figure></div>

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

<figure><img src="/files/Fbxa79pfDD3i5cMdKXRt" alt="" width="563"><figcaption></figcaption></figure>

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

<figure><img src="/files/ryTBIRGEbOCrVmxSPM8u" alt="" width="563"><figcaption></figcaption></figure>

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

<figure><img src="/files/JclNBiEMoGbbAIekVNim" alt="" width="563"><figcaption></figcaption></figure>

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

<figure><img src="/files/by00XH3Ks8XENfNiuCQN" alt="" width="563"><figcaption></figcaption></figure>

6. Click on **Amplitude** Integration.

<figure><img src="/files/5rOHS9VKxV59zAWmPjpr" alt="" width="563"><figcaption></figcaption></figure>

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

<figure><img src="/files/TYcwTRvyKLOYIyQMWVM1" alt="" width="563"><figcaption></figcaption></figure>

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

<figure><img src="/files/bSzlrhx2yb7hPL2l1jVQ" 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="/files/bfaYBjS1e2EkugQ2Hq93" 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="/files/JAeUgpAtdrnErkDYjCxO" alt=""><figcaption></figcaption></figure>

2. Select "Live Behavior" as the qualification Criteria

<figure><img src="/files/OOY8czw63xGUJ02xICm7" alt=""><figcaption></figcaption></figure>

3. Select the already configured CustomerGlu Webhook Endpoint

<figure><img src="/files/9Z14UKegCDokP7oo5fvM" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/nrznY1304TeXcbPbUS8U" 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="/files/CjC9jxP6L7hpktr7Sa25" 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)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.customerglu.com/third-party-integrations/send-user-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
