# Third-Party Integration

3Dolphins support for external integration with third-party omnichannel. Below is the default architecture and configuration to support integration between 3dolphins and third-party omnichannel.

### **Third-Party Integration Workflow**

![Integration Workflow](https://lh3.googleusercontent.com/2KBqYRuM0dNH690Q3SMijOFY3mZc3quKqj_melvcYLdlSIT1KUr1ycp0pxeRuEVG1bHK6dPRG4bmysS-GIhj-VpCEu0nuCQvt_cvinzZ6ET_fzjHZU0JB_Q8Lv3LsuUSXNR4VafF)

### **Properties Configuration**

Additional properties setup in 3dolphins server to enable third-party integration.

| **Properties**                          | Value |
| --------------------------------------- | ----- |
| app.ext.integration.api.base.url        |       |
| app.ext.integration.api.sendMessage     |       |
| app.ext.integration.api.incomingMessage |       |

### **Incoming Event**

Below table is a list of fields that will be sent from 3dolphins Engine to third-party that will be integrated.

| **Field**    | **Description**                                           | **Status** |
| ------------ | --------------------------------------------------------- | ---------- |
| ticketNumber | Unique identifier                                         | Mandatory  |
| channel      | Social Media Channel                                      | Mandatory  |
| accountId    | Account Id from Social Media                              | Mandatory  |
| contactId    | Id Contact 3Dolphins                                      | Mandatory  |
| messageType  | text/image/video/audio/file/Location (latitude,longitude) | Mandatory  |
| message      | Output depends on the message type                        | Mandatory  |
| mediaLink    | Valid media URL                                           | Mandatory  |
| customerName | Customer Name includes first name + last name             | Mandatory  |
| createdDate  | Created Ticket Date (“yyyy-MM-dd'T'HH:mm:ss.SSS”)         | Mandatory  |
| owner        | Tenant ID                                                 | Mandatory  |
| groupId      | Additional Field for specific room chat                   | Additional |
| language     | Additional Field for specific language                    | Additional |

{% hint style="info" %}
These fields will be presented in JSON format.
{% endhint %}

Below sample JSON for Incoming Event from 3Dolphins to third-party:

```
{
	"ticketNumber":"294c9ea88f7e649f8c37ae895ebab247",
	"channel":"whatsapp",
	“accountId”:”628128778222”
	"contactId":"d61d77735f3fe08bcf6d6b96fa06ba9d"
	"messageType":"text",
	"message":"Halo",
	"mediaLink":"",
	"customerName":"Farhan Akbar",
	"createdDate":"2021-04-28T15:39:37.945"
	"owner":"82ab0fd5cfd1e80d1ff97c0cfc9aaaa",
	"groupId":"",
	"language":""
}
```

### Outgoing Event

Below table is a list of fields that are required from third-party to send post messages to the 3dolphins platform. Messages will be delivered to customers based on a given ticket number.

| **Field**    | **Description**                                           |
| ------------ | --------------------------------------------------------- |
| ticketNumber | Unique identifier                                         |
| channel      | Social Media Channel                                      |
| messageType  | text/image/video/audio/file/Location (latitude,longitude) |
| message      | Output depends on the message type                        |
| mediaLink    | Valid media URL                                           |
| customerName | Customer Name includes first name + last name             |
| owner        | Tenant ID                                                 |

{% hint style="info" %}
These fields will be presented in JSON format.
{% endhint %}

Below sample JSON for Outgoing Event from 3Dolphins to third-party:

```
{
	"ticketNumber":"294c9ea88f7e649f8c37ae895ebab247",
	"channel":"whatsapp",
	"messageType":"text",
	"message":"Selamat Datang Customer",
	"mediaLink":"",
	"customerName":"Farhan Akbar",
	"createdDate":"2021-04-28T15:39:37.945"
	"owner":"82ab0fd5cfd1e80d1ff97c0cfc9aaaa"
}
```

Below sample JSON response from webhook:

```
{
	"status":"success"
}
```

### Command Event

Below table is a list of fields that are required from third-party to send any updated ticket status to the 3dolphins platform.

| Field        | Description                |
| ------------ | -------------------------- |
| ticketNumber | Unique identifier          |
| channel      | Social Media Channel       |
| owner        | Tenant ID                  |
| event        | Close Event from 3rd Party |

{% hint style="info" %}
These fields will be presented in JSON format.
{% endhint %}

Below sample JSON for Command Event from 3Dolphins to third-party:

```
{
	"ticketNumber":"294c9ea88f7e649f8c37ae895ebab247",
	"channel":"whatsapp",
	"owner":"82ab0fd5cfd1e80d1ff97c0cfc9aaaa"
	"event":"Close"
}
```

Below sample JSON response from webhook:

```
{
	"status":"success"
}
```

### Scopes

1. Conversation history needs can use 3Dolphins Conversation History API.
2. Sticker message format will be converted into 'Sticker' text.
3. Third-Party may use 3Dolphins Contact API to get customer data based on contactId in Incoming.
