This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import { View, Text, StyleSheet } from 'react-native'; | |
| import { GiftedChat } from 'react-native-gifted-chat'; | |
| import { Dialogflow_V2 } from 'react-native-dialogflow'; | |
| import { dialogflowConfig } from './config'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "responseId":"xxxx-xxx-4087-8df8-9f515xxxxxx2b-6xxxxx", | |
| "queryResult":{ | |
| "queryText":"Pick loop 2020", | |
| "parameters":{ | |
| "yoyos":"loop2020" | |
| }, | |
| "allRequiredParamsPresent":true, | |
| "outputContexts":[ | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "responseId":"xxxxx5cf-510c-xxxx-ae21-5d93e71xxxxxxxx", | |
| "queryResult":{ | |
| "queryText":"What do you have", | |
| "parameters":{ | |
| "yoyos":[ | |
| ] | |
| }, | |
| "allRequiredParamsPresent":true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { parameters, outputContexts } = req.body.queryResult; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const BASE_URL = 'YOUR NGROK HTTPS URL'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd server | |
| nodemon server.js | |
| ~/ngrok http 5000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| react-native run-android | |
| react-native run-ios |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git clone https://github.com/anchetaWern/RNDialogflowEcommerceBot.git | |
| cd RNDialogflowEcommerceBot | |
| git checkout starter | |
| yarn | |
| react-native eject | |
| react-native link react-native-dialogflow | |
| react-native link react-native-voice |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| else if (parameters.specs) { | |
| const yoyo_id = outputContexts[0].parameters.yoyos.replace(/ /g, ''); | |
| const spec = parameters.specs; | |
| let spec_value = yoyos.find(item => item.id == yoyo_id)[spec]; | |
| let payload = { is_url: false }; | |
| if (spec == 'image') { | |
| spec_value = `${BASE_URL}/images/${spec_value}` | |
| payload = { | |
| is_url: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (parameters.yoyos && parameters.yoyos.length) { | |
| return res.json({ | |
| fulfillmentText: `What would you like to know about ${parameters.yoyos}?` | |
| }); | |
| } |