recast-gaction-connector is a npm library to help you connect your recast.ai bot to google action.
import {BotConnector} from "recast-gaction-connector"
let botConnector = new BotConnector({
//needed if you want to connect your user
gActionClientId: "",
//token to access your recast bot
recastBotToken: "",
//if true the connector will handle the request to go to the smartphone if you want to display a card
autoChangeSurface: true,
//Add 1s break between two text messages if true
pauseBetweenMessages: true,
//error message if an error append (if empty it close the conversation)
defaultErrorMessages: {"fr-FR": "Je n'ai pas compris. Pouvez-vous répéter ?"},
//if you want to override default google voice
voiceConfig: {
shortPunctuationMs: 200,
longPunctuationMs: 400,
rate: "100%",
pitch: '0st'
}
});
//...
function onRequest(req: Request, resp: Response){
return botConnector.handleRequest(req, resp)
}
To close the conversation in Google Action set CLOSE_CONVERSATION to true in the memory of Recast. The connector will close the conversation for you.
Refactor
- Handle Google Crawler intent to avoid a recast call
Fix
- Changelog
- Connector defaultErrorMessages config
Feature
- Map all type of recast response to google action
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.