I have two intents defined on Dialogflow. Both use a webhook fulfillment implemented in php which returns json.
One of them is activated by the action_intent_PERMISSION event. If the user granted permission, it performs an action and returns both SimpleResponse (text) and a Basic Card with some text and an image.
The problem is that the Basic Card is never shown. In the debug tab of Google Actions Simulator, I can see that the Basic Card is present in the json sent to the assistant, I see it in the Response tab in simulator, but if I look at the Debug tab in simulator, the basic card is not listed under visualElementsList.
The other intent asks user for a zip code, and then performs the same action and returns the same json as the previous intent. In this case, the Basic Card is always shown and I can see it listed under visualElementsList in the Debug tab.
I can't find why the basic card is not displayed at all when the intent is activated by the action_intent_PERMISSION event. I have been researching and looking and can't find it. Thank you for any help.
This is the response tab in simulator for the intent that shows the basic card:
{
"conversationToken": "[\"closestitem\"]",
"finalResponse": {
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "The item is xxxxx"
}
},
{
"basicCard": {
"title": "Your Closest Item",
"subtitle": "The item is XXXX XXXX XXXX",
"image": {
"url": "https://www.example.com/image.jpg",
"accessibilityText": "Item"
},
"buttons": [
{
"title": "View More",
"openUrlAction": {
"url": "https://www.example.com/"
}
}
]
}
}
]
}
},
"responseMetadata": {
"status": {
"message": "Success (200)"
},
"queryMatchInfo": {
"queryMatched": true,
"intent": "XXXXXXX-2fd7-4ec3-9c88-d90cfccf8661",
"parameterNames": [
"zip"
]
}
}
}
This is the content of the response tab for the intent that is not showing the basic card. I need this basic card to be shown:
{
"conversationToken": "[\"closestitem\",\"closestitem-followup\"]",
"finalResponse": {
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "The item is XXXXXX"
}
},
{
"basicCard": {
"title": "Your Closest Item",
"subtitle": "The item is XXXXXX.",
"image": {
"url": "https://www.example.com/image.jpg",
"accessibilityText": "Item"
},
"buttons": [
{
"title": "View More",
"openUrlAction": {
"url": "https://www.example.com/"
}
}
]
}
}
]
}
},
"responseMetadata": {
"status": {
"message": "Success (200)"
},
"queryMatchInfo": {
"queryMatched": true,
"intent": "XXXXXXX-3c6d-44fa-b35d-6b097c3da054"
}
}
}
The Errors tab is empty in both cases in simulator.
Related
as in this example, I get the data from Starwar's GraphQL: https://swapi-graphql.netlify.app/.netlify/functions/index
Body Request:
query {
allFilms {
films {
title
}
}
}
Response data:
{
"data": {
"allFilms": {
"films": [
{
"title": "A New Hope"
},
{
"title": "The Empire Strikes Back"
},
{
"title": "Return of the Jedi"
},
{
"title": "The Phantom Menace"
},
{
"title": "Attack of the Clones"
},
{
"title": "Revenge of the Sith"
}
]
}
}
}
However, I want to get the responding data as an array of "films" like this:
[
{
"title": "A New Hope"
},
{
"title": "The Empire Strikes Back"
},
{
"title": "Return of the Jedi"
},
{
"title": "The Phantom Menace"
},
{
"title": "Attack of the Clones"
},
{
"title": "Revenge of the Sith"
}
]
So how can I do that? (if I'm not wrong, it's related to Pre-request Script)
You won't be able to change the format of the response, but you can process the result so it provides exactly what you want. I created this request on Postman so you can see how I've done it.
You need to transform the response when you fetch it, in postman you would do so in the Tests tab (i.e. post-response script vs pre-request):
// Getting the response data into a variable response
const response = pm.response.json();
// Converting the original response to the format you want
const filmArray = response.data.allFilms.films
// Logging it to the console so you can verify the results
console.log(filmArray)
This is the result of that console.log on postman:
I am trying to use the PATCH projects/:project_id/items/:item_id endpoint in order to update the "displayName" attribute of an item in BIM360. There is an example on how to do exactly that in the Forge documentation, but for some reason I am getting an 400 error.
Here is my payload:
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "items",
"id": "ITEM_URN",
"attributes": {
"displayName": "NEW_ITEM_NAME.EXTENSION"
}
}
}
Here is the error I get:
{
"jsonapi": {
"version": "1.0"
},
"errors": [
{
"id": "a4c43bbb-9e34-4973-9f9c-58a7e1d7bdb6",
"status": "400",
"code": "BAD_INPUT",
"title": "One or more input values in the request were bad",
"detail": "Request input is invalid for this operation."
}
]
}
I successfully use the same endpoint in order to change the parent folder for this same item (as described in this post answer: Autodesk Forge; Pragmatically changing file location without new upload ), so the problem must be in the update "displayName" portion. Here the successful payload sample that returns a 200 answer:
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "items",
"id": "ITEM_URN",
"relationships": {
"parent": {
"data": {
"type": "folders",
"id": "DESTINATION_FOLDER_URN"
}
}
}
}
}
Forge Documentation with example: https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-items-item_id-PATCH/
What am I missing in order to update the "displayName" attribute?
If you want to change the file name, you can change tip version name and title , creating new version is required, but you don't have to upload file again. Please try the API at https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-POST/ :
POST /versions?copyFrom={tip_version_urn}
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "versions",
"attributes": {
"name": "newName"
}
}
}
A new tip version will be created with the updated name.
I build a chatbot with Watson Assistant and integrate it with Slack. I want to write Native JSON supported by Slack through Watson Dialog using JSON Editor. The doc of Watson Assistant says:
output.integrations.slack: any JSON response you want to be included in the attachment field of a response intended for Slack.
(see https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-responses-json#dialog-responses-json-user-defined)
So I tried sth like this:
{
"output": {
"integrations": {
"slack": {
"attachment": {
"blocks": [
{
"text": {
"text": "Pick a date for the deadline.",
"type": "mrkdwn"
},
"type": "section",
"accessory": {
"type": "datepicker",
"action_id": "datepicker-action",
"placeholder": {
"text": "Select a date",
"type": "plain_text",
"emoji": true
},
"initial_date": "1990-04-28"
}
}
]
}
}
},
"generic": [
{
"response_type": "text",
"values": [],
"selection_policy": "sequential"
}
]
}
}
The content of the attachment field is copied from the Block Kit Builer(https://api.slack.com/tools/block-kit-builder).
But this seems not work. Can anyone give me some suggestions? Thanks in advance.
Output.integrations is not a preferred way.
Pls try
"output": {
"generic": [
{
"user_defined": {
//Put here your slack attachment
},
"response_type": "user_defined"
}
]}
By using user_defined you can mix with it more responses like text, image, etc.
I am getting my feet wet in VueJS/Gridsome and I am trying to make a simple site to start off. What I am looking to do is store all my data locally in a JSON file and pull it into my page/component using GraphQL. I am able to see the data load however I cannot iterate through every object; instead it shows me all the data.
I have tried changing the way I layout my JSON objects schemas, tried separating into multiple json files (Do not want to do this) and have played with different v-for parameters. On the Gridsome Docs and Youtube Tutorials everyone is pulling from markdown and generating pages from each markdown file or using some sort of API. I want to accomplish this in a single JSON file.
videos.json
[
{
"title": "vid 1",
"url": "url1"
},
{
"title": "vid 2",
"url": "url2"
}
]
GraphQL Query
{
allVideo {
edges {
node{
id
data {
title
url
}
}
}
}
}
GraphQL Results
{
"data": {
"allVideo": {
"edges": [
{
"node": {
"id": "6b3cddf43cce8f8a0fb122d194db6edc",
"data": [
{
"title": "vid 1",
"url": "https://youtube.com"
},
{
"title": "vid 2",
"url": "https://youtube.com"
}
]
}
}
]
}
}
}
Videos.vue
<template>
<Layout>
<h1>Videos</h1>
<div v-for="edge in $page.allVideo.edges" :key="edge.node.id">
{{edge.node.data}}
</div>
</Layout>
</template>
<page-query>
query Videos {
allVideo {
edges {
node {
id
data {
title
url
}
}
}
}
}
</page-query>
Page Result:
Videos
[ { "title": "vid 1", "url": "url1" }, { "title": "vid 2", "url": "url2" } ]
I expect there to be an ID for each video entry, however it seems that the data collection is in the wrong scope and I cannot get it one level up to be with ID to generate an ID with each set of video.
I am looking for something that will give me this query result:
{
"data": {
"allVideo": {
"edges": [
{
"node": {
"id": "6b3cddf43cce8f8a0fb122d194db6edc",
"data": [
{
"title": "vid 1",
"url": "url1"
}
]
}
},
{
"node": {
"id": "some other ID",
"data": [
{
"title": "vid 2",
"url": "url 2"
}
]
}
}
]
}
}
}
You can do this by querying a single video using the GraphQL query below.
If you check the docs on GraphQL playground on http://localhost:8081/___explore you should see a query for Video and also allVideo. Instead of using allVideo in your vue components use a single video and pass in the ID you should get the result you want.
{
Video(id: "6b3cddf43cce8f8a0fb122d194db6edc") {
edges {
node{
id
data {
title
url
}
}
}
}
}
I'm using the Microsoft Graph People API to search for people in my personal contacts and the organization directory.
https://graph.microsoft.com/v1.0/me/people/?$search=username
returning for example:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('123456789')/people",
"#odata.nextLink": "https://graph.microsoft.com/v1.0/me/people/?$search=username&$skip=10",
"value": [
{
"id": "1234567890",
...
"personType": {
"class": "Person",
"subclass": "OrganizationUser"
}
},
{
"id": "0987654321",
...
"personType": {
"class": "Person",
"subclass": "PersonalContact"
}
}
]
}
When I request the photo of an internal Organization User ( "subclass": "OrganizationUser"), everything works.
When I'm request the some for a Personal Contact ("subclass": "PersonalContact") photo service, /me/contacts/{id}/photo/$value returns:
{
"error": {
"code": "ErrorInvalidOperation",
"message": "ConversationId isn't supported in the context of this operation.",
"innerError": {
"request-id": "1b55eca0-f83f-4e66-9006-b728373ad747",
"date": "2019-01-04T01:06:27"
}
}
}