# Teambox Event Webhook

## Overview

The Teambox Event Webhook feature is used to trigger webhooks whenever an event occurs in your Teambox conversations, such as when a chat is assigned, a chat request is accepted, rejected, or solved, etc.

The webhook payload includes details of each event, including Project ID, Event ID, Event Description, user details, contact number, Channel ID, and timestamp, etc.. in JSON format.

You can configure the Webhook URL in the Developer Settings within the admin platform to receive all enabled event webhook data in your own application or server. This data can then be used for further actions or automations within your system..

## Webhook Setup

To start receiving webhooks, you need to configure them in the Admin Platform under Developer Settings

Steps to access:

* Click on **All Menu**
* Navigate to [**Developers**](https://app.pickyassist.com/settings/developers/webhook) under Settings
* Click on the **Webhook** tab
* Scroll down to find the **Teambox Event Webhook** section, as shown in the image below

<figure><img src="https://3382165395-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LlJChpzcxtwOYGcBd1q%2Fuploads%2FZwEVHG5wM9lmRHztNINu%2Fimage.png?alt=media&#x26;token=6c951797-4012-4dd5-ad78-575d099d95d8" alt=""><figcaption></figcaption></figure>

In this section, you can enter your Webhook URL in the provided textbox and click Save.

Below the URL field, you will find checkboxes for each event. You can enable or disable specific events by checking or unchecking these boxes and clicking the Save button. This allows you to control which events should trigger webhooks based on your requirements.

Once the setup is complete, webhooks will be triggered for all enabled events whenever they occur in Teambox.

You can update these settings at any time. Make sure to click the Save button after making any changes.

> **Note:** A Connector URL can also be used as the Webhook URL, enabling further automation within the Picky Assist platform

### Event Webhook Variables

<table><thead><tr><th width="223">Variable</th><th width="143">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>project_id</strong></td><td>String</td><td>Your project ID</td></tr><tr><td><strong>event_id</strong></td><td>Numeric</td><td>Represents the unique ID for each <a href="#teambox-events-and-id">Teambox events</a>.</td></tr><tr><td><strong>event_description</strong></td><td>String</td><td>Represents the name of the event that has been triggered</td></tr><tr><td><strong>user</strong></td><td>String</td><td>Name of the user involved in the event action</td></tr><tr><td><strong>user_id</strong></td><td>String</td><td>System-generated unique identifier for the user</td></tr><tr><td><strong>assigned_to</strong></td><td>String</td><td>The user (agent/admin) to whom the chat has been assigned</td></tr><tr><td><strong>assigned_to_userid</strong></td><td>String</td><td>The unique identifier of the user to whom the chat is assigned</td></tr><tr><td><strong>assigned_through</strong></td><td>String</td><td>Indicates the method through which the chat was assigned (Teambox, Connector, Flows, Smart Replies)</td></tr><tr><td><strong>channel</strong></td><td>String</td><td>ID of the channel where the conversation occurs</td></tr><tr><td><strong>contact_id</strong></td><td>String</td><td>The unique identifier of the contact involved in the chat</td></tr><tr><td><strong>contact_mobile</strong></td><td>String</td><td>Mobile number of the contact involved in the chat</td></tr><tr><td><strong>timestamp</strong></td><td>String</td><td>Indicates the date and time at which the event was triggered</td></tr><tr><td><strong>kicked_out_user</strong></td><td>String</td><td>Represents the user who has been removed from the conversation</td></tr><tr><td><strong>kicked_out_by</strong></td><td>String</td><td>Indicates who performed the action of removing the user from the conversation. This will generally be the <strong>System</strong>.</td></tr><tr><td><strong>connector_name</strong></td><td>String</td><td>Name of the Connector through which the chat is assigned</td></tr><tr><td><strong>flow_name</strong></td><td>String</td><td>Name of the Flow through which the chat is assigned</td></tr><tr><td><strong>assign_type</strong></td><td>String</td><td>Specifies whether the chat was assigned manually or forcefully</td></tr></tbody></table>

### Teambox Events and ID

<table><thead><tr><th width="260">Events</th><th width="296">Event Details</th><th>Event Id</th></tr></thead><tbody><tr><td>Chat Assigned</td><td>When a chat is assigned by admin or agent</td><td>1</td></tr><tr><td>Chat Accepted</td><td>When the chat request is accepted by admin or agent</td><td>2</td></tr><tr><td>Chat Rejected</td><td>When the chat request is rejected by admin or agent</td><td>3</td></tr><tr><td>Chat Solved</td><td>When the chat is Marked as Done by the admin or agent</td><td>4</td></tr><tr><td>Missed a Chat</td><td>When the chat is missed by admin and agents</td><td>5</td></tr><tr><td>Started a Conversation</td><td>When admin or agent manually joins in a chat</td><td>6</td></tr><tr><td>Kicked Out of a Conversation</td><td>When admins or agents got kicked out off a conversation</td><td>7</td></tr></tbody></table>

### Events and Sample Payloads

#### 1. Chat Assigned (event\_id = 1)

This event is triggered when a user or admin assigns a contact’s chat to another user. Chat assigning can be performed through [Teambox](https://help.pickyassist.com/setting-up-guide/setting-up-teambox/teambox#assign-chat) and through [Connectors](https://help.pickyassist.com/setting-up-guide/setting-up-connector/actions#list-of-available-actions), [Flows](https://help.pickyassist.com/setting-up-guide/setting-up-flow-builder/steps/introduction-must-read), or [Smart Replies](https://help.pickyassist.com/setting-up-guide/smart-reply-v2/train-module/smart-actions#teambox) by [Assign Chat](https://help.pickyassist.com/setting-up-guide/setting-up-connector/actions#getting-started) feature in actions.

The webhook payload for this event includes key parameters such as **Assigned by** user details, **Assigned to** user details, and **Assigned Through** (Teambox, Connector, Flow, or Smart Replies), along with other standard parameters.

A sample webhook payload for the **Chat Assigned** event is provided below;

```
{
  "project_id": "500000",
  "event_id": 1,
  "event_description": "Chat Assigned",
  "user": "Shanthi",
  "user_id": "500004",
  "assigned_to": "Nandu",
  "assigned_to_userid": "501600",
  "assigned_through": "Teambox",
  "assign_type": "Manual Assign",
  "channel": "121",
  "contact_id": "200402651",
  "contact_mobile": "9180864xxxxx",
  "timestamp": "1775220730"
}
```

#### 2. Chat Accepted (event\_id = 2)

This event is triggered when a user or admin accepts a chat request in Teambox. It is triggered when accepting an incoming chat request, as well as when accepting chats that were manually assigned by other users through Teambox or via the “Assign Chat” action in Connectors, Flows, or Smart Replies.

In case of bulk chat acceptance, the webhook is triggered separately for each request, along with the corresponding contact details.

A sample webhook payload for the **Chat Accepted** event is provided below;

```
{
  "project_id": "500000",
  "event_id": 2,
  "event_description": "Chat Accepted",
  "user": "Nandu",
  "user_id": "501640",
  "channel": "121",
  "contact_id": "200402651",
  "contact_mobile": "9180864xxxx",
  "timestamp": "1775458418"
}
```

#### 3. Chat Rejected (event\_id = 3)

This event is triggered when a user or admin rejects a chat request in Teambox, including bulk rejections. For bulk chat rejection, the webhook is triggered separately for each request, along with the corresponding contact’s ID and mobile number.

A sample webhook payload for the **Chat Rejected** event is provided below;

```
{
  "project_id": "500000",
  "event_id": 3,
  "event_description": "Chat Rejected",
  "user": "Nandu",
  "user_id": "501643",
  "channel": "121",
  "contact_id": "200652068",
  "contact_mobile": "9179940xxxx",
  "timestamp": "1775460898"
}
```

#### 4. Chat Solved (event\_id = 4)

This event is triggered when a user or admin clicks on “Mark as Done” in a chat in Teambox, indicating that the chat has been resolved. The webhook payload includes details of the user who solved the chat, along with the corresponding contact details.

A sample webhook payload for a Solved Chat event is provided below;

```
{
  "project_id": "500000",
  "event_id": 4,
  "event_description": "Chat Solved",
  "user": "Anu",
  "user_id": "501640",
  "channel": "121",
  "contact_id": "200294112",
  "contact_mobile": "9196298xxxx",
  "timestamp": "1775465910"
}
```

#### 5. Missed a Chat (event\_id = 5)

This event is triggered when an incoming chat is not accepted by any user or admin and is marked as missed. The chat is then moved to the **“Missed Chat”** tab in Teambox. The webhook payload includes the contact details of the missed chat and user details of admin.

A sample webhook payload for a Missed Chat event is provided below;

```
{
  "project_id": "500000",
  "event_id": 5,
  "event_description": "Missed A Chat",
  "user": "Shanthi",
  "user_id": 500005,
  "channel": "121",
  "contact_id": "200018893",
  "contact_mobile": "9194954xxxxx",
  "timestamp": "1775467018"
}
```

#### 6. Started a Conversation (event\_id = 6)

This event is triggered when a user or admin manually joins a chat by clicking the **“Join Chat”** button. This action can be performed on chats that are either under the **Solved Chats** or **Missed Chats** sections in Teambox.

A sample webhook payload for Started a Conversation event is provided below;

```
{
  "project_id": "500000",
  "event_id": 6,
  "event_description": "Started A Conversation",
  "user": "John",
  "user_id": "500007",
  "channel": "121",
  "contact_id": "200421060",
  "contact_mobile": "918547xxxxx",
  "timestamp": "1775469541"
}
```

#### 7.  Kicked Out of a Conversation (event\_id = 7)

This event is triggered when a user or admin is removed from a conversation using the “Kick Out User from Conversation” action in Connectors or Flows. This action can only be performed by an admin and allows the removal of any user from the chat.

When the “Kick Out All Users” action is used, all users, including the admin, are removed from the chat. In this case, the webhook is triggered separately for each user who is removed.

The webhook payload for this event includes additional parameters, such as “Kicked Out User”, which indicates the user who was removed, and “Kicked Out By”, which will always be the system.

```
{
  "project_id": "500000",
  "event_id": 7,
  "event_description": "Kicked Out of a Conversation",
  "user": "Shanthi",
  "user_id": 500004,
  "kicked_out_user": "Nandu",
  "kicked_out_by": "System",
  "channel": "121",
  "contact_id": "200650377",
  "contact_mobile": "918606xxxxx",
  "timestamp": "1775473239"
}
```
