Bots

A Bot object in Moxtra provides the following properties:

Name Description Example
client_id The client id of bot NTBjZDQyYjI
name The name of bot verify
created_time The timestamp, when the bot object was created. 1502152206820
updated_time The timestamp, when the bot object was updated. 1502152206820
Name Description Example
id The user id of bot user UNKtpcOF6p13Td9zda8oHQ2
name The user name of bot user New bot
type The user type of bot user USER_TYPE_BOT
disabled The status of bot user false

List Org Enabled Bots

Get org enabled bot list identified by {user_id} and {org_id}.

GET /{user_id}/orgs/{org_id}/bots

Sample Request

GET /me/orgs/UyITkLedXvFJEkJDdJsasF9/bots

Sample Response

{
    "code": "RESPONSE_SUCCESS",
    "data": {
        "bots": [
            {
                "client_id": "M2UyMDEzYzk",
                "created_time": 1506481082770,
                "updated_time": 1506481082770,
                "name": "New bot",
                "user": {
                    "id": "UNKtpcOF6p13Td9zda8oHQ2",
                    "name": "New bot",
                    "type": "USER_TYPE_BOT",
                    "disabled": false
                }
            },
            {
                "client_id": "ZGUxNmVhZDg",
                "created_time": 1506497931759,
                "updated_time": 1506497931759,
                "name": "123333123",
                "user": {
                    "id": "CU4wJHfurXHDCEi7QKtPWszE",
                    "name": "123333123",
                    "type": "USER_TYPE_BOT",
                    "disabled": false
                }
            }
        ]
    }
}

Add Bot Users to Binder

Add bot users into the binder whose owner is in the same org as the current user identified by {binder_id}. A bot_installed event gets generated and sents to Bot application.

POST /{binder_id}/bots

JSON Parameters
Name Type Description
id (In user of users array) String Bot user id to be added.
Sample Request
POST /B7V4ze37oO08PYO70973lX6/bots
{
    "users": [
    {
        "user": {
            "id": "CU4wJHfurXHDCEi7QKtPWszE"
        }
    }
    ]
}
Sample Response
{
    "code": "RESPONSE_SUCCESS"
}

Remove Bot User from Binder

Remove the bot user from a binder identified by {binder_id} and bot {user_id}. A bot_uninstalled event gets generated and sents to Bot application.

DELETE /{binder_id}/bots/{user_id}

Sample Request
DELETE /B7V4ze37oO08PYO70973lX6/bots/CU4wJHfurXHDCEi7QKtPWszE
Sample Response
{
    "code": "RESPONSE_SUCCESS"
}