Momento announces $15M Series A funding. Topics event bus released for general availability. Read more →
February 20, 2024 - 3 Min Read

Introducing RoboMo—A Discord bot powered by Momento Vector Index

Learn how we built RoboMo, Momento’s helpful question-answering Discord bot

Anita Ruangrotsakun


Important notice: Momento Vector Index has been deprecated in April of 2024.

Momento’s Developer Ecosystem engineers recently got together to brainstorm ways we can better support our customers and customer-facing colleagues. One brilliant idea of many: we could build a Discord bot named RoboMo to help us out! 

RoboMo serves as a friendly user interface for a question-answering system that uses Momento Vector Index (MVI) and OpenAI to provide answers based on Momento developer documentation and blog posts. RoboMo can respond to community questions on Discord at all hours of the day.

Example screenshot of RoboMo responding to Discord community

This article will provide an overview of how we built the RoboMo Discord bot. RoboMo will only be able to answer questions regarding Momento docs, but you can still follow along to build your own Discord bot to answer questions about any source material you ingest in your own MVI backend. 

Now let’s take a look at how Momento developed RoboMo!

Step 1: Create a Discord bot application

We followed the first step in the Discord Getting Started guide and created an application in the Discord developer portal. We stored the bot’s token in AWS Secrets Manager and enabled “MESSAGE CONTENT INTENT” in the “Privileged Gateway Intents” section to allow RoboMo to read the contents of messages sent on our Discord server.

Step 2: Create a discord.js client

To interact with the Discord API, we used the discord.js library. As seen in the code snippet below, we first created a discord.js client object and used the bot’s token to log in. We save the bot’s user ID and then listen for new events to occur on the server.

import {Client, GatewayIntentBits} from 'discord.js';

async function main() {
  let botId = '';
  const client = new Client({
    intents: [

  client.once('ready', readyClient => {
    console.log(`Logged in as ${readyClient.user.tag}!`);
    botId =;

  await client.login(YourDiscordBotToken);

Step 3: React to mentions

Next, we set up an event listener to handle “messageCreate” events. We check each message for a @RoboMo mention and make sure that it wasn’t sent by the bot itself. Then we make a POST request to send the message content to the question-answering API and pass the response back as a reply to the message received. 

client.on('messageCreate', async message => {
  if (message.mentions.users.has(botId) && ! {
    const fetchResponse = await fetch('https://your-Q&A-system-endpoint', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      body: JSON.stringify({input: message.cleanContent.replace('@RoboMo', '')}),
    const roboMoAnswer = await fetchResponse.json();
    await message.reply(roboMoAnswer['output']);

Step 4: Deploy the Discord bot

We fine-tuned the bot locally, then deployed it using AWS Fargate, a serverless option for running a desired number of Docker containers. This allows RoboMo to always be listening for mentions and ready to respond to questions. 

Wrapping Up

All of the code for the RoboMo API and Discord bot can be found in this GitHub repo. Specifically, the code for the Discord bot can be found in this file and CDK construct for deploying it on Fargate in this file.

Try chatting with RoboMo on Discord today and let us know what you think!