# ตัวอย่างการผสานการทำงานกับ Webhook

การใช้ webhook ทำให้คุณสามารถแชร์ข้อมูล customer journey กับบริการอื่นๆ ได้แทบทุกชนิด ไม่ว่าจะเป็น ระบบ analytics, CRM, บริการ marketing automation และอื่นๆ อีกมากมาย ตัวอย่างเช่น การแจ้งเตือนบริการภายนอกโดยอัตโนมัติเมื่อลูกค้าได้ดำเนินการบางอย่างภายใน journey, การส่งข้อมูลลูกค้าไปยังเครื่องมือวิเคราะห์ของคุณ และการทริกเกอร์อีเมล, SMS หรือข้อความ WhatsApp ของบุคคลที่สามตาม event ที่ระบุใน journey – มีกรณีการใช้งานมากมายให้คุณเลือกใช้ [เรียนรู้เพิ่มเติมเกี่ยวกับองค์ประกอบ Webhook ใน Customer Journeys](/th/product/customer-journey/journey-elements#webhook)

โพสต์นี้จะแสดงวิธีการใช้งาน webhook สำหรับกรณีการใช้งานและบริการต่างๆ

## Mixpanel

### กรณีการใช้งาน

ส่งข้อมูล event จาก journey ไปยัง Mixpanel

### ข้อกำหนดเบื้องต้น

* บัญชี Mixpanel และ Project ID
* [บัญชีบริการ (Service account)](https://developer.mixpanel.com/reference/authentication#service-accounts)

Webhook สำหรับ ingestion API ([https://developer.mixpanel.com/reference/events](https://developer.mixpanel.com/reference/events)):

### ตัวอย่าง URL

`https://api.mixpanel.com/import?strict=1&project_id=XXXXXXX`

```
Authorization: Basic UHVzaHdvb3NVTTWlrcjROZUE=
Content-Type: application/json
```

### ตัวอย่างข้อมูล

```
[
  {
    "event": "PW_ApplicationOpen",
    "properties": {
        "time": "{{point:48ae746b-0f54-47db-b96c-1f082e110ff4;event:PW_ApplicationOpen;attribute:datetime}}",
        "distinct_id": "{{device:hwid}}",
        "$insert_id": "48ae746b-0f54-47db-b96c-1f082e110ff4",
        "device_type": "{{point:48ae746b-0f54-47db-b96c-1f082e110ff4;event:PW_ApplicationOpen;attribute:device_type}}",
        "application_version": "{{point:48ae746b-0f54-47db-b96c-1f082e110ff4;event:PW_ApplicationOpen;attribute:application_version}}",
        "timezone": "{{tag:Timezone}}",
        "name": "{{tag:Name}}"
    }
  }
]
```

## Amplitude

### กรณีการใช้งาน

ส่งข้อมูล event จาก journey ไปยัง Amplitude

### ข้อกำหนดเบื้องต้น

* บัญชี Amplitude

Webhook สำหรับ Ingestion API ([https://developers.amplitude.com/docs/http-api-v2#request-format](https://developers.amplitude.com/docs/http-api-v2#request-format)):

### URL

`https://api.amplitude.com/2/httpapi`

```
Accept: */*Content-Type: application/json
```

### ตัวอย่างข้อมูล

```
{
  "api_key": "c506ffde6db9xxxxxxa50120e22ec5",
  "events": [
    {
      "user_id": "{{device:user_id}}",
      "device_id": "{{device:hwid}}",
      "event_type": "PW_ApplicationOpen",
      "user_properties": {"timezone": "{{tag:Timezone}}", "sdk_version": "{{tag:SDK Version}}"},
      "country": "{{tag:Country}}"
    }
  ]
}
```

## Slack

### กรณีการใช้งาน

ทริกเกอร์ข้อความ Slack จาก journey

### ข้อกำหนดเบื้องต้น

* บัญชี Slack

### ตัวอย่าง URL

`https://pushwoosh.slack.com/apps/XXXXXXXX-incoming-webhooks`

```
Content-Type: application/json
```

### ตัวอย่างข้อมูล

```json
{
"text": "Hi there :smile:",
"username": "John Doe"
}
```

## Zapier

### กรณีการใช้งาน

ส่งข้อมูลไปยัง Zapier ซึ่งสามารถนำไปใช้ต่อในระบบอัตโนมัติของ Zapier กับแอปต่างๆ กว่า 4,000 แอป

### ข้อกำหนดเบื้องต้น

* บัญชี Zapier

### ตัวอย่าง URL

`https://hooks.zapier.com/hooks/catch/XXXXXXX/xxxxxxx`

```
Content-Type: application/json
```

### ตัวอย่างข้อมูล

```json
{
  "hwid": "{{device:hwid}}",
  "sdk": "{{tag:SDK Version}}"
}
```

## Twilio (SMS)

### กรณีการใช้งาน

ส่ง SMS จาก journey

### ข้อกำหนดเบื้องต้น

* บัญชี Twilio (ต้องเข้าถึง TWILIO\_ACCOUNT\_SID และ TWILIO\_AUTH\_TOKEN ได้)
* หมายเลขโทรศัพท์ที่ซื้อไว้

### ตัวอย่าง URL

`https://api.twilio.com/2010-04-01/Accounts/\$TWILIO_ACCOUNT_SID/Messages.json`

```text
Content-Type: application/x-www-form-urlencoded
Authorization: Basic.... // Encode TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN with https://www.blitter.se/utils/basic-authentication-header-generator/ to get Authenticate value
```

### ตัวอย่างข้อมูล

```text
From=%2B18646511557&To=%2B15852826356&Body=...
```