AWS QnA Bot Solution change the Alexa welcome message - amazon-web-services

I have an AWS QnA Bot that I am using with Alexa. The default welcome message for Alexa with this solution is:
"Hello, Please ask a question".
I'd like to change this to make it more personalized for my bot but I'm not sure where to make this change in the Lambda code.
I went into the Lambda function that the built-in tutorial told me to use for the Alexa Skill endpoint. Here, I found a section called get_welcome_message that looks like this:
async function get_welcome_message(req, locale){
console.log("=================" + JSON.stringify(req));
const welcome_message = _.get(req,'_settings.DEFAULT_ALEXA_LAUNCH_MESSAGE', 'Hello, Please ask a question');
if (_.get(req._settings, 'ENABLE_MULTI_LANGUAGE_SUPPORT')){
return await translate.get_translation(welcome_message,'en',locale,req)
} else {
return welcome_message;
}
}
I thought that changing the welcome_message would change it in the Alexa skill. However, no matter what I change it to, it will still say: "Hello, Please ask a question".
I've tried clearing my history/cache in case that was an issue. I've deployed the altered Lambda, rebuilt the AWS QnA Bot, and rebuilt the Alexa Skill. I've also looked through the Lambda and this function seems to be the only place where a welcome message is set. It looks like everything that requires the welcome message calls this middleware.
This seems like it should be a simple task to change but I just can't seem to get it to show a different welcome message.
Please let me know how I can change this default welcome message. I feel like it's something simple that I'm missing.

An easier approach would be to change the value of DEFAULT_ALEXA_LAUNCH_MESSAGE from Content Designer UI. This doesn't require any code changes.
You can find the instructions to access content designer here. Here is how you can change the settings.

Related

How to show textInput and keyboard programmatically

I'm in charge to a build a react-native chatbot app, that must help users to signup during the discussion.
The chat must start with a greeting message and few quick-replies, in which we find a "Sign me up" option. When the user presses that option, the bot asks hem to write an email address in order to start the process.
I've made a little project based on the example available on react-native-gifted-chat repository.
Please use this link to get to my code: https://github.com/firas1220/react-native-chatbot
I'd appreciate if someone gives some hand or maybe we can add improvements and transform the repo into something original 😉.
This question might help some people facing similar situations.
As an attachment, a demo in GIF image.
Just add an InputText (https://reactnative.dev/docs/textinput) and then to ref.current.focus()
Something like this:
const inputRef = useRef();
const onAction = () => {
inputRef.current.focus();
}
<InputText ref={inputRef} value=... />

I don't understand how my google action shows up on "Works with Google" search

I have followed below tutorial to build my own home action.
https://github.com/actions-on-google/smart-home-nodejs
I don't understand well on how this works. Let me explain you all about what I have understood so far and what I have done by now.
What I have DONE :
I built a conversational action (built with dialogflow's inline editor and intents) to change a data of the Firebase realtime database. (for instance, when I say "Turn the light on", then the Firebase data 'LED/OnOff' turns 0 to 1). Below is the code I have in my Dialogflow inline editor. (I have excluded the field including my project's credentials.)
'use strict';
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
admin.initializeApp();
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers));
console.log('Dialogflow Request body: ' + JSON.stringify(request.body));
function welcome(agent) {
agent.add(`Welcome to my agent!`);
}
function fallback(agent) {
agent.add(`I didn't understand`);
agent.add(`I'm sorry, can you try again?`);
}
function handle_heatOn(agent) {
const state = agent.parameters.heat_on;
console.log(state);
var heat = 0;
if (state == 1)
heat = 1;
return admin.database().ref('0/OnOff').update({
on : true
});
}
function handle_heatOff(agent) {
const state = agent.parameters.heat_on;
var heat = 0;
if (state == 0)
heat = 0;
return admin.database().ref('0/OnOff').update({
on : false
});
}
//some more functions, related to controlling 4 different devices (heater, cooler, exhaust fan, LED) - exempted
// Run the proper function handler based on the matched Dialogflow intent name
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set('heat_on', handle_heatOn);
intentMap.set('heat_off', handle_heatOff);
intentMap.set('cool_on', handle_coolOn);
intentMap.set('cool_off', handle_coolOff);
intentMap.set('exha_on', handle_exhaOn);
intentMap.set('exha_off', handle_exhaOff);
intentMap.set('led_on', handle_ledOn);
intentMap.set('led_off', handle_ledOff);
// intentMap.set('your intent name here', yourFunctionHandler);
// intentMap.set('your intent name here', googleAssistantHandler);
agent.handleRequest(intentMap);
});
Then I have deployed my action and Google has approved my action! It is now in production and can be searched in anyone's google account.
I have set up an OAuth 2.0 server. I'm really a beginner in developing, so I managed to use Auth0 to make the server. I have followed the below tutorial :
https://v3.jovo.tech/tutorials/google-action-account-linking-auth0
As a conclusion, when I invoke my conversational action in anyone's Google Assistant App, It will prompt the user to the authentication (login) screen (By Auth0). After the user inputs ID and Password, google assistant will link the user's account and launch my app.
However, my action is not shown on Google Home's "Works with Google" category. After trying to complete Brand Verification in Google Actions Console and linking one of my existent app on Google Play, I still don't know what to do or where to start from.
What I have understood so far :
Sorry for my shallow understanding in advance. I have understood that once my action is invoked by a user, it has to do account linking, which requires OAuth 2.0 server to exchange authentication token. If exchanging token has succeeded, the user's account is linked and he/she is able to use my action. The action will be launched after that.
I have searched the Internet and found some information such as Deep Linking and App Discovery, but I'm not sure this is the right keyword to start from.
I know I am really lacking in knowledge here. Please kindly at least hint where I should study and start.
What I want to understand and do :
I want to make my action, which is in production, show up on Google Home and Google Assistant App's "Works With Google" category without the prefix [test]. In other words, I want to let my app be searched just as the other company's apps. I understand that if you click on one of the apps of a company, your account will be linked and the company's action would be launched. Maybe I have to add some lines on Dialogflow's inline editor?? I know I might be silly, but I really appreciate your help. Thank you for reading my post.

