REST API Chatbot
Last updated
Last updated
MechCloud REST API Chatbot is a general purpose chatbot which can be used to query and manage resources in any system which exposes its control plane / administration over a REST API. It has support for the following systems / REST APIs at this moment (this list will be updated from time to time) -
Cloudflare
MongoDB Atlas API
The goal behind this chatbot is to build a universal chatbot which can be used with any REST API to query/manage its resources and where onboarding of a new REST API or updating the specification for an already onboarded REST API is fully automated.
It uses MechCloud OpenID Connect Proxy to invoke the REST API of the target system without storing any short/long term credentials for the target system.
Follow the instructions in the readme file to deploy this proxy in your Cloudflare account. Instructions for creating an account for a supported system in MechCloud OIDC Proxy can be found on the respective page for a system under this section.
Each REST API account registered in MechCloud OIDC proxy must have a unique id which is specified against id
attribute while registering the account. Make a note of it as it will be required to register this account in MechCloud.
Login to MechCloud console.
Navigate to Infrastructure -> REST Accounts.
Click on New REST Account button.
Choose a system (e.g. cloudflare, mongodb etc).
Enter a name for the account.
Enter the id
against Account ID field which you had specified while registering this account in MechCloud OIDC proxy.
As you query the resources, these are added to the smart context menu automatically which can be activated by pressing /
key. This helps you to select and use the name(s) of parent resource(s) in the prompt instead of their ids while querying children resources. This eliminates the need of copying parent resources' ids from the responses of previous prompts while querying children of such resources.
E.g. when you query all your accounts for cloudflare using list all the accounts
prompt, it will display all the accounts associated with your logged in email id and all such accounts will be added to the context menu as well. Now instead of using 'show all list under <account_id> account' prompt, where account_id
is the unique id assigned by cloudflare to your account, you can actually type show all lists under
, press /
key and choose the desired account from the content menu. This will insert the name of the target account at the current cursor position in @<account_name>
format. After querying all the lists under an account, you can then use list all the items under @<list_name> list of @<account_name> account
prompt to list all the items in a custom list. However, instead of typing list name and account name in this prompt, you can use smart context menu to insert these automatically.
Items in the smart context menu are grouped by resource types (e.g. account, custom list etc). So when you query all account, first group will contain all the accounts. Query custom list under a account will push all children custom lists for a particular account in the second group and so on. Root resources (account in case of cloudflare) are displayed on the top in the context menu and queried direct / indirect children will be shown below the parent resources in their respective group in the smart context menu.
You can use following variables in your prompts which will be replaced with corresponding values before posting a prompt to the MechCloud backend. All such variables must be specified in @<variable_name>
format in the prompt.
CURRENT_IP
Injecting ip of the machine in a prompt where the prompt is executed from. Useful for updating machine ip in firewall / ip access lists. This eliminates the need of first getting public ip of your local machine and then updating it in a prompt every time local machine ip address changes and you need to update it in various firewall rules / ip access lists etc.