We have created a bot on google assistant using https://console.actions.google.com/u/2/ and also have added our webhook to receive the user's message.
We are getting the user's message and we are also able to reply back to those messages. But the message that we send is getting reflected twice in the end-users mobile app.
Also, this is happening only when the user types the messages or selects any provided options. When the user provides a voice input we are able to get only a single response in the bot as expected.
Have attached the response that we return back in the API.
{
'conversationToken': 'USER_TOKEN',
'expectUserResponse': true,
'expectedInputs': [
{
'inputPrompt': {
'richInitialPrompt': {
"items": [
{
'simpleResponse': {
'textToSpeech': 'Hey there...',
'displayText': 'Hey there...'
}
}
],
'suggestions': false
}
},
'possibleIntents': [
{
'intent': 'actions.intent.TEXT'
}
]
}
]
};
Related
I am trying to build an Actions on Google Agent via DialogFlow and keep getting errors when trying to ask the user a question while including ssml.
I have built the agent on DialogFlow, have logic implemented using the fulfillment webhook (implemented via the node module dialogflow-fulfillment) and have been able to test on DialogFlow successfully using the test console on the right side DialogFlow.
I therefore hooked up the DialogFlow Integrations to Google Assistant.
I first tried unsuccessfully:
const client = new WebhookClient({ req, res });
let qToSnd = 'Hi <break time=\"500ms\"/> Can I help you?';
let conv = client.conv();
conv.ask(qToSnd);
client.add(conv);
The above would work (not give errors) but would result in the question being asked while speaking out the <break> tag.
I have also tried:
conv.ask(
new Text({
text: _stripTags(qToSnd),
ssml: qToSnd
}));
However, when I test this using the Actions on Google simulator I get the error message:
[Agent] isn't responding right now. Try again soon.
Digging into the logs viewer shows the following error message:
MalformedResponse: ErrorId: ... Failed to parse Dialogflow response into AppResponse because of invalid platform response. : Could not find a RichResponse or SystemIntent in the platform response for agentId: ... and intentId: ...
My fulfillment API is returning:
{
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"text": "Hi - Can I help you?",
"ssml": "Hi <break time=\"500ms\"/> Can I help you?"
}
]
}
}
}
}
I will appreciate any pointers in the right direction.
Looking at the JSON snippet for a simple response in the documentation, you should wrap your item in a simpleResponse element. Additionally, the keys you are using for text and audio responses are incorrect, and should be textToSpeech and displayText.
{
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "Howdy, this is GeekNum. I can tell you fun facts about almost any number, my favorite is 42. What number do you have in mind?",
"displayText": "Howdy! I can tell you fun facts about almost any number. What do you have in mind?"
}
}
]
}
}
}
}
Inspired by #NickFelker's answer below and researching more into this topic, I was able to get the SSML working by making sure to add the <speak> tags. So this works:
const client = new WebhookClient({ req, res });
let qToSnd = 'Hi <break time=\"500ms\"/> Can I help you?';
let conv = client.conv();
conv.ask('<speak>' + qToSnd + '</speak>');
client.add(conv);
The fulfillment API returns:
{
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "<speak>Hi <break time=\"500ms\"/> Can I help you</speak>"
}
}
]
}
}
}
}
I'm wanting to set up an app for a page(or possibly group) where if a user comments on the page then the page will send the user a private message. So far I'm finding this to be impossible, I'm trying to make the following call via postman:
POST https://graph.facebook.com/v3.2/me/messages
{
"recipient": {
"id": "{receipientId}"
},
"message": {
"text": "hello, world!"
}
}
The error message I'm getting back is:
{
"error": {
"message": "(#551) This person isn't available right now.",
"type": "OAuthException",
"code": 551,
"error_subcode": 1545041,
"fbtrace_id": "{fbtrace_id}"
}
}
I've seen this functionality with another app and I can't seem to find the documentation anywhere that allows this type of behavior, any assistance would be greatly appreciated.
Edit: The recipient id is coming from a page scoped user id.
Ok through more reading I was able to find the answer. Private replies are how to do this.
Send a post to this endpoint:
https://graph.facebook.com/v3.2/{CommentId}/private_replies
{
"message": "Hello, world"
}
Documentation: https://developers.facebook.com/docs/graph-api/reference/v3.2/object/private_replies
How to send extra data to DialogFlow while calling it using some SDK?
I understand that in v1, originalRequest.data was used for this purpose.
Basically I want to send username, mobile number etc from website session and pass it to DialogFlow so that I can get it in webhook and perform some operation.
I am using below code to call DialogFlow:
import dialogflow
def detect_intent_texts(text, session_id):
session_client = dialogflow.SessionsClient()
session = session_client.session_path(project_id, session_id)
text_input = dialogflow.types.TextInput(
text=text, language_code=language_code)
query_input = dialogflow.types.QueryInput(text=text_input)
response = session_client.detect_intent(
session=session, query_input=query_input)
return response.query_result.fulfillment_text
detect_intent_texts('hello how are you', 'some_session_id')
You need to set parameters in the context.
create a context
add parameter
extract the context and parameter in the next interaction.
In JSON, it will look like this
{
"fulfillmentText":"This is a text response",
"fulfillmentMessages":[ ],
"source":"example.com",
"payload":{
"google":{ },
"facebook":{ },
"slack":{ }
},
"outputContexts":[
{
"name":"context name",
"lifespanCount":5,
"parameters":{
"param":"param value"
}
}
],
"followupEventInput":{ }
}
You can take a look how it can be done in python using create_context in dialogflow-python-client
I want to trigger my test issue's current status, for example A to B via Rest call.
I've searched on the web and come across Atlassian Documentation. What it says:
->You must use POST method.
->You must define transition id in rest call body. Like following:
{
"update": {
"comment": [
{
"add": {
"body": "Aok was here"
}
}
]
},
"transitions": {
"id": "471"
}
}
->You must construct an url like: http://test/jira/rest/api/latest/issue/{ISSUE-KEY}/transitions
When i test above with post-man, i get nothing but a white page response body.
What may be wrong here?
Thanks
Anyone who faces this problem, here is the solution:
You need to make http request with Content-Type:application/json in header.
Since 2 weeks I trying to figure out how the Transaction Requirement Check is working.
I copy pasted exactely the same exemple you have provided in the documentation which is this one :
app.intent('verify_transaction_requirements', (conv) => {
console.log("am I entering in this intent ?");
conv.ask(new TransactionRequirements({
orderOptions: {
requestDeliveryAddress: false,
},
paymentOptions: {
googleProvidedOptions: {
prepaidCardDisallowed: false,
supportedCardNetworks: ['VISA', 'AMEX'],
// These will be provided by payment processor,
// like Stripe, Braintree, or Vantiv.
tokenizationParameters: {}
}
}
}));
});
When trying this bit of code on my mobile phone, I am receiving an error saying that my application is not responding anymore.
How error, looking at the log, my Google Function seems to send a 200 status code.
No error has been printed at all.
I have also enabled the transactions on Google Action Console.
Do you have an idea about where the problem could come from ?
Regards,
I believe the issue is because the tokenizationParameters field is empty, but it expecting some data.
Try using placeholder information in it's place, or setting up a sandbox payment processor using Stripe or Braintree:
tokenizationParameters: {
tokenizationType: 'PAYMENT_GATEWAY',
parameters: {
"gateway": 'stripe',
"stripe:publishableKey" : "pk_1234",
"stripe:version" : "1.5"
}
},