Your bot is not running on Recast.AI. Recast.AI is a platform and an API where you can train a bot to understand users's input. But you need to create a script that received user's input and send it to Recast.AI API to analyse it.
Bot Connector helps you to connect your script to any channels (like messenger or slack) and receive all the user's input from these channels.
So you need to run your script (aka your bot) in local, with ngrok and set this URL in the bot connector interface to receive each messages from your users.
if you make your bot in NodeJs, your script will look like this:
npm install --save recastai recastai-botconnector express body-parser
your file index.js:
/* module imports */
const BotConnector = require('recastai-botconnector')
const recastai = require('recastai')
const express = require('express')
const bodyParser = require('body-parser')
/* Bot Connector connection */
const myBot = new BotConnector({ userSlug: 'YOUR_USER_SLUG', botId: 'YOUR_BOT_ID', userToken: 'YOUR_USER_TOKEN' })
/* Recast.AI API connection */
const client = new recastai.Client('YOUR_REQUEST_TOKEN')
/* Server setup */
const app = express()
const port = 5000
app.use(bodyParser.json())
app.post('/', (req, res) => myBot.listen(req, res))
app.listen(port, () => console.log('Bot running on port', port))
/* When a bot receive a message */
myBot.onTextMessage(message => {
console.log(message)
const userText = message.content.attachment.content
const conversationToken = message.senderId
client.textConverse(userText, { conversationToken })
.then(res => {
// We get the first reply from Recast.AI or a default reply
const reply = res.reply() || 'Sorry, I didn\'t understand'
const response = {
type: 'text',
content: reply,
}
return message.reply(response)
})
.then(() => console.log('Message successfully sent'))
.catch(err => console.error(`Error while sending message: ${err}`))
})
and run your bot
node index.js