# Webhook Payload

# Webhook
> Webhooks allows you to receive real-time HTTP notifications of changes to specific objects in Venio. 

### Webhook Payload Object

***modifiedBy**: string*
The employee code of user who created the webhook

***webhookName**: string*
The name of webhook configured in the integration setting 

***topic**: string*
The topic that caused the webhook to fire
> *Allowed Values* : **Customer**, **Quotation**, **Expense**, **User**, **Payroll**, **Case**

***event**: string*
The event that caused the webhook to fire
> *Allowed Values* : **Create**, **Merge**, **Convert**, **Revise**, **Paid**, **PendingSummary**, **Inactive**, **Completed**, **Edit**

***data**: object*
Provides the changes data related to topic and event

---

### Data Object
***Owners**: array of string*
The owners user of the tranasction
> *Topics* : **Customer**, **Quotation**, **Case**
> *Events* : **Create**, **Convert**, **Revise**, **Completed**, **Edit**

***FromCustomerCode**: string* 
The customer code of the source data when merging customer records
> *Topics* : **Customer**
> *Events* : **Merge**

***FromCustomerName**: string* 
The customer name of the source data when merging customer records
> *Topics* : **Customer**
> *Events* : **Merge**

***ToCustomerCode**: string* 
The customer code of the destination data when merging customer records
> *Topics* : **Customer**
> *Events* : **Merge**

***ToCustomerName**: string* 
The customer name of the destination data when merging customer records
> *Topics* : **Customer**
> *Events* : **Merge**

***customerName**: string* 
The customer's name
> *Topics* : **Customer**
> *Events* : **Create**, **Convert**

***CustomerCode**: string*
The customer's code
> *Topics* : **Customer**
> *Events* : **Create**, **Convert**

***QuotationNo**: string*
The quotation running number
> *Topics* : **Quotation**
> *Events* : **Create**, **Revise**

***SaleOrderNo**: string*
The quotation running number
> *Topics* : **SaleOrder**
> *Events* : **Create**, **Edit**, **Completed**

***ExpenseNo**: string*
The expense running number
> *Topics* : **Expense**
> *Events* : **Paid**, **PendingSummary**

***CreatedBy**: string*
The employee's code who performed the action
> All topics and events

***CompanyName**: string*
The companyName's name
> *Topics* : **User**, **Payroll**
> *Events* : **Inactive**, **Paid**

***EmployeeRefId**: string*
The employee's no
> *Topics* : **User**
> *Events* : **Inactive**

***PeriodCalculateNo**: number*
The periodCalculateNo of payroll
> *Topics* : **Payroll**
> *Events* : **Paid**

***Year**: number*
The year of payroll
> *Topics* : **Payroll**
> *Events* : **Paid**

***IsExtendPeriod**: boolean*
IsExtendPeriod for checking the period of extend periods or regular periods
true -> extend periods, false -> regular periods
> *Topics* : **Payroll**
> *Events* : **Paid**

***CaseNo**: string*
The case running number
> *Topics* : **Case**
> *Events* : **Create**, **Edit**, **Completed**

***ChatMessage**: object*
The chat message object model
> *Topics* : **Chat**
> *Events* : **Message**

***ActivityNo**: string*
The activity running number
> *Topics* : **Activity**
> *Events* : **Create**, **Edit**, **Completed**

***ActivityName**: string*
The activity name
> *Topics* : **Activity**
> *Events* : **Create**, **Edit**, **Completed**

***AssignedTo**: string*
The employee's code who assigned to action
> *Topics* : **Activity**
> *Events* : **Create**, **Edit**, **Completed**

***ProductCode**: string*
The product code
> *Topics* : **Product**
> *Events* : **Create**, **Edit**

***ProductName**: string*
The product name
> *Topics* : **Product**
> *Events* : **Create**, **Edit**
---

### Examples webhook payload

#### Create Customer

```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "Customer-Create-Hook",
  "Topic": "Customer",
  "Event": "Create",
  "Data": {
    "Owners": [
      "EMP10002"
    ],
    "CustomerName": "Tesla",
    "CustomerCode": "L23000241",
    "CreatedBy": "EMP10001"
  }
}
```

#### Merge Customer

