LINE 整合
curl --request POST \
--url https://api.pathors.com/project/{projectId}/integration/line/callbackimport requests
url = "https://api.pathors.com/project/{projectId}/integration/line/callback"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.pathors.com/project/{projectId}/integration/line/callback', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pathors.com/project/{projectId}/integration/line/callback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pathors.com/project/{projectId}/integration/line/callback"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pathors.com/project/{projectId}/integration/line/callback")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pathors.com/project/{projectId}/integration/line/callback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"message": "<string>"
}Integration APIs
LINE 整合
LINE 整合端點允許您接收和處理來自 LINE Messaging API 的訊息。
POST
/
project
/
{projectId}
/
integration
/
line
/
callback
LINE 整合
curl --request POST \
--url https://api.pathors.com/project/{projectId}/integration/line/callbackimport requests
url = "https://api.pathors.com/project/{projectId}/integration/line/callback"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.pathors.com/project/{projectId}/integration/line/callback', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pathors.com/project/{projectId}/integration/line/callback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pathors.com/project/{projectId}/integration/line/callback"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pathors.com/project/{projectId}/integration/line/callback")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pathors.com/project/{projectId}/integration/line/callback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"message": "<string>"
}基礎 URL
https://api.pathors.com
Webhook 端點
路徑參數
您的專案 ID
請求頭
LINE Messaging API 將發送帶有特定頭部的請求用於身份驗證和驗證。請求體
請求體遵循 LINE Messaging API webhook 事件格式。 範例:{
"events": [
{
"type": "message",
"message": {
"type": "text",
"text": "你好"
},
"timestamp": 1462629479859,
"source": {
"type": "user",
"userId": "U4af4980629..."
},
"replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
"mode": "active"
}
]
}
回應
表示 webhook 處理結果的狀態訊息
{
"message": "OK"
}
錯誤回應
| 狀態碼 | 描述 |
|---|---|
| 400 | 整合已禁用 |
| 404 | 未找到整合 |
| 500 | 內部伺服器錯誤 |
設置指南
- 在 LINE Developers Console 創建 LINE channel
- 在您的 LINE channel 設置中配置 webhook URL
- 在您的 Pathors 專案設置中啟用 LINE 整合
- 將您的 LINE channel 存取令牌添加到整合配置中
⌘I
