Today we are incredibly excited to unveil Motion AI’s new “Node.js Module” which gives anyone the ability to easily code complex chatbots directly within their browser, with no external servers required.

This integration was made possible thanks to AWS Lambda, with a spotlight announcement of our integration at AWS re:Invent today. Check out our documentation and sign up for free to get started — read on to learn more!

Our mission at Motion AI has always been simple — we want to make the process of training, structuring, and deploying chatbots as easy and as painless as possible.

The Motion AI platform is designed around the modular creation of bots, assembling various NLP building blocks to enable users to create any conversation flow desired. As we say, “if you can draw a flowchart, you can build a chatbot!”

Up until today, users looking to manipulate their Motion AI bots outside of our platform configured their own web servers to listen to and respond to webhooks.

With our new Node.js Module, this is no longer necessary. Whether you want to interact with an external database, connect with a third-party API, or do virtually anything else — there is no need to leave our platform.

Each Node.js function created through Motion AI is passed a payload object that contains metadata based on an end-user’s response to the bot. This data can be acted upon within the Node.js module to craft a bot response to be returned at the end of the function.

As a demonstration, let’s make a dynamic, API-backed trivia bot. You may test the end result on Facebook Messenger here.

To begin with, we structured a simple conversation flow that asks for the user’s name and greets them. Next, we ask them what difficulty they’d like to play at (Easy, Medium, Hard)

Because that is pretty basic stuff, dedicated Node.js Modules would be overkill. But in order to ask the user trivia questions, we want to pull from a large database of thousands of questions and answers (through a REST API), and that is where our Node.js Module comes in.

Once the user has selected a difficulty, we then pass them to one of three dedicated Node.js Modules: “Fetch Trivia — Easy”, “Fetch Trivia — Medium” or “Fetch Trivia — Hard”.

Each of these three modules are very similar in nature — they pull from separate databases of questions depending on the difficulty level.

Below you can see the code, with comments, used to retrieve easy trivia questions.

In this example, because our callback to Motion AI contains the key-value pair “continue = false”, Motion AI will continue to ping this same module until “continue” is no longer false. That is the desired functionality in this situation, where the trivia game can go on as long as the user desires.

Motion AI exposes a “customPayload” key that you may use to store and retrieve working background data. In this particular demonstration, we use this to store the last correct answer for any trivia question. This allows us to compare it against the user’s response (their answer) and determine whether or not they were correct.

Try the finished bot for yourself on Facebook Messenger here.

And just like that, we’ve created an API-backed trivia bot that will dynamically ask thousands of trivia questions. This particular bot demonstration took approximately 15 minutes to build.

Prior to our Node.js Module solution, users would be required to create a convoluted flow that either used webhooks to an intermediary server, or, they would have to manually input the thousands of trivia questions into our interface (pro tip: that would be extremely inefficient!)

Looking beyond the demonstration

The reality is that this demonstration only scratches the surface of what you can do. This opens the doors to quickly creating bots that can do everything from image recognition to machine learning, without ever leaving your web browser or setting up a server.

Bots are just one of a multitude of spaces where we anticipate serverless computing will play an increasingly important role. It goes without saying that we are very enthusiastic about the future of AWS Lambda, of serverless computing, and of the endless opportunities brought on by this amazing technological paradigm. We hope that you are just as excited as we are!

Signup on Motion AI to get started for free. We can’t wait to see what you build! Be sure to join our Slack Community to continue the conversation.