### 3.2.11 漂流瓶
#### (1)功能說明
海知提供的漂流瓶,現在你可以對我說“撈瓶子”或者“扔瓶子”與有緣的陌生人聊天,匿名對話,去探索未知神秘的游戲樂趣。硬件端需要接入請聯系support@ruyi.ai
#### (2)接口說明
**請求方法**
* POST
**請求地址**
* http://api.ruyi.ai/v1/message
**請求參數說明**
|參數名 |參數類型 | 是否必須 |參數說明
| :-----| :---| :---:|:-----
|q |String| 是| 自然語言表達,例如“漂流瓶”等
|app_key| String|是 |應用開發者秘鑰,注冊開發者后臺賬號,建立虛擬助理后獲得
|user_id |String| 是 |用戶唯一標識,便于支持個性化語義解析。建議開發者使用 UUID 字符,且不同用戶必須用不同的 user_id,防止意圖串。
#### (3)返回說明
**返回參數說明**
|名稱 |類型| 說明
|:---|:---|:---
|code |Integer | 返回代碼
|msg | String |返回代碼描述
|parameters|JSON Object |解析到的實體以及服務說明
|action|String|服務的接口名稱
|name| String|匹配的意圖名稱
|result | JSON Object| 接口返回內容
|outputs| Array| 服務輸出結果,微信端使用 type 類型為 wechat 開頭的內容;硬件端收到所有內容,依據需求解析使用
**返回代碼說明**
|返回代碼 |錯誤類型|說明
|:---|:---|:---
|0/200 |成功 |請求成功
|400 |無效請求 |某些必需參數缺失或參數值錯誤,詳見msg字段
|401 |未授權 |授權失敗,app_key缺失或錯誤
|403 |請求被禁止|有效請求,但服務拒絕響應,請聯系contact@ruyi.ai
|408 |請求超時 |請求響應超時,一般響應時間設置為2000ms以內
|429 |短時間內大量訪問 |短時間內請求數過多
|500 |內部錯誤 |服務處理異常
|503 |服務不可用|服務異常或正在維護
#### (4)請求示例
**請求范例**
打開漂流瓶
扔瓶子
世界和平
扔瓶子
(觸發敏感詞)
撈瓶子
回復
天氣這么好,不要不開心
查看消息
撈瓶子
扔回海里
撈瓶子
刪除瓶子
確認(取消)
退出
**請求示例喚醒**
http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=打開漂流瓶
(喚醒)
返回結果
```json
{"code": 0,
"msg": "ok",
"result"{
"_text": "打開漂流瓶",
"msg_id": "fd29f3ac-bd5d-4478-99d2-c72ce407b15f",
"intents": [
{
"parameters": {
"service": "current bottle"
},
"action": "漂流瓶-開始",
"name": "語音扔瓶子(請勿修改)扔瓶子-指令游戲開始",
"result": {
"fishingNum": 12,
"blacklist": 0,
"throwNum": 20,
"optionTime": 1547704803184,
"replyNum": "3",
"visitTimes": 23
"text": "歡迎來到漂流瓶,你有3個消息未查看.你可以查看消息,或扔一個瓶子來聊聊秋天里想做的事吧",
"type": "dialog"
},
"outputs": [
{
"type": "wechat.text",
"property": {
"text": "歡迎來到漂流瓶,你有3個消息未查看,現在說說你的夢想是什么吧"
}
},
{
"type": "dialog",
"property": {
"text": "歡迎來到漂流瓶,你有3個消息未查看.你可以查看消息,或扔一個瓶子來聊聊秋天里想做的事吧",
"emotion": "positive"
}
}
],
"score": "1.0",
"scoreColor": "c4",
"is_match": 1,
"skill_id": "b8a63b4e-ae71-4ea4-afe0-321a28390522",
"id": "84b314d9-cb7b-4231-9b1a-ca8ff9141a8f"
}
],
"meta_process_milliseconds": 85
}
```
**請求示例正確**
http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=扔瓶子
(扔瓶子)
返回結果
```json
{"code": 0,
"msg": "ok",
"result"{
"_text": "扔瓶子",
"msg_id": "63e8d89e-4e16-449a-b8cb-3927a88e2961",
"intents": [
{
"parameters": {
"service": "current bottle"
},
"action": "dialog",
"name": "語音扔瓶子(請勿修改)扔瓶子-指令",
"result": {
"text": "一只小巧旅行瓶已經為你準備好了,趕快說出你想說的話吧",
"type": "dialog"
},
"outputs": [
{
"type": "wechat.text",
"property": {
"text": "一只小巧旅行瓶已經為你準備好了,趕快說出你想說的話吧"
}
},
{
"type": "dialog",
"property": {
"text": "嗯,瓶子準備好了,不如現在許個愿吧",
"emotion": "calm"
}
}
],
"score": "1.0",
"scoreColor": "c4",
"is_match": 1,
"skill_id": "b8a63b4e-ae71-4ea4-afe0-321a28390522",
"id": "3c168bfa-75a9-45c9-8b46-dadbbc78fc2d"
}
],
"meta_process_milliseconds": 194
}
```
**請求示例正確**
http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=世界和平
(許愿)
返回結果
```json
{"code": 0,
"msg": "ok",
"result" {
"_text": "世界和平",
"msg_id": "822959ec-2589-4fc1-bc56-ad325535c7ea",
"intents": [
{
"parameters": {
"text": "世界和平",
"service": "current bottle"
},
"action": "扔瓶子",
"name": "扔瓶子-輸入",
"result": {
"timeStart": "1547704880097",
"ownerId": "ruyi-test-b8a63b4e-ae71-4ea4-afe0-321a28390522",
"textStart": "世界和平",
"currentText": "世界和平",
"id": "096e113dd89bcaa77f812fb6e7c5230b"
"text": " 好的,我現在把你的瓶子扔出去啦!不如再扔一個吧",
"type": "dialog"
},
"outputs": [
{
"type": "wechat.text",
"property": {
"text": " 好的,我現在把你的瓶子扔出去啦!不如再扔一個吧"
}
},
{
"type": "dialog",
"property": {
"text": " 好的,我現在把你的瓶子扔出去啦!不如扔個瓶子吧",
"emotion": "positive"
}
}
],
"score": "1.0",
"scoreColor": "c4",
"is_match": 1,
"skill_id": "b8a63b4e-ae71-4ea4-afe0-321a28390522",
"id": "d07457bd-7989-4c04-aacf-a1db462c2dc8"
}
],
"meta_process_milliseconds": 398
}
```
**請求示例正確**
http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=寂寞美眉
(敏感詞)
返回結果
```
{
code: 0,
msg: "ok",
result: {
_text: "寂寞美眉",
msg_id: "71bafd23-c3c8-4efc-8ab9-680df6801180",
intents: [{
parameters: {
any: "",
any1: ""
},
action: "黑名單",
name: "黑名單大佬",
result: {
code: 200,
response: {
code: 0,
msg: "成功",
result: {
fishingNum: 8,
blacklist: 1,
throwNum: 20,
optionTime: 1578466302388
}
},
text: "不要跟我說這些,你可以繼續跟我說扔瓶子或撈瓶子,不想玩了可以退出",
type: "dialog"
},
outputs: [{
type: "wechat.text",
property: {
text: "不要跟我說這些,您可以繼續跟我說扔瓶子或撈瓶子,不想玩了跟我說退出"
}
},
{
type: "dialog",
property: {
text: "不要跟我說這些,你可以繼續跟我說扔瓶子或撈瓶子,不想玩了可以退出",
emotion: "negative"
}
}
],
score: "1.0",
scoreColor: "c4",
is_match: 1,
skill_id: "eb5a1906-da4f-4ed3-982d-404b7eed8984",
id: "8c65b006-7f2b-4e90-bad2-b38eb05384e6"
}],
meta_process_milliseconds: 230
}
}
```
**請求示例正確**
http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=撈瓶子
(撈瓶子)
返回結果
```json
{"code": 0,
"msg": "ok",
"result"{
"_text": "撈瓶子",
"msg_id": "1043ae8b-5364-4cc7-872a-363c431e45ba",
"intents": [
{
"parameters": {
"service": "current bottle"
},
"action": "撈瓶子",
"name": "漂流瓶需要傳遞id(請勿修改)撈瓶子-指令",
"result": {
"timeStart": "1530066916354",
"ownerId": "0000000",
"textStart": "心情差",
"currentText": "心情差",
"id": "e36adb0dfd8ff616a1f3c5de23d19987",
"timeFished": "1547704888899",
"fisherId": "ruyi-test-b8a63b4e-ae71-4ea4-afe0-321a28390522",
"justFished": "1"
"text": "撿到啦!瓶子內容是:心情差。\\n想回復的話跟我說“回復”,不合適的內容可以投訴哦",
"type": "dialog"
},
"outputs": [
{
"type": "wechat.text",
"property": {
"text": "撿到啦!瓶子內容是:心情差。\\n想回復的話跟我說“回復”,不合適的內容可以投訴哦"
}
},
{
"type": "dialog",
"property": {
"text": "撿到啦!瓶子內容是:心情差。\\n想回復的話跟我說“回復”,不合適的內容可以投訴哦",
"emotion": "positive"
}
}
],
"score": "1.0",
"scoreColor": "c4",
"is_match": 1,
"skill_id": "b8a63b4e-ae71-4ea4-afe0-321a28390522",
"id": "0db7abb1-00d4-4431-a791-04a63a0c9240"
}
],
"meta_process_milliseconds": 214
}
```
**請求示例正確**
http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=天氣這么好,不要不開心
(回復內容)
返回結果
```json
{"code": 0,
"msg": "ok",
"result" {
"_text": "天氣這么好,不要不開心",
"msg_id": "649c4f14-32fa-4080-8bb8-1700f9d40930",
"intents": [
{
"parameters": {
"text": "天氣這么好不要不開心",
"service": "current bottle"
},
"action": "回復",
"name": "撈瓶子and看回復-回復-內容",
"result": {
"timeStart": "1530066916354",
"ownerId": "0000000",
"textStart": "心情差",
"currentText": "天氣這么好不要不開心",
"id": "e36adb0dfd8ff616a1f3c5de23d19987",
"timeFished": "1547704888899",
"fisherId": "ruyi-test-b8a63b4e-ae71-4ea4-afe0-321a28390522",
"timeSendMessage": "1547704919589",
"replyText": "心情差"
"text": " 好的,現在把瓶子扔出去啦!再扔一個吧",
"type": "dialog"
},
"outputs": [
{
"type": "wechat.text",
"property": {
"text": " 好的,現在把瓶子扔出去啦!再扔一個吧"
}
},
{
"type": "dialog",
"property": {
"text": " 好的,現在把瓶子扔出去啦!再扔一個吧",
"emotion": "positive"
}
}
],
"score": "1.0",
"scoreColor": "c4",
"is_match": 1,
"skill_id": "b8a63b4e-ae71-4ea4-afe0-321a28390522",
"id": "e725af15-5d12-409e-825a-cfb1c94c4d17"
}
],
"meta_process_milliseconds": 117
}
```
**請求示例正確**
http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=扔回海里
(前提是撈到了瓶子)
返回結果
```json
{
code: 0,
msg: "ok",
result: {
_text: "扔回海里",
msg_id: "827ad9ff-865f-42fa-859d-9f30271f0dba",
intents: [{
parameters: {},
action: "扔回海里",
name: "扔回海里",
result: {
code: 200,
response: {
code: 0,
msg: "成功",
result: {
timeStart: "1560356083030",
ownerId: "6MUQILgRCO1BUMuO9uQ30g==",
textStart: "我的超能力就是要每個人都變的快樂",
audioId: "654ecfa11840800f284717e1",
currentText: "我的超能力就是要每個人都變的快樂",
id: "a6e935889e359453770afcf8c7e76a0a"
}
},
text: " 好的,已經送它重回海洋的懷抱啦。",
type: "dialog"
},
outputs: [{
type: "wechat.text",
property: {
text: " 好的,已經送它重回海洋的懷抱啦。"
}
},
{
type: "voice",
property: {
name: null,
voice_url: "https://qiniu.ruyi.ai/FiUfAqm4ZcZgFOSdQYCYsd76NWy9/small_wave1.mp3"
}
},
{
type: "dialog",
property: {
text: " 好的,已經送它重回海洋的懷抱啦。",
emotion: "positive"
}
}
],
score: "1.0",
scoreColor: "c4",
is_match: 1,
skill_id: "eb5a1906-da4f-4ed3-982d-404b7eed8984",
id: "5c754054-bcc4-4dce-9529-6e1b3b97f85b"
}],
meta_process_milliseconds: 200
}
}
```
**請求示例正確**
http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=刪除瓶子
(前提是撈到了瓶子)
返回結果
```json
{
code: 0,
msg: "ok",
result: {
_text: "刪除瓶子",
msg_id: "e6dc09f4-bbf2-4dc0-b2ba-79c609c7da82",
intents: [{
parameters: {},
action: "dialog",
name: "撈瓶子and看回復-快刪",
result: {
text: "瓶子即將被粉碎哦,要繼續嗎",
type: "dialog"
},
outputs: [{
type: "wechat.text",
property: {
text: "瓶子即將被粉碎哦,要繼續嗎"
}
},
{
type: "dialog",
property: {
text: "垃圾瓶子即將被粉碎哦,要繼續嗎",
emotion: "suspect"
}
}
],
score: "0.9998858353147755",
scoreColor: "c4",
is_match: 1,
skill_id: "eb5a1906-da4f-4ed3-982d-404b7eed8984",
id: "4752a33c-00fb-4721-8ef8-d8cd505ff510"
}],
meta_process_milliseconds: 39
}
}
```
**請求示例正確**
http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=確認
(前提是要求刪除瓶子)
返回結果
```json
{
code: 0,
msg: "ok",
result: {
_text: "確認",
msg_id: "e28fe0a7-5343-47a2-8399-6c5e352e1c9e",
intents: [{
parameters: {
blockedLimit: "5",
blockedTime: "5"
},
action: "標為垃圾",
name: "撈瓶子and看回復-快刪-確認",
result: {
code: 200,
response: {
code: 1,
msg: "失敗null"
},
text: " 好的,感謝您對海洋環境的支持。",
type: "dialog"
},
outputs: [{
type: "wechat.text",
property: {
text: " 好的,感謝您對海洋環境的支持。"
}
},
{
type: "voice",
property: {
name: "[3100] 綜合音效庫-玻璃秋天碎片到大1(glass-f_愛給網_aigei_com.mp3",
voice_url: "https://qiniu.ruyi.ai/FpQQ6osBq4VzzM1exWwjoqUZpeq5/[3100] 綜合音效庫-玻璃秋天碎片到大1(glass-f_愛給網_aigei_com.mp3"
}
},
{
type: "dialog",
property: {
text: " 好的,感謝你對海洋環境的支持。",
emotion: "positive"
}
}
],
score: "1.0",
scoreColor: "c4",
is_match: 1,
skill_id: "eb5a1906-da4f-4ed3-982d-404b7eed8984",
id: "7ae8fcc0-2de0-4337-acad-4b3d1507c738"
}],
meta_process_milliseconds: 124
}
}
```
**請求示例正確**
http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=取消
(前提是要求刪除瓶子)
返回結果
```json
{
code: 0,
msg: "ok",
result: {
_text: "取消",
msg_id: "afd16361-203e-460d-9f20-8e937d025942",
intents: [{
parameters: {},
action: "dialog",
name: "撈瓶子and看回復-快刪-取消",
result: {
text: "好的,不投訴的話就幫你扔回大海了。咱們繼續撈瓶子吧",
type: "dialog"
},
outputs: [{
type: "wechat.text",
property: {
text: "好的,不刪的話就幫您扔回大海了"
}
},
{
type: "dialog",
property: {
text: "好的,不投訴的話就幫你扔回大海了。咱們繼續撈瓶子吧",
emotion: "positive"
}
}
],
score: "1.0",
scoreColor: "c4",
is_match: 1,
skill_id: "eb5a1906-da4f-4ed3-982d-404b7eed8984",
id: "009c207e-1395-4e22-b0e2-180a2b454870"
}],
meta_process_milliseconds: 38
}
}
```
**請求示例正確**
http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=查看消息
(查看消息)
返回結果
```json
{"code": 0,
"msg": "ok",
"result"{
"_text": "查看消息",
"msg_id": "c6917f72-e7c2-4290-9a20-070cef8f9054",
"intents": [
{
"parameters": {
"service": "current bottle"
},
"action": "查看回復",
"name": "漂流瓶需要傳遞id(請勿修改)看回復",
"result": {
"timeStart": "1535682234970",
"ownerId": "ruyi-test-b8a63b4e-ae71-4ea4-afe0-321a28390522",
"textStart": "打開詩詞大會",
"currentText": "不會",
"id": "e0b97cfc1520b6c40a816fe84d3c3f08",
"timeFished": "1537950631884",
"fisherId": "12345",
"timeSendMessage": "1537950658584",
"replyText": "打開詩詞大會",
"isChecked": "true",
"needToReplyNum": "3",
"visitTimes": 14
"text": "你有3消息未回復,聽完消息要回復的話跟我說回復,不喜歡可以投訴。\\n你扔的瓶子“打開詩詞大會”的回復內容是:不會",
"type": "dialog"
},
"outputs": [
{
"type": "wechat.text",
"property": {
"text": "你有3消息未回復,聽完消息要回復的話跟我說回復,不喜歡可以投訴。\\n你扔的瓶子“打開詩詞大會”的回復內容是:不會"
}
},
{
"type": "dialog",
"property": {
"text": "。你扔的瓶子打開詩詞大會的回復內容是:",
"emotion": "calm"
}
}
],
"score": "1.0",
"scoreColor": "c4",
"is_match": 1,
"skill_id": "b8a63b4e-ae71-4ea4-afe0-321a28390522",
"id": "f43bc859-dda4-4e13-ab71-4caf0456726e"
}
],
"meta_process_milliseconds": 129
}
```
**請求示例退出**
http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=退出
(退出游戲)
返回結果
```json
{"code": 0,
"msg": "ok",
"result"{
"_text": "退出",
"msg_id": "5fa46f7d-1030-42af-805a-92a09f57d461",
"intents": [
{
"parameters": {
"service": "current bottle"
},
"action": "退出",
"name": "退出如意技能",
"result": {
"timeStart": "1535682234970",
"ownerId": "ruyi-test-b8a63b4e-ae71-4ea4-afe0-321a28390522",
"textStart": "打開詩詞大會",
"currentText": "不會",
"id": "e0b97cfc1520b6c40a816fe84d3c3f08",
"timeFished": "1537950631884",
"fisherId": "12345",
"timeSendMessage": "1537950658584",
"replyText": "打開詩詞大會",
"isChecked": "true"
"text": "你即將離開漂流瓶,歡迎下次再來~",
"type": "dialog"
},
"outputs": [
{
"type": "wechat.text",
"property": {
"text": "你即將離開漂流瓶,歡迎下次再來~"
}
},
{
"type": "dialog",
"property": {
"text": "你即將離開漂流瓶,歡迎下次再來~",
"emotion": "calm"
}
}
],
"score": "1.0",
"scoreColor": "c4",
"is_match": 1,
"skill_id": "b8a63b4e-ae71-4ea4-afe0-321a28390522",
"id": "dedb3efe-df63-4b56-b7df-6e1e80c4f85c"
}
],
"meta_process_milliseconds": 248
}
```
**詳細參數說明**
|名稱|類型|說明|
|:---|:---|:---
|service | String |服務名稱
|throwNum| String |用戶可以扔瓶子的次數
|fishingNum| String |用戶可以撈瓶子的次數
|blacklist| String |用戶說敏感詞的次數
|optionTime |String |用戶上次拋扔瓶子的時間
|timeStart |String |用戶扔出瓶子的初始時間
|ownerId| String |扔瓶子用戶的ID
|textStart| String |扔瓶子時瓶子的初始內容
|id |String |瓶子的唯一標示
|timeFished |String |用戶撈起瓶子的時間
|fisherId |String| 撈瓶子用戶的ID
|currentText| String| 瓶子內待查看的文字信息
|audioId |String |瓶子內語音文件ID
|replyText |String| 瓶子內上次被回復的文字信息
|checkTimes| String |用戶調用該接口的次數
|playTimes |int| 用戶進入游戲的次數
|timeSendMessage| String |用戶回復消息的時間
|text |String| 用戶回復消息的內容
|currentText |String |瓶子內待查看的文字信息
|replyText |String |瓶中被回復的消息內容
**指令清單**
|指令名稱|范例|
|:---|:---
|喚醒 | 打開漂流瓶
|撈瓶子 | 撈瓶子
|回復別的用戶發來的消息 | 回復
|瓶子放回海里|扔回海里
|扔瓶子| 扔瓶子
|許愿 | 世界和平
|查看消息 | 查看消息
|刪除 | 刪除瓶子
|確認刪除 | 確認
|取消刪除 | 取消
|退出 | 退出
- 1. 海知智能第三方技能插件開放平臺概述
- 2. 快速接入API
- 2.1 硬件接口調用
- 2.2 快速接入微信
- 2.3 API接入常見問題
- 3. 技能插件
- 3.1 基礎能力類
- 頂級過濾器
- 用戶知識圖譜
- 機器人檔案
- 通用閑聊
- 兒童閑聊
- Smart Reply
- 輕量閑聊
- 3.2 語音游戲類
- 成語接龍
- 詞匯樂園
- 詞語接龍
- 鸚鵡學舌
- 動腦猜猜
- 挑戰單詞
- 冒險世界
- 猜猜我是誰
- 阿拉丁學詩詞
- 貓貓托管所
- 漂流瓶
- 詩詞大會
- 國學大會
- 我愛猜歌名
- 我在看著你
- 燈謎猜猜
- 3.3 休閑娛樂類
- 星座運勢
- 悅耳聲音
- 幸運簽
- 調教機器人
- 娛樂推送
- 3.4 生活服務類
- 黃歷
- 計算器
- 古詩詞
- 時間詢問
- 翻譯類技能
- 天氣資訊
- 日程創建
- 日程創建指令
- 鬧鐘
- 食材知識
- 冥想音樂
- 格言
- 每日英語
- 漢語詞典
- 豆果菜譜
- 古文翻譯
- 3.5 音頻點播類
- 喜馬拉雅FM
- 新聞廣播
- 音樂點播
- Smart Music
- 兒童聽聽
- Smart Audio
- 兒童笑話
- 點播控制指令
- 3.6 視頻點播類
- 影視點播
- 3.7 百科知識類
- 人物百科
- 百科問答
- 實時百科
- 3.8 體育健康類
- 五分鐘健身
- 4. 開發者初級教程
- 4.1 開通服務
- 4.2 創建機器人
- 4.3 設置機器人
- 4.4 獲取技能插件
- 4.5 讓機器人學會聊天
- 4.6 導入知識庫
- 4.7 多種問答形式
- 4.8 數據統計
- 4.9 粉絲管理
- 5. 開發者中級教程
- 5.1 詞典運用
- 5.2 意圖處理
- 5.3 暗號使用
- 5.4 事件觸發
- 5.5 優先級
- 5.6 觸發器
- 5.7 快捷鍵
- 5.8 意圖報錯
- 6. 開發者高級教程
- 6.1 handlebars模版語言
- 6.2 JavaScript簡單介紹
- 6.3 JavaScript使用說明
- 6.4 JavaScript使用案例
- 6.5 JavaScript常見問題
- 7. 快速發布技能
- 8. 幫助中心
- 8.1 常見概念
- 8.2 幫助視頻
- 8.3 聯系我們