English English

Setting up the chatbot Go-neb for the messaging server Matrix

How to setup Go-neb (latest version). This is a chatbot (chat bot) 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).

I decided to update this tutorial because there is a new version of the chat bot Go-neb on Github. The installation procedure is now different, because the chat bot is now a Go module. The new version has also new services (bots) and the wikipedia bot was also fixed.

In this tutorial the chat bot 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

You need to have Go 1.14 or newer version. If that version is already installed and configured, this section can be skipped. GO can be downloaded from this website. Please download the latest version for Linux:


You can also use this tested scripted which download the latest Golang version for your operating system:

Then, add a soft link to your Go bin file:

ln -s /usr/local/go1.14.2.linux-amd64/bin/go go
ln -s /usr/local/go1.14.2.linux-amd64/bin/gofmt gofmt


Then set the paths on the operating system (if you did not use the above mentioned script). 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.

go env

Also the command "version" can be used to display the version of GO.


Installation of go-neb

Now go to your home folder path of your "Golang" ("Go") installation
If you are logged in root (used here in this example), then it is this folder.


It is "username" then "go/src". You can also go the your go installation path in "/usr/local".

Create this folder path in the folder "/root/go/src/" or your go home folder.

mkdir -p "github.com/matrix-org"

Change to the new created folder "github.com/matrix-org"

cd github.com/matrix-org

And then clone the go-neb Github repository:

git clone https://github.com/matrix-org/go-neb

Change back to the folder "github.com"

cd ..

Now, do the following step.

Create these folders:

mkdir -p "lib/pq"
mkdir -p "matrix-org/dugong"
mkdir -p "matrix-org/util"
mkdir -p "mattn/go-sqlite3"
mkdir -p "prometheus/client_golang"
mkdir -p "sirupsen/logrus"

Clone this Github repository "https://github.com/lib/pq.git" into the created folder:

git clone https://github.com/lib/pq.git lib/pq/

Clone this Github repository "https://github.com/matrix-org/dugong" into the created folder:

git clone https://github.com/matrix-org/dugong matrix-org/dugong

Clone this Github repository "https://github.com/matrix-org/util" into the created folder:

git clone https://github.com/matrix-org/util matrix-org/util

Clone this Github repository "https://github.com/mattn/go-sqlite3" into the created folder:

git clone https://github.com/mattn/go-sqlite3 mattn/go-sqlite3

Clone this Github repository "https://github.com/prometheus/client_golang" into the created folder:

git clone https://github.com/prometheus/client_golang prometheus/client_golang

Clone this Github repository "https://github.com/sirupsen/logrus" into the created folder:

git clone https://github.com/sirupsen/logrus sirupsen/logrus

Change to your go-neb folder.

cd matrix-org/go-neb

Now, you can build your go-neb Chat bot.

go build github.com/matrix-org/go-neb

This can take some time. You can go grab a coffee in the meantime :D


If the building process was done, then you can find the binary file (name: "go-neb") of your chat bot in this folder:


Please create a folder "bin" and move that binary file in the created folder "bin".

mkdir bin && mv go-neb bin/

Copy the full "go-neb" folder to a folder where you save your applications:

cp ~/go/src/github.com/matrix-org/go-neb /opt/ -R

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.

vim /etc/systemd/system/go-neb.service
Description=Go-neb bot for matrix-synapse server
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


Create a folder for the database of the chat bot.

mkdir /opt/go-neb/db


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.

  - 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. You have to create and your API keys.

# 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
  - ID: "giphy_service"
    Type: "giphy"
    UserID: "@goneb:localhost" # requires a Syncing client
      api_key: "XXXX"
      use_downsized: false

Now activate and start the newly created service.

systemctl enable go-neb
systemctl start go-neb



If you get the following error "start-limit-hit":

Apr 05 19:28:02 myserver systemd[1]: Failed to start Go-neb Bot For Synapse-Matrix server.
Apr 05 19:28:02 myserver systemd[1]: go-neb.service: Failed with result 'start-limit-hit'.

Solution: Reset your service with this command.

systemctl reset-failed go-neb

Further information

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 documentation): https://github.com/matrix-org/go-neb




We use cookies on our website. They are essential for the operation of the site