Skip to content

0.3 | Admin Bot API

Liu Yuxuan edited this page Dec 11, 2021 · 1 revision

Admin APIs are only accessible by authorized users. Requests should bear a token in request headers.

GET /admin/bot

Get a well-formatted bot message-reply array. Query on messages is optional. Query on replies only works when there is a query on messages. The queried replies and their message will be added onto the previous queried message list.

query: The constraints on messages. { key: value } The supported keys are all keys message has and replyId, replyContent, replyLabel

return: The message-reply array that satisfies the query constraints. [ Message ]

POST /admin/bot/message

Create a Message.

body: A Message to create. { content: str, label (optional): str }

return: The created Message. { _id: id, content: str, label: str }

PUT /admin/bot/message

Edit a Message.

body: The Message to edit. { _id: str, content (optional): str, label (optional): str }

return: The edited Message. { _id: id, content: str, label: str }

DELETE /admin/bot/message

Delete a Message.

body: The Message to delete. { _id: str }

return: The deleted Message. { content: str, label: str }

POST /admin/bot/reply

Create a Reply.

body: A Reply to create. { content: str, label (optional): str, fromMessage: str, toMessage (optional): str }

return: The created Reply. { _id: id, content: str, label: str, fromMessage: str, toMessage: str }

PUT /admin/bot/reply

Edit a Reply.

body: The Reply to edit. { _id: str, content (optional): str, label (optional): str, fromMessage (optional): str, toMessage (optional): str }

return: The edited Reply. { _id: id, content: str, label: str, fromMessage: str, toMessage: str }

DELETE /admin/bot/reply

Delete a Reply.

body: The Reply to delete. { _id: str }

return: The deleted Reply. { content: str, label: str, fromMessage: str, toMessage: str }

Workflow

GET /admin/bot/workflow

Get data for workflow graph.

return: The workflow as the demanded format.

API Request Query Request Body Response Entity Description
GET /admin/bot _id, content, label, replyId, replyContent, replyLabel The message-reply array that satisfies the query constraints:[ Message ] Get a well-formatted bot message-reply array. Query on messages is optional. Query on replies only works when there is a query on messages. The queried replies and their message will be added onto the previous queried message list.
POST /admin/bot/message { content: str, label (optional): str } The created Message. { _id: id, content: str, label: str } Create a Message.
PUT /admin/bot/message { _id: str, content (optional): str, label (optional): str } The edited Message. { _id: id, content: str, label: str } Edit a Message.
DELETE /admin/bot/message { _id: str } The deleted Message. { content: str, label: str } Delete a Message.
POST /admin/bot/reply { content: str, label (optional): str, fromMessage: str, toMessage (optional): str } The created Reply. { _id: id, content: str, label: str, fromMessage: str, toMessage: str } Create a Reply.
PUT /admin/bot/reply { _id: str, content (optional): str, label (optional): str, fromMessage (optional): str, toMessage (optional): str } The edited Reply. { _id: id, content: str, label: str, fromMessage: str, toMessage: str } Edit a Reply.
DELETE /admin/bot/reply { _id: str } The deleted Reply. { content: str, label: str, fromMessage: str, toMessage: str } Delete a Reply.
GET /admin/bot/workflow The workflow as the desired format. Get data for workflow graph.