Skip to content

Commit

Permalink
Uses new Recast API (dialog instead of converse) to be compatible wit…
Browse files Browse the repository at this point in the history
…h new Recast bots
  • Loading branch information
Paolo Escobar committed Dec 11, 2017
1 parent 06cad78 commit 652f230
Show file tree
Hide file tree
Showing 2 changed files with 2,585 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ console.log('Loading function')
const r = require('recastai').default
const request = require('request')

const recastClient = new r(process.env.REQUEST_TOKEN)
const recastClient = new r.build(process.env.REQUEST_TOKEN)

let sessionId = null
let endConv = false
Expand Down Expand Up @@ -32,7 +32,7 @@ let handleAlexaMessage = (text) => {
]

// Send input to Recast.AI
recastClient.request.converseText(text, { conversationToken: sessionId })
recastClient.dialog({ 'type': 'text', content: text}, { conversationId: sessionId })
.then((res) => {

console.log(res)
Expand All @@ -44,7 +44,7 @@ let handleAlexaMessage = (text) => {
}

// reply to Alexa
alexaReply(res.replies.join(' '))
alexaReply(res.messages[0].content)
})
.catch((err) => {
console.error(err)
Expand Down
Loading

0 comments on commit 652f230

Please sign in to comment.