第三方集成
在BeTalk集成对象提供以下属性:
整合对象属性
名称 | 描述 | 例 |
ID | 集成的ID | 5 |
service | 与BeTalk集成的第三方服务。可获取的是:
|
github上 |
action | 通过BeTalk显示的内容:聊天,网页,待办事项: | 聊天 |
description | 整合的描述 | GitHub的整合 |
webhook_url | 调用第三方服务的URL | https://api.betalk.com/webhooks/ CAEqBXNiRVhxehdCeTBtQzhPM3Iw RUkwSUM4TVdzaE93NYABZpAYZH |
created_time | 创建集成对象时时间戳 | 1348864985783 |
updated_time | 当集成对象进行了更新时间戳 | 1348864985783 |
1. 获得集成列表
通过{user_id}获取集成列表。
GET / {user_id} /Integration
请求:
GET /me/integrations
响应:
{
"code": "RESPONSE_SUCCESS",
"data": {
"binders": [
{
"binder_id": "B34gq491gkjFjbbtYW5xQkC",
"count": 2,
"integrations": [
{
"webhook_url": "https://api.betalk.com/webhooks/CAEqBUsrSXdxehdCMzRncTQ5MWdrakZqYXshUlc1eFFrQ4ABTJADFA",
"id": "313",
"service": "github",
"action": "chat",
"description": "Test",
"updated_time": 1414713251918,
"created_time": 1414713251914
},
{
"webhook_url": "https://api.betalk.com/webhooks/CAEqBVlIU0doehdCb2wyVGhzU3Jyb0Z0JsoENWcxUWVsSIABuwKQAxQ",
"id": "315",
"service": "zendesk",
"action": "page",
"description": "",
"updated_time": 1414715708597,
"created_time": 1414715708593
}
]
},
{
"binder_id": "By0mC8O3r0EI0UXSMWshOw5",
"count": 1,
"integrations": [
{
"webhook_url": "https://api.betalk.com/webhooks/CAEqBXhkdSSDAehdCeTBtQzhPM3IwRUkwSUM4TVdzaE93NYABBJADFA",
"id": "15",
"service": "jira",
"action": "todo",
"description": "",
"updated_time": 1414798605588,
"created_time": 1414798605577
}
]
}
]
}
}
2. 创建集成到讨论组
根据{binder_id}添加集成。
POST/ {binder_id} /iintegrations
JSON参数
名称 | 类型 | 描述 |
Service | String | 支持的第三方服务:
|
Action | String | 整合动作:chat,page或者todo |
description | String | 可选:整合说明 |
请求:
POST /B7V4ze37oO08PYO70973lX6/integrations
{
"service": "github",
"action": "chat",
"description": "Github version control"
}
响应:
{
"code": "RESPONSE_SUCCESS",
"data": {
"id": "68",
"webhook_url": "https://api.betalk.com/webhooks/CAEqBXhkdSSDAehdCeTBtQzhPM3IwRUkwSUM4TVdzaE93NYABBJADFA",
"service": "github",
"action": "chat",
"description": "Github version control",
"created_time": 1342813061602,
"updated_time": 1342813061602
}
}
3. 获取讨论组集成
根据{binder_id}获取集成。
GET/ {binder_id} /integrations
请求:
GET /BRTaH8slmbPAY4odz0RbBIF/integrations
响应:
{
"code": "RESPONSE_SUCCESS",
"data": {
"binder_id": "BRTaH8slmbPAY4odz0RbBIF",
"count": 2,
"integrations": [
{
"webhook_url": "https://api.betalk.com/webhooks/CAEqBUsrSXdxehdCMzRncTQ5MWdrakZqYXshUlc1eFFrQ4ABTJADFA",
"id": "76",
"service": "jira",
"action": "page",
"description": "jira 1",
"updated_time": 1420358925820,
"created_time": 1420358925817
},
{
"webhook_url": "https://api.betalk.com/webhooks/CAEqBUU2VmFVehdCMzRncTQ5MWSYHsZqYm1PUlc1eFFrQ4ABTpADFA",
"id": "78",
"service": "jira",
"action": "todo",
"description": "jira 2",
"updated_time": 1420360295781,
"created_time": 1420360295777
}
]
}
}
4. 删除讨论组集成
根据{binder_id}&{integration_id}删除讨论组的集成。
DELETE /{binder_id}/integrations/{integration_id}
请求:
DELETE /B7V4ze37oO08PYO70973lX6/integrations/24
响应:
{
"code": "RESPONSE_SUCCESS"
}