AWS Amplify federated google login work properly on browser but dont work on Android

The issues are when I am trying to run federated authentication with the help of amplify auth method on the browser it works fine, but when I try to run it on my mobile.
It throws error No user found when I try to use Auth.currentSession() but the same work on the browser.
tried to search about this type of issue but I found related to ionic-cordova-google-plugin not related to AWS Amplify Federated Login Issue.
Updating the question after closing the question with less debugging information without asking for any information.
This is issues raised in git hub with respect to my problem.
Issue No. 5351 amplify js it's still in open state.
https://github.com/aws-amplify/amplify-js/issues/5351
Another issue 3537 which is still in Open
These two issues has the same scenario like me, I hope its enough debugging information, if more required mention comment instead of closing without notification, it's bullying for a beginner not helping
I fixed the above problem by referring a comment or wrapped around fix.
Link that will take to that comment directly link to comment.
First read the above comment as it will give you overall idea of what exactly the issue is instead of directly jumping to the solution.
Once you read the comment you will be little unclear with respect to implementation as he has use capacitor and not every one are using capacitor.
In my implementation I ignore this part as I am not using capacitor.
App.addListener('appUrlOpen')
Now lets go to main step where we are fixing this issue, I am using deep links to redirect to my application
this.platform.ready().then(() => {
this.deeplinks
.route({
"/success.html": "success",
"/logout.html": "logout",
})
.subscribe(
(match: any) => {
const fragment = JSON.stringify(match).split('"fragment":"')[1];
// this link can be your any link based on your requirement,
// what I am doing it I am passing all the data which I get in my fragments.
// fragments consists of id_token, stage, code,response type.
// These need to be passed to Ionic in order for Amplify to run its magic.
document.location.href = `http://192.168.1.162:8100/#${fragment}`;
},
(nomatch) => {
console.log("Got a deeplink that didn't match", nomatch);
}
);
});
I got this idea by referring the issue in which the developer mentioned of sending code and state along with application deep linking URL.

Alexa, there was an issue processing your input

I'm following a video which explain how to create a skill and intents, to use Alexa. (Here is the link to see this video: https://www.youtube.com/watch?v=YMb0y66UCxs)
I have a problem, I can't go inside an Intent but I can run the skill with the sentence "Alexa open [Name of the skill]". I will show you the index.js from aws and after that the JSON file from developer amazon.
AWS
And here, the JSON:
I built this project in english in the developer amazon website, but i live in france. Maybe I can have a conflict there. And i also choose, in aws, the city east USA (virginia...). So when i say : ask [name of the skill] for [Un unterance], i have this problem:
When I click on the exclamation point, it says: "There was an issue processing your input". Do you see my problem ?
I don't know, and I could be wrong, but do you need to add a GetNewFactHandler? It doesn't look like you defined one anywhere and your trying to add it in .addRequestHandlers.
Based on the other handlers in your code I'm guessing it should look something like this:
const GetNewFactHandler = {
canHandle() {
const request = handlerInput.requestEnvelope.request;
return request.type === 'IntentRequest' && request.intent.name === 'GetNewFact'
},
handle(handlerInput) {
return handlerInput.responseBuilder
.speak('Hello from the get new fact intent')
.getResponse()
}
}
Oh sorry, I just forgot to put the part where I have this code in my aws.
The forgotten part

How to call Soap\WSDL Service through a login required webpage using matlab?

I am new to the wsdl\soapmessage query\reply world( if i can put it in this way), and I am facing some difficulties using the following wsdl( which I really really hope, one will be so kind to look at at least one of the services described there)
http://almdemo.polarion.com/polarion/ws/services/TrackerWebService?wsdl
which was provided to me to develop a matlab webinterface. Right now my matlab code looks like this:
targetNamespace = 'http://ws.polarion.com/TrackerWebService';
method = 'queryWorkItems';
values= {'Query','Sort'}
names = {'query', 'sort'}
types ={'xsd:string','xsd:string'}
message = createSoapMessage( targetNamespace, method, values, names, types)
response = callSoapService('http://almdemo.polarion.com/polarion/ws/services',...
% Service's endpoint
'http://almdemo.polarion.com/polarion/#/workitems',...
% Server method to run
message)
% SOAP message created using createSoapMessage
author = parseSoapResponse(response)
Herewith to save you time I will just enonce my two problems:
Is the code correct?
Could someone tell me if such a wsdl link is just a definition of webservices or it is also a service's endpoint?
Normally to execute manually\per clicks this services on the weppage
http://almdemo.polarion.com/polarion, you have to login!
So how do I send a message in matlab which first log me in? Or must such a service be introduced into that wsdl for me to do it?? Could you be kind enough to write how it must be defined, because I don't really
write wsdl files, but I shall learn!**
I will be really thankful for your help and I wish you a happy week(-end) guys(& girls)!!!
Regards
Chrysmac
ps: I tried to use Soapui and gave that webpage as endpoint, but the toool crashes each time I enter my credentials! Maybe because of the dataload!??