Go-neb is a chatbot that provides services such as The automatic sending of RSS news feeds, searching for GIF images or information from Wikipedia and many other functionalities. The chatbot is easy to set up and can then be used via the messaging client Riot (client for the matrix server).
In this tutorial the chatbot is installed with all its requirements. Root is used here. However, a previously running and configured Matrix Server instance is required. The installation of Matrix via "Prebuild Packages" is recommended. More information about installing and configuring Matrix: https://github.com/matrix-org/synapse/blob/master/INSTALL.md
Installation of GO
If GO is already installed and configured, this section can be skipped.
GO can be downloaded from this website. Please download the latest version for Linux:
Then unpack the downloaded file.
tar -zxvf go1.10.1.linux-amd64.tar.gz -C /usr/local/
Then set the paths on the operating system. The paths must point to the folder where GO was downloaded.
export GOROOT=/usr/local/go export PATH=$GOROOT/bin:$PATH
With this command you can check whether GO is now called and you can display all set paths for GO.
Instead, the version command can be used to display the version of GO.
Installation of go-neb
Change to the path where you want the program installed. The path /opt is used here because the program is installed manually.
Now use git to download the software.
git clone https://github.com/matrix-org/go-neb
The program gb must now be downloaded and installed in the folder go-neb.
go get -u github.com/constabulary/gb/...
Now you can install go-neb. Go-neb can be installed with the program gb. Gb must be called with the full path.
/root/go/bin/gb build github.com/matrix-org/go-neb
Configuration of go-neb
Now you have to create a user (go-neb) for the chatbot, which has no Sudo rights and can be used with the home directory /opt/go-neb
Create the group go-neb and add the user go-neb to this group. Don't forget to give access rights to the folder of the program go-neb for the now created user go-neb.
chown -R go-neb:go-neb /opt/go-neb
Create a new user in Matrix for the chatbot. Here the user bot is used for go-neb.
register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml https://localhost:8448
Go-neb can be executed directly using this command:
BIND_ADDRESS=:4050 DATABASE_TYPE=sqlite3 DATABASE_URL=go-neb.db?_busy_timeout=5000 BASE_URL=http://localhost:4050 bin/go-neb
Here, however, a system service for this program is created for production use.
[Unit] Description=Go-neb bot for matrix-synapse server After=network.target [Service] WorkingDirectory=/opt/go-neb ExecStart=/opt/go-neb/bin/go-neb StandardOutput=syslog StandardError=syslog SyslogIdentifier=go-neb User=go-neb Group=go-neb Environment=BIND_ADDRESS=localhost:4050 DATABASE_TYPE=sqlite3 DATABASE_URL=db/go-neb.db?_busy_timeout=5000 BASE_URL=http://localhost:4050 CONFIG_FILE=config.yaml Restart=always RestartSec=10 StartLimitInterval=900 StartLimitBurst=3 [Install] WantedBy=multi-user.target
Now configure the settings of the chatbot go-neb. The configuration file must be copied and can then be customized according to your needs.
cp config.sample.yaml config.yaml
The chat bot is set up in this section t. Multiple users (clients) can be used for the chat bot. Only one user is set up here. Please enter the AccessToken defined in the Matrix configuration. UserID corresponds to the user account in the Matrix server.
clients: - UserID: "@bot:localhost" AccessToken: "XXXXXXXXXXX" HomeserverURL: "http://localhost:8448" Sync: true AutoJoinRooms: true DisplayName: "Go-NEB Chatbot"
The functions of the chatbot can be set up in this section "services". You can also add your own services here. New Api keys have to be created. The Api keys in the configuration do not work.
# The list of services which Go-NEB is aware of. # Delete or modify this list as appropriate. # See the docs for /configureService for the full list of options: # https://matrix-org.github.io/go-neb/pkg/github.com/matrix-org/go-neb/api/index.html#ConfigureServiceRequest services: - ID: "giphy_service" Type: "giphy" UserID: "@goneb:localhost" # requires a Syncing client Config: api_key: "qwg4672vsuyfsfe" use_downsized: false
Now activate and start the newly created service.
systemctl enable go-neb systemctl start go-neb
There are other settings than those mentioned here. The functionality of Go-neb can also be extended by self-programmed services. For the service guggy there are no more API keys on the part of the operator.
Further information about Go-neb and the Go-neb API can be found on this website: https://matrix-org.github.io/go-neb/pkg/github.com/matrix-org/go-neb/
Github page of Go-neb (includes also documentations): https://github.com/matrix-org/go-neb