I have integrated Watson Assistant with Slack App using Slack Integration.
Now, I am trying to push Native JSON supported by Slack through Watson Dialog using JSON Editor.
I found an article which says I need to use -
output.slack: insert any JSON you want to be included in the attachment field of the Slack.
So, I tried using the following as response,
{
"output": {
"slack": {
"text": "Choose an action"
}
}
}
AND
{
"output": {
"slack": {
"attachments":[
{
"text": "Choose an action"
}
]
}
}
}
ALSO tried several combinations by adding "title" referencing this document
{
"output": {
"slack": [{
"title" : "Test Title",
"text" :[
{
"value": "Hello"
}
]
}]
}
}
AND
{
"output": {
"slack": {
"title" : "Test Title",
"text" : "Hello"
}
}
}
AND
{
"output": {
"slack": {
"attachments":
{
"title" : "Test Title",
"text" : "Hello"
}
}
}
}
But Slack does not detect it and doesn't show anything.
I've already enabled Interactivity for my app on Slack.
Has anyone been able to pass Native JSON to slack via Watson Dialog? What am I doing wrong here?
you should update your webhook to a version after April 2020.
then do
{
"output": {
"integrations": {
"slack": [{
"title" : "Test Title",
"text" :[
{
"value": "Hello"
}
]
}]
}
}
}
note the integrations
Related
I uploaded some json to my graphql using gatsby-transformer-json and gatsby-source-filesystem.
I would like to request an object of that data, which contains subfields.
When I try to make this request, I receive the error
Field \"sections\" of type \"DataJsonSections\" must have a selection of subfields. Did you mean \"sections { ... }\"?
Below is my json file. I am trying to request the section called "Sections". I would really like to find a way, so that I don't have to specify spiel and abbr for every section.
My json file
{
"slogan": "some slogan",
"drawIn": "Something to draw people in",
"fullName": "My full title",
"shortName": "My title",
"metadata": {
"desc": "...........",
"title": "............"
},
"sections": {
"about": {
"spiel": "..........."
},
"web-design": {
"abbr": "Websites",
"spiel": ".............."
},
"app-design": {
"abbr": "Apps",
"spiel": "..........."
},
"seo": {
"spiel": ".........."
},
"contact": {
"title": "Contact",
"subtitle": "Contact subtitle",
}
}
}
This is the request I would like to make, but I receive the error above when I do
query MyQuery {
allDataJson {
edges {
node {
sections
}
}
}
}
Extra
Within my gatsby-config.js(This is how I'm using gatsby-transformer-json and gatsby-source-filesystem)
`gatsby-transformer-json`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `data`,
path: `${__dirname}/src/data`
}
},
Field "sections" of type "DataJsonSections" must have a selection of subfields
I wish to nested query the array via graphql, by elimination repeated properties. Below is the json file
{
"MAIN_ARRAY": [
{
"One": [
{
"title": "Title",
"description": "Description",
"avatar": "../../assets/image/author-1.jpg"
}
],
"Two": [
{
"title": "Title",
"description": "Description",
"avatar": "../../assets/image/author-1.jpg"
}
]
}
]
}
I dont want to repeat the properties title, description, avatar for One and Two because its the same. Is there any workaround for this to avoid repeating it. Below code didnt work.
query {
fileJson {
MAIN_ARRAY {
One, Two {
title
description
avatar
}
}
}
}
Assuming the underlying types of both One & Two are the same, you can use Fragments
query {
fileJson {
MAIN_ARRAY {
One {
...MyFragment
}
Two {
...MyFragment
}
}
}
}
fragment MyFragment on MyType {
title
description
avatar
}
In elasticsearch we have a type which has an array of objects. When trying to access from Kibana I am getting some inconsistencies while accessing
Here is an extract from my mapping,
{
"myIndex-2017.08.22": {
"mappings": {
"typeA": {
"properties": {
.
.
.
"Collection": {
"properties": {
.
.
.
"FileType": {
"type": "text"
}
}
}
}
}
}
}
}
Here I can have multiple objects in the Collection i.e., indexing it as an array. When I try too query using one FileType for example FileType: DOCX then I get some records with FileType as HTML as well.
When looking deeper I found that it is because some of the records which has two collection elements one with FileType: DOCX and one with FileType: HTML.
Why is filtering working like this ? Is there any other way to filter and get only FileType: DOCX and not display FileType: HTML.
Am running ES 5.3.
Elasticsearch flattens array fields out of the box, so
{
"files" : [
{
"name" : "name1",
"fileType" : "doc"
},
{
"name" : "name2",
"fileType" : "html"
}
]}
becomes:
{
"files.name" : [ "name1", "name2" ],
"files.fileType" : [ "doc", "html" ]
}
If you want to search for the objects itself in this array you have to use the nested datatype in the mapping of the collection:
{
"myIndex-2017.08.22": {
"mappings": {
"typeA": {
"properties": {
.
.
.
"Collection": {
"type": "nested",
"properties": {
.
.
.
"FileType": {
"type": "text"
}
}
}
}
}
}
}
}
I want to add suggestions for the user in my Google Assistant Bot. I am using API.ai for bot development and using fulfilment, I am communicating with my backend for data.
I am not able to send suggestions using suggestions chips to my bot.
I have followed as answered here Webhook response with "suggestion chips"
as well as the document at https://developers.google.com/actions/assistant/responses#json.
But still, I only see simple text response at my bot on device as well as on simulator.
I also checked at https://discuss.api.ai/t/google-assistant-rich-message-responses/5134/19. But didn't find any way to switch to V1 or V2. The sample format also didn't work!
Here are my 2 JSONs:
at API.ai
"fulfillment": {
"speech": "want to proceed further?",
"messages": [
{
"type": 0,
"speech": "want to proceed further?"
}
],
"data": {
"google": {
"conversationToken": "[\"AS-PER-JSON-FROM-SIMULATOR\"]",
"expectedInputs": [
{
"inputPrompt": {
"richInitialPrompt": {
"items": [
{
"simpleResponse": {
"textToSpeech": "want to proceed further?",
"displayText": "want to proceed further?"
}
}
],
"suggestions": [
{
"title": "Yes"
},
{
"title": "No"
}
]
}
}
}
]
}
}
},
at action on Google
"expectUserResponse": true,
"expectedInputs": [
{
"inputPrompt": {
"richInitialPrompt": {
"items": [
{
"simpleResponse": {
"textToSpeech": "want to proceed?"
}
}
]
},
"noMatchPrompts": [],
"noInputPrompts": []
},
"possibleIntents": [
{
"intent": "assistant.intent.action.TEXT"
}
],
"speechBiasingHints": [
"$subject",
"$answer"
]
}
]
python server
return = '{"speech":"want to proceed?", "data": {"google":{"expectedInputs":[{"inputPrompt":{"richInitialPrompt":{"items":[{"simpleResponse":{"textToSpeech":"want to proceed?","displayText":"want to proceed?"}}],"suggestions":[{"title":"Yes"},{"title":"No"}]}}}]}}}'
Your JSON is wrong, remove the quotation mark before the data object:
"data" : { ... }
instead of
"data" : "{ ... }"
So basically, you're sending a string containing the object instead of a JSON object.
Solved using format as explained here https://developers.google.com/actions/apiai/webhook
Add 'expectUserResponse' into data -> google
'expectUserResponse': true,
'isSsml': false,
In official documentation of quick replies says:
Quick Replies work with all message types including text message, image and template attachments.
But when i try send it with template_type: button, I got error:
{
"error": {
"message": "(#100) Only one of text or attachment can be specified",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "H8w+ZfRbBub"
}
}
That I try to send:
{
"recipient": {"id": "234567890"},
"message": {
"text": "TEXT_MESSAGE",
"quick_replies": [
{
"content_type": "text",
"title": "SOME_TITLE_1",
"payload": "PAY_LOAD_1"
},
{
"content_type": "text",
"title": "SOME_TITLE_2",
"payload": "PAY_LOAD_2"
}
],
"attachment": {
"type": "template",
"payload": {
"template_type": "button",
"text": "TEXT_MESSAGE",
"buttons": [
{
"title": "READ_MORE_BUTTON",
"type": "postback",
"payload": "look:1:c"
}
]
}
}
}
}
when I sent without message.text, I got error:
{
"error": {
"message": "(#100) Cannot use both CTA and quick reply",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "C0DDxGzaUUj"
}
}
What is CTA?
How send quick replies with attachment?
This message structure should work for sending an image attachment with quick replies:
{
"recipient": {
"id": recipient_id
},
"message": {
"attachment":{
"type":"image",
"payload":{
"url": image_url
}
},
"quick_replies": [
{
"content_type":"text",
"title": "Next Image",
"payload": "YOUR_DEFINED_PAYLOAD_FOR_NEXT_IMAGE"
}
]
}
}
Hope that helps dmitry.
try this way. It will insert both buttons and quick replies but button will be at top and quick replies will be at the bottom
"message":{
"quick_replies":[
{"content_type":"text",
"title":"title1",
"payload":"SUPPLEMENT_1"},
{"content_type":"text",
"title":"title2",
"payload":"PAYLOAD_1"
}
],
"attachment":{
"type":"template",
"payload":{
"template_type":"button",
"text":"your text",
"buttons":[
{
"type":"postback",
"title":"Confirm",
"payload":"USER_DEFINED_PAYLOAD"
}
]
}
}
}
So, I've got your same problem and I did some searches around.
What does CTA stands for?
First of all, CTA stands for Call-To-Action. These are the buttons you create with a request for a Button Template, Generic Template or with the Persistent Menu Thread Settings.
It seems that, although as you said FB official documentation explicitly states that Quick Replies are supported with ANY template, for some reason this doesn't include the Button template.
Why is that?
It seems logical to me that the Button Template should be used to present the user with a choice, same thing that the Quick Replies do, so it would be redundant.
Why is that not documented?
I'm assuming that it's probably due to the fact that the Messenger Platform API is still in beta and there are lots of changes from day to day. Personally, I'm working on a Java framework for doing Facebook Messenger bots and I'm finding that many things are not very well documented and often the error messages you get back are misleading. So, you should probably accept the fact that the Button Template and Quick Replies doesn't work together. Quick Replies works with any other template or with text messages though.
This worked for me while using dialogflow
{
"facebook": {
"attachment":{
"type":"template",
"payload":{
"template_type":"generic",
"elements":[
{
"title":"Welcome!",
"image_url":"https://petersfancybrownhats.com/company_image.png",
"subtitle":"We have the right hat for everyone.",
"default_action": {
"type": "web_url",
"url": "https://petersfancybrownhats.com/view?item=103",
"webview_height_ratio": "tall"
},
"buttons":[
{
"type":"web_url",
"url":"https://petersfancybrownhats.com",
"title":"View Website"
},{
"type":"postback",
"title":"Start Chatting",
"payload":"DEVELOPER_DEFINED_PAYLOAD"
}
]
}
]
}
},
"quick_replies":[
{
"content_type":"text",
"title":"Search",
"payload":"<POSTBACK_PAYLOAD>",
"image_url":"http://example.com/img/red.png"
},
{
"content_type":"location"
}
]
}
}