Welcome to Voiceflow's API Project!
Congrats on making it to this part of the interview process. 🥳
The goal of this project is to create a local Node.js server that interfaces a Voiceflow project with another service.
It’ll help you gain a much better understanding of how conversational interfaces work and how Voiceflow plugs into that flow.
Make sure you have Node.js and yarn on your computer.
Clone this repository (keep your repo private).
to install all dependencies (node_modules) :
yarn install
to start the server on http://localhost:4000 :
yarn start
if your http://localhost automatically resolves to https://localhost - try on incognito mode or a different browser
Go on http://localhost:4000, you should see a chat window like this:
If you try typing something, it will always respond back with "hello world!" and "goodbye". This is because the backend hasn't been fully implemented.
Login/sign up for Voiceflow Creator, and build a simple Custom Assistant project. If you need inspiration you can check out Project Templates. Test it out on Voiceflow to make sure it's working!
On the "Launch" tab of your Voiceflow project, you'll be able to get the API key. Click here for documentation on the Voiceflow API.
In your app.ts
we can see that there is a app.post('/message', (req, res) => ...)
Express endpoint. This is what needs to be completed.
Read the Voiceflow Dialog Management Stateless API documentation:
https://www.voiceflow.com/api/dialog-manager
⚠️ make sure to use the Stateless API - do not use the State API
Use the Voiceflow API to hook up your Voiceflow Project to the POST /message
endpoint.
Whenever you send something on the frontend you will notice that it logs the req.body
- containing a message: string
and userID: string
. The userID
is unique per tab. If you open a new tab to http://localhost:4000 you will get a different userID
. This emulates different people from all over the world using this chat service.
The goal of this exercise is the manage user states: Ensure that distinct users have distinct conversations
Here we are using an HTML/CSS/Jquery frontend to display the conversation. Instead you can pick any conversational platform where people can converse back and forth with a bot, such as - discord, slack, messenger, etc.
You can use this platform as your frontend instead, and set up your backend to interface your Voiceflow project with this platform. Ensure that this platform has an API or SDK that allows a Node.js server to receive a webhook request, and reply back.
If you choose this option, there's no need to fork this repo, you can start off with a template repo for the platform you picked.
There is usually some additional setup involved with these platforms. If you are looking for something easy and quick to set up, try telegram (you need to install the app and message the "Botfather")
These platforms will always send a unique userID/sessionID per request.
Ensure that distinct users have distinct conversations
there's no brownie points for doing this alternative option instead of the standard. It is useful if you've created a bot with the platform before - and it's also more practical than a mock html chat.
Unless you get fancy and go off the rails (which isn't a bad thing 👍) this project takes around ~2-3 hours if you are familiar with the stack. Keep in mind this isn't a race to get it done - it's about getting it done well.
- use Typescript proficiently
- use repeatable, scalable patterns
- make your backend structure go beyond just
app.ts
- account for edge cases
- manage sensitive data securely
- manage different user session states well
- implement some level of tests
Send the link to your working repository to your recruiter's email.