Implement Custom Bot
Company Request
Cotalker realizes that the Ruanda Company team uses the value of the uf and dolar a lot when chatting. So, they offer them another feature: every time they want to know the daily value of those economic indicators, they only send /uf or /dollar to show it in chat.
To do that cotalker will use the api of mindicador https://mindicador.cl/ . It is an open source service that provides economic indicators for Chile in JSON format. The source of information is the Central Bank of Chile.
They also have the following indicators:
- unemployment rate
- euro
- ipc (consumer's price index)
- bitcoin
- among other
Functional Requirements
Access Role
- User with the permission
admin-*-write
, which allows all to access to the admin. - User with the permissions
web-admin-write
andweb-admin-read
to set up in the admin. - User with the access role
read admin
.
User
- Having completed User Tutorial
Steps
- Access the
administrator
and openbots
- Press
+
button to create a new bot. - Set up the General Information, Access and Function sections:
Name
: UFUser bot name
: ufDescription
: ask for the price of the uf. Source: https://mindicador.cl/Access roles
: defaultGlobal
: ActiveIt's a survey command
: DeactiveIt's a slash command
: ActiveSlash command
: uf
- Set up the Routine builder
- Press
+ Add Stage
code
: uf_requesttype
: Network requestURL
: https://mindicador.cl/api/ufIf you search for this link in a browser, you will see the response in json formatMethod
: GET
- Press
+ Add Stage
code
: messagetype
: Send MessageContent
: $JOIN# #(Valor UF:)#($OUTPUT#uf_request#data|serie|0|valor)in $OUTPUT#uf_request#data you have access to the json response Content Type
: text/systemUser
: $VALUE#user|_idChannels
: $VALUE#channel|_id
Max. Iterations
: 10Initial Stage
: uf_request- Configure the uf_request stage:
Succed Output
: message
- Press
- Save
Now we will repeat the same step for the dollar request.
- Access the
administrator
and openbots
- Press
+
button to create a new bot. - Set up the General Information, Access and Function sections:
Name
: DolarUser bot name
: dolarDescription
: ask for the price of the dolar. Source: https://mindicador.cl/Access roles
: defaultGlobal
: ActiveIt's a survey command
: DeactiveIt's a slash command
: ActiveSlash command
: dolar
- Set up the Routine builder
- Press
+ Add Stage
code
: dolar_requesttype
: Network requestURL
: https://mindicador.cl/api/dolarMethod
: GET
- Press
+ Add Stage
code
: messagetype
: Send MessageContent
: $JOIN# #(Valor dolar:)#($OUTPUT#dolar_request#data|serie|0|valor)Content Type
: text/systemUser
: $VALUE#user|_idChannels
: $VALUE#channel|_id
Max. Iterations
: 10Initial Stage
: dolar_request- Configure the dolar_request stage:
Succed Output
: message
- Press
- Save
Result
The bot will be look like this:
