I am using aws-amplify (https://aws-amplify.github.io/docs/js/interactions#using-with-react) library with react-native to develop a voice chat bot,it's working fine with text chat but when I send a voice input to the bot it doesn't work.Every time I am getting a reply "Speak into the mic" and a error "5/Client side error".
I have installed all the peer dependencies require for the voice interaction as describe in the doc, but still I am not getting the proper reply.
Amplify.configure({
Auth: {
identityPoolId: 'us-east-1:e058a291-xxx-xxxx-xxxx-xxxxxxxx',
region: 'us-east-1'
},
Interactions: {
bots: {
"OrderFlowers": {
"name": "OrderFlowers",
"alias": "$LATEST",
"region": "us-east-1",
"userId": "0f1a42ce-xxxx-xxxx-xxxx-xxxxxxxxx",
},
}
}
});
export default class Home extends Component {
state = {
botName: 'OrderFlowers',
welcomeMessage: 'Welcome, what would you like to do today?',
};
constructor(props) {
super(props);
this.handleComplete = this.handleComplete.bind(this);
}
static navigationOptions = ({ navigation }) => ({
header:null
});
handleComplete(err, confirmation) {
if (err) {
Alert.alert('Error', 'Bot conversation failed', [{ text: 'OK' }]);
return;
}
Alert.alert('Done', JSON.stringify(confirmation, null, 2), [{ text: 'OK' }]);
this.setState({
botName: 'OrderFlowers',
});
return 'Flower Ordered Successfully..!! THANK YOU';
}
render() {
const { botName, showChatBot, welcomeMessage } = this.state;
return (
<SafeAreaView style={styles.container}>
<ChatBot
botName={botName}
welcomeMessage={welcomeMessage}
onComplete={this.handleComplete}
clearOnComplete={true}
styles={StyleSheet.create({
itemMe: {
color: 'red'
}
})}
voiceEnabled={true}
voiceLibs={voiceLibs}
conversationModeOn={true}
/>
</SafeAreaView>
);
}
}