This node.js example connector allows you to make your Teneo solution available as a bot on Discord. The connector acts as middleware between Discord and Teneo. The bot on Discord will respond to direct messages. In addition to that, you can configure it to respond to all messages in a specific channel.
You can find the source code for this connector on Github.
This guide will take you through the steps needed to make your Teneo bot available on Discord.
You need to have a discord account to create a Discord bot application. You also need admin access to a Discord server where you can add the bot.
Your teneo bot/solution needs to be published and you need to know the engine url.
Download or clone the connector source code from Github.
git clone https://github.com/artificialsolutions/tie-api-example-discord.git
npm install
Follow the instructions here to create a Discord bot application: Setting up a bot application
Make sure you remember the token, you will need it when you start the connector.
Also, the bot's username, which is formatted 'YourBot#1234' can be used later on to send Direct Messages to this bot.
Follow the instructions here to add the bot to your Discord server: Adding your bot to servers This involves opening a Bot inviting link in your browser which is contructed using the 'client_id' of the app that was obtained the previous step:
https://discord.com/oauth2/authorize?client_id=12345&scope=bot
Add the bot to an existing Server and authorize it. Create a Server if needed, by clicking on the '+' shaped Add Server button from the left menu of the Discord Chat.
Start the connector with the following environment variables:
To start the connector (replacing the environment variables with the appropriate values) use the following command:
DISCORD_TOKEN=<your_discord_token> DISCORD_CHANNEL=<discord_channel_name> TENEO_ENGINE_URL=<your_engine_url> node server.js
That's it! Your bot should now be available on your Discord server and respond to messages that are sent to it.
Was this page helpful?