```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "Customer-Merge-Hook",
  "Topic": "Customer",
  "Event": "Merge",
  "Data": {
    "FromCustomerCode": "L23000241",
    "FromCustomerName": "ABC Co.,Ltd",
    "ToCustomerCode": "L23000242",
    "ToCustomerName": "MNO Co.,Ltd"
  }
}
```

#### Create Quotation

```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "Create-Quotation-Hook",
  "Topic": "Quotation",
  "Event": "Create",
  "Data": {
    "Owners": [
      "EMP10003"
    ],
    "QuotationNo": "Q23030001",
    "CreatedBy": "EMP10001"
  }
}
```
#### Expense Paid

```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "Expense-Paid-Hook",
  "Topic": "Expense",
  "Event": "Paid",
  "Data": {
    "ExpenseNo": "EXP23030001",
    "CreatedBy": "EMP10001"
  }
}
```
#### Expense PendingSummary

```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "Expense-Paid-Hook",
  "Topic": "Expense",
  "Event": "PendingSummary",
  "Data": {
    "ExpenseNo": "EXP23030001",
    "CreatedBy": "EMP10001"
  }
}
```
#### Inactive User

```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "User-Inactive-Hook",
  "Topic": "User",
  "Event": "Inactive",
  "Data": {
    "EmployeeRefId": "EMP10001",
    "CompanyName": "empeo จำกัด"
  }
}
```

#### Payroll Paid

```js
{
  "ModifiedBy": "80100",
  "WebhookName": "Payroll-Paid-Hook",
  "Topic": "Payroll",
  "Event": "Paid",
  "Date": "25/12/2023 10:04:17 AM",
  "Data": {
    "CompanyName": "โกไฟว์",
    "Year": 2023,
    "PeriodCalculateNo": 11,
    "IsExtendPeriod": false
  }
}
```
#### Create Sale Order

```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "SaleOrder-Hook",
  "Topic": "SaleOrder",
  "Event": "Create",
  "Data": {
    "Owners": [
      "EMP10003"
    ],
    "SaleOrderNo": "SO23030001",
    "CreatedBy": "EMP10001"
  }
}
```
#### Edit Sale Order

```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "SaleOrder-Hook",
  "Topic": "SaleOrder",
  "Event": "Edit",
  "Data": {
    "Owners": [
      "EMP10003"
    ],
    "SaleOrderNo": "SO23030001",
    "CreatedBy": "EMP10001"
  }
}
```
#### Completed Sale Order 

```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "SaleOrder-Hook",
  "Topic": "SaleOrder",
  "Event": "Completed",
  "Data": {
    "Owners": [
      "EMP10003"
    ],
    "SaleOrderNo": "SO23030001",
    "CreatedBy": "EMP10001"
  }
}
```
#### Edit Asset

```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "EditAsset-Hook",
  "Topic": "Asset",
  "Event": "Edit",
  "Date": "06/09/2024 16:46",
  "Data": {
    "Owners": [],
    "AssetCode": "A240600038"
  }
}
```

#### Transfer Asset

```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "TransferAsset-Hook",
  "Topic": "Asset",
  "Event": "Transfer",
  "Date": "06/09/2024 16:46",
  "Data": {
    "Owners": [],
    "EmployeeRefId": "EMP10002",
    "CompanyName": "โกไฟว์"
  }
}
```

#### Create Case
```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "Case-Create-Hook",
  "Topic": "Case",
  "Event": "Create",
  "Data": {
    "Owners": [
      "EMP10003"
    ],
    "CaseNo": "TO23030001",
    "CreatedBy": "EMP10001"
  }
}
```

#### Edit Case
```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "Case-Edit-Hook",
  "Topic": "Case",
  "Event": "Edit",
  "Data": {
    "Owners": [
      "EMP10003"
    ],
    "CaseNo": "TO23030001",
    "CreatedBy": "EMP10001"
  }
}
```

#### Closed Case

```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "Case-Close-Hook",
  "Topic": "Case",
  "Event": "Completed",
  "Data": {
    "Owners": [
      "EMP10003"
    ],
    "CaseNo": "TO23030001",
    "CreatedBy": "EMP10001"
  }
}
```

#### Chat Message

```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "Chat-Message-Hook",
  "Topic": "Chat",
  "Event": "Message",
  "Data": {
    "RoomId": "82615118-8b09-48b2-9003-1fc654453394",
    "Platform": 1,  // line , facebook, ig,
    "User": {
        "companyId": "507",
        "OriginalName": "ชื่อผู้ใช้งาน",
        "OriginalName_EN": "Username",
        "CustomerId": "2345",
        "ContactId": "123"
    }
    "Content": "Hello, How are you today?",
    "CommentPost": "This is good post!!",
    "Url": "",
    "Timestamp": "1750644958",
    "Type": "Message", // Message = 1, Attachment = 4, sticker = 9, FacebookComment = 13 , Ads = 28, Product = 24, Order = 25
    "Attachment": {
        "Filename": "image.jpg",
        "Extension": "image/jpeg",
        "FileSize": "128",
        "ThumbnailUrl": "https://example.com/image-thumbnail.jpg",
        "PublicUrl": "https://example.com/image.jpg",
        "Timestamp": "1750644958",
        "IsActive": "true"
    },
    "Attachments": [
        {
            "Filename": "image.jpg",
            "Extension": "image/jpeg",
            "FileSize": "128",
            "ThumbnailUrl": "https://example.com/image-thumbnail.jpg",
            "PublicUrl": "https://example.com/image.jpg",
            "Timestamp": "1750644958",
            "IsActive": "true"
        }
    ]
    "Referral": {
        "Source": "Facebook",
        "Type": "Ads",
        "AdId": "1370852087689",
        "AdTitle": "Advertise test",
        "PostId": "9509972761541",
        "PhotoUrl": "https://example.com/image.jpg"
    },
    "Product": {
        "Id": "6526251561461",
        "Price": "200.00",
        "DiscountedPrice": "20.00",
        "Discount": "20.00",
        "ProductName": "ProductName",
        "PictureUrl": "https://example.com/image.jpg",
        "OnClickUrl": "https://example.com/click",
        "RelativeUrl": "https://example.com"
    },
    "Order": {
        "Id": "6526251561461",
        "OrderCode": "6526251561461",
        "ProductName": "ProductName",
        "OrderTime": "2025-06-23T02:15:57+00:00",
        "TotalPrice": "200.00",
        "ItemsCount": "2",
        "OrderStatus": "complete",
        "RelativeUrl": "https://example.com"
    },
    "TraceId": "39ac13cc-1001-429c-926f-8511a439a773",
    "IsFirstCustomerMessage": "true"
}
```

#### Create Activity
```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "Activity-Create-Hook",
  "Topic": "Activity",
  "Event": "Create",
  "Data": {
    "CreatedBy": "EMP10001",
    "ActivityNo": "ACT250600271",
    "ActivityName": "Activity-Create-Hook",
    "AssignedTo": "EMP10001"
  }
}
```

#### Edit Activity
```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "Activity-Create-Hook",
  "Topic": "Activity",
  "Event": "Edit",
  "Data": {
    "CreatedBy": "EMP10001",
    "ActivityNo": "ACT250600271",
    "ActivityName": "Activity-Create-Hook",
    "AssignedTo": "EMP10001"
  }
}
```

#### Completed Activity
```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "Activity-Create-Hook",
  "Topic": "Activity",
  "Event": "Completed",
  "Data": {
    "CreatedBy": "EMP10001",
    "ActivityNo": "ACT250600271",
    "ActivityName": "Activity-Create-Hook",
    "AssignedTo": "EMP10001"
  }
}
```

#### Create Product
```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "Product-Create-Hook",
  "Topic": "Product",
  "Event": "Create",
  "Data": {
    "CreatedBy": "EMP10001",
    "ProductCode": "PRODUCT001",
    "ProductName": "Product-Create-Hook"
  }
}
```

#### Edit Product
```js
{
  "ModifiedBy": "EMP10001",
  "WebhookName": "Product-Edit-Hook",
  "Topic": "Product",
  "Event": "Edit",
  "Data": {
    "CreatedBy": "EMP10001",
    "ProductCode": "PRODUCT001",
    "ProductName": "Product-Create-Hook"
  }
}
```

