Package com.chatopera.bot.sdk
Class Chatbot
java.lang.Object
com.chatopera.bot.sdk.Chatbot
Chatopera聊天机器人
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.json.JSONObject
Deprecated.use `Chatbot#command` API instead, removed in 2020-10核心访问接口核心访问接口org.json.JSONObject
conversation
(String userId, String textMessage) Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
conversation
(String userId, String textMessage, double faqBestReplyThreshold, double faqSuggReplyThreshold) Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
details()
Deprecated.use `Chatbot#command` API instead, removed in 2020-10boolean
exists()
Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
faqcategorycreate
(String label, String parentId) Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
faqcategorydelete
(String value) Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
faqcategoryupdate
(String value, String label) Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
faqdisable
(String id) Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
faqextendcreate
(String id, String post) Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
faqextenddelete
(String id, String extendId) Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
faqextendupdate
(String id, String extendId, String post) Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
Deprecated.use `Chatbot#command` API instead, removed in 2020-10int
getPort()
org.json.JSONObject
Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
intentsession
(String sessionId) Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
intentsession
(String userId, String channel) Deprecated.use `Chatbot#command` API instead, removed in 2020-10boolean
Deprecated.use `Chatbot#command` API instead, removed in 2020-10void
Deprecated.use `Chatbot#command` API instead, removed in 2020-10void
Deprecated.use `Chatbot#command` API instead, removed in 2020-10org.json.JSONObject
users
(int page, int pageSize) Deprecated.use `Chatbot#command` API instead, removed in 2020-10
-
Constructor Details
-
Chatbot
public Chatbot(String clientId, String clientSecret, String baseUrl) throws ChatbotException, MalformedURLException 创建聊天机器人实例,登录 https://bot.chatopera.com 获得 clientId 和 clientSecret- Parameters:
clientId
-clientSecret
-baseUrl
-- Throws:
ChatbotException
MalformedURLException
-
Chatbot
创建聊天机器人实例,登录 https://bot.chatopera.com 获得 clientId 和 clientSecret- Parameters:
clientId
-clientSecret
-- Throws:
MalformedURLException
ChatbotException
-
-
Method Details
-
getSchema
-
getHostname
-
getPort
public int getPort() -
getBaseUrl
-
command
public Response command(String method, String path, org.json.JSONObject payload) throws ChatbotException 核心访问接口- Parameters:
method
- PUT, POST, GET, DELETE, etc.path
- /faq/xxxpayload
- JSONObject body- Returns:
- Throws:
ChatbotException
-
command
核心访问接口- Parameters:
method
- PUT, POST, etc.path
- /faq/xxxx- Returns:
- Throws:
ChatbotException
-
details
Deprecated.use `Chatbot#command` API instead, removed in 2020-10获取聊天机器人详情- Returns:
- JSONObject
- Throws:
ChatbotException
-
exists
Deprecated.use `Chatbot#command` API instead, removed in 2020-10通过ChatbotID检查一个聊天机器人是否存在- Returns:
- Throws:
ChatbotException
-
conversation
Deprecated.use `Chatbot#command` API instead, removed in 2020-10和机器人对话- Parameters:
userId
- 用户唯一标识textMessage
- 文字消息- Returns:
- Throws:
ChatbotException
-
conversation
public org.json.JSONObject conversation(String userId, String textMessage, double faqBestReplyThreshold, double faqSuggReplyThreshold) throws ChatbotException Deprecated.use `Chatbot#command` API instead, removed in 2020-10和机器人对话- Parameters:
userId
-textMessage
-faqBestReplyThreshold
-faqSuggReplyThreshold
-- Returns:
- Throws:
ChatbotException
-
faq
Deprecated.use `Chatbot#command` API instead, removed in 2020-10检索知识库- Parameters:
userId
- 用户唯一标识textMessage
- 文字消息- Returns:
- Throws:
ChatbotException
-
faq
public org.json.JSONObject faq(String userId, String textMessage, double faqBestReplyThreshold, double faqSuggReplyThreshold) throws ChatbotException Deprecated.use `Chatbot#command` API instead, removed in 2020-10检索知识库- Parameters:
userId
-textMessage
-faqBestReplyThreshold
-faqSuggReplyThreshold
-- Returns:
- Throws:
ChatbotException
-
faqlist
public org.json.JSONObject faqlist(String query, String category, int page, int pageSize) throws ChatbotException, UnsupportedEncodingException, UnsupportedEncodingException Deprecated.use `Chatbot#command` API instead, removed in 2020-10查询知识库列表- Parameters:
query
- 查询语句category
- 分类,使用父分类会将子分类的内容同时检索出来page
- 页码,默认为1pageSize
- 每页数据条数,默认 30- Returns:
- Throws:
ChatbotException
UnsupportedEncodingException
-
faqcreate
public org.json.JSONObject faqcreate(String post, String reply, boolean enabled, List<String> categories) throws ChatbotException Deprecated.use `Chatbot#command` API instead, removed in 2020-10创建知识库的问答对- Parameters:
post
- 标准问的问题reply
- 标准问的回答enabled
- 是否启用,默认为 falsecategories
- 类别,是分类标识的数组,并不支持分类名称,必须使用分类标识- Returns:
- Throws:
ChatbotException
-
faqdetail
Deprecated.use `Chatbot#command` API instead, removed in 2020-10获得知识库一条记录的详情- Parameters:
id
- 问答对唯一标识- Returns:
- Throws:
ChatbotException
-
faqupdate
public org.json.JSONObject faqupdate(String id, String post, String reply, boolean enabled, List<String> categories) throws ChatbotException Deprecated.use `Chatbot#command` API instead, removed in 2020-10更新知识库一条记录- Parameters:
id
- 问答对唯一标识post
- 问题reply
- 回复enabled
- 是否启用categories
- 类别,是分类标识的数组,并不支持分类名称,必须使用分类标识- Returns:
- JSONObject
- Throws:
ChatbotException
-
faqdisable
Deprecated.use `Chatbot#command` API instead, removed in 2020-10禁用知识库里一个问答对- Parameters:
id
- 问答对唯一标识- Returns:
- JSONObject
- Throws:
ChatbotException
-
faqenable
Deprecated.use `Chatbot#command` API instead, removed in 2020-10启用知识库里一个问答对- Parameters:
id
- 问答对唯一标识- Returns:
- JSONObject
- Throws:
ChatbotException
-
faqdelete
Deprecated.use `Chatbot#command` API instead, removed in 2020-10删除知识库的一条记录,标准问和扩展问都被物理性删除- Parameters:
id
- 问答对唯一标识- Returns:
- Throws:
ChatbotException
-
faqextend
Deprecated.use `Chatbot#command` API instead, removed in 2020-10查询知识库标准问的扩展问列表- Parameters:
id
- 问答对唯一标识- Returns:
- Throws:
ChatbotException
-
faqextendcreate
Deprecated.use `Chatbot#command` API instead, removed in 2020-10创建知识库标准问的扩展问- Parameters:
id
- 问答对唯一标识post
- 扩展问- Returns:
- JSONObject
- Throws:
ChatbotException
-
faqextendupdate
public org.json.JSONObject faqextendupdate(String id, String extendId, String post) throws ChatbotException Deprecated.use `Chatbot#command` API instead, removed in 2020-10更新知识库标准问的扩展问- Parameters:
id
- 问答对唯一标识post
- 扩展问- Returns:
- JSONObject
- Throws:
ChatbotException
-
faqextenddelete
Deprecated.use `Chatbot#command` API instead, removed in 2020-10删除知识库标准问的扩展问- Parameters:
id
- 问答对唯一标识extendId
- 扩展问唯一标识- Returns:
- Throws:
ChatbotException
-
faqcategories
Deprecated.use `Chatbot#command` API instead, removed in 2020-10获得知识库分类信息- Returns:
- Throws:
ChatbotException
-
faqcategorycreate
Deprecated.use `Chatbot#command` API instead, removed in 2020-10创建知识库分类- Parameters:
label
- 分类名称parentId
- 父节点的标识, 即上级分类的标识- Returns:
- Throws:
ChatbotException
-
faqcategoryupdate
Deprecated.use `Chatbot#command` API instead, removed in 2020-10更新知识库分类- Parameters:
value
- 知识库分类的标识label
- 知识库分类名称- Returns:
- Throws:
ChatbotException
-
faqcategorydelete
Deprecated.use `Chatbot#command` API instead, removed in 2020-10删除知识库分类- Parameters:
value
- 知识库分类的标识- Returns:
- Throws:
ChatbotException
-
intentsession
Deprecated.use `Chatbot#command` API instead, removed in 2020-10创建意图识别会话 此处支持请求生产版本- Parameters:
userId
- 用户唯一标识channel
- 渠道标识,代表不同渠道的唯一标识,比如QQ,公众号,开发者自定义- Returns:
- Throws:
ChatbotException
-
intentsession
Deprecated.use `Chatbot#command` API instead, removed in 2020-10获得指定意图识别会话ID的详情- Parameters:
sessionId
-- Returns:
- Throws:
ChatbotException
-
intent
public org.json.JSONObject intent(String sessionId, String userId, String textMessage) throws ChatbotException Deprecated.use `Chatbot#command` API instead, removed in 2020-10进行意图识别对话- Parameters:
sessionId
- 会话IDuserId
- 用户唯一标识,需要和创建会话时保持一致,否则会话会错乱textMessage
- 消息文本内容- Returns:
- Throws:
ChatbotException
-
users
Deprecated.use `Chatbot#command` API instead, removed in 2020-10获得聊天机器人用户列表- Parameters:
page
- 页面pageSize
- 页面大小- Returns:
- Throws:
ChatbotException
-
chats
Deprecated.use `Chatbot#command` API instead, removed in 2020-10根据用户ID获得聊天历史- Parameters:
userId
- 用户唯一标识page
- 页面pageSize
- 页面大小- Returns:
- Throws:
ChatbotException
-
mute
Deprecated.use `Chatbot#command` API instead, removed in 2020-10根据用户ID屏蔽一个用户- Parameters:
userId
- 用户唯一标识- Throws:
ChatbotException
-
unmute
Deprecated.use `Chatbot#command` API instead, removed in 2020-10根据用户ID取消屏蔽- Parameters:
userId
- 用户唯一标识- Throws:
ChatbotException
-
ismute
Deprecated.use `Chatbot#command` API instead, removed in 2020-10查看一个用户是否被屏蔽- Parameters:
userId
- 用户唯一标识- Returns:
- Throws:
ChatbotException
-