In Apple News Format, how do I replace an image all at once rather than have it revealed via scrolling? - apple-news

First time poster, long-time reader!
I am writing the JSON for an Apple News story. I have three consecutive full-screen fill images. They are all set to "attachment":"fixed". The transition from one image to another, when scrolling, is to reveal the next image continuously. I would like the "incoming" image to replace the prior image wholesale -- it just appears after someone scrolls to the bottom of the prior image. Hoping that makes sense, since I can't show the actual Apple News preview. I don't want to use an animation, since that only appears once; I want the same behavior when people scroll backwards.
Here's what I have now ... and the scrolling reveal IS what I expected. I want the very different behavior detailed above!
"components": [
{
"role": "header",
"style": "leadVideoStyle",
"layout": {
"ignoreDocumentMargin": true,
"minimumHeight": "125vh"
},
"components": [
{
"role": "container",
"anchor": {
"targetAnchorPosition": "top"
},
"style": "scrimBackgroundStyle",
"layout": {
"ignoreDocumentMargin": true
},
"components": [
{
"role": "title",
"layout": "titleLayout",
"text": "some text",
"textStyle": "titleStyle",
"format": "html"
},
{
"role": "intro",
"layout": "introLayout",
"text": "some text,
"textStyle": "introStyle"
}
]
}
]
},
{
"role": "section",
"layout": {
"ignoreDocumentMargin": true,
"minimumHeight": "200vh"
},
"style": "leadPhotoStyle1"
},
{
"role": "section",
"layout": {
"ignoreDocumentMargin": true,
"minimumHeight": "200vh"
},
"style": "leadPhotoStyle2"
}
],
"leadVideoStyle": {
"fill": {
"type": "video",
"URL": "URL here",
"stillURL": "bundle URL",
"fillMode": "cover",
"verticalAlignment": "top",
"attachment": "fixed"
}
},
"leadPhotoStyle1": {
"fill": {
"type": "image",
"URL": "URL here",
"fillMode": "cover",
"verticalAlignment": "top",
"attachment": "fixed"
}
},
"leadPhotoStyle2": {
"fill": {
"type": "image",
"URL": "URL here",
"fillMode": "cover",
"verticalAlignment": "top",
"attachment": "fixed"
}

Related

How to create 3 option buttons in adaptive/hero card in bot farmework without post back

I have run into a use case where I need to design a card with 3 option buttons which are clickable but do not Postbank directly. Only when user clicks on submit button, the selected option button values are posted back.
how to achieve it in azure bot framework using rich cards?
This is possible and please find the code below, you can always pass data property inside your Submit button. In my case it is for the msteams channel, and it is available for different channel too. The data property contains another key called Value, which contains object of different key value pairs that you can pass. This will pass the data to the channel and you can always set a display text for the message or you can leave blank.
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "Container",
"$data": "${$root}",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "TextBlock",
"text": "You can click here to search KB article for this topic on ServiceNow",
"wrap": true
}
]
}
]
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "278px",
"items": [
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "Search KB articles",
"data": {
"msteams": {
"type": "messageBack",
"displayText": "",
"text": "search-kb-article",
"value": {
"id": "search-kb-article",
"action": "searchKBArticleAction",
"keyword": "${$data.LastMessage}"
}
}
}
}
]
}
]
},
{
"type": "Column",
"width": "30px",
"items": [
{
"type": "Image",
"url": "https://ipnq4wdas01.azurewebsites.net/Images/home.png",
"selectAction": {
"type": "Action.Submit",
"data": {
"msteams": {
"type": "messageBack",
"displayText": "",
"text": "Home",
"value": {
"id": "Home",
"action": "menuAction",
"value": "Home"
}
}
}
}
}
]
}
]
}
],
"style": "emphasis",
"bleed": true
}
]
}

Display comments on adaptive cards in BOT emulator

I am displaying some data in using adaptive card in BOT emulator,I want to add one comment section there.I tried this way:
{
"type": "Action.ShowCard",
"title": "Comment",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "Input.Text",
"id": "test",
"isMultiline": true,
"placeholder": "Enter your comment",
}
],
"actions": [
{
"type": "Action.Submit",
"id":"submit",
"title": "OK",
"data":
{
"test":""
}
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}
}
]
but not getting any output when click on OK action.How can we do it?

Action.Submit on Adaptive cards is not calling the next step (not working only in Microsoft Teams works in web chat) : Bot Framework V4

Next steps in the waterfall dialog flow are not getting called while using Action.Submit in Adaptive cards of Microsoft bot framework SDK V4 (Only when integrated with Microsoft teams)
This is nodejs code in Microsoft framework SDK v4. The problem exists only when integrated with Microsoft teams.
I have tried this in web chat and chat emulator. Action.Submit is calling the next steps on the waterfall dialog flow.
** Bot Code in NodeJS **
async endConversation(stepContext){
console.log("on endConversation")
await stepContext.context.sendActivity({
attachments: [CardFactory.adaptiveCard(RatingCard)]
});
return await stepContext.prompt(TEXT_PROMPT, { prompt: '' });
}
async feedback(stepContext){
console.log("on feedback == "+stepContext.result)
}
** Adaptive Card json **
{
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"size": "medium",
"weight": "bolder",
"color": "accent",
"text": "Rate your experience!"
},
{
"type": "TextBlock",
"separator": true,
"text": "Please rate your experience! Your feedback is very appreciated and will help improve your experience in the future. ",
"wrap": true
},
{
"type": "ColumnSet",
"spacing": "Medium",
"columns": [
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "bad"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/e/ed/StarRatingGraphic.jpg",
"size": "auto"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Bad"
}
],
"width": "auto"
},
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "ok"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/e/ed/StarRatingGraphic.jpg",
"size": "auto"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Ok"
}
],
"width": "auto"
},
{
"type": "Column",
"selectAction": {
"type": "Action.Submit",
"data": "good"
},
"items": [
{
"type": "Image",
"horizontalAlignment": "Center",
"url": "https://upload.wikimedia.org/wikipedia/commons/e/ed/StarRatingGraphic.jpg",
"size": "auto"
},
{
"type": "TextBlock",
"horizontalAlignment": "Center",
"text": "Good"
}
],
"width": "auto"
}
]
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0"
}
Expected :
async method feedback is the next step on the flow which should be called when the user clicks on a star image in adaptive cards.
Actual :
The next step is not getting called. But its going to onMessage method in ActivityHandler base class.
The Interface Looks like
It looks like Teams isn't handling string submit actions very well. I don't know if this is a new problem or if it always worked that way. Try making your submit action data an object instead of a string:
"selectAction": {
"type": "Action.Submit",
"data": {
"rating": "bad"
}
}
This will generate a textless message, so you'll need to extract the rating from the activity's value property. See this post for instructions on transferring a string from an activity's value property to its text property. See my latest blog post for more information about using Adaptive Cards with the Bot Framework.
EDIT: I've discovered that you can simulate an imBack in Teams using the format in this document:
{
"type": "Action.Submit",
"title": "Click me for imBack",
"data": {
"msteams": {
"type": "imBack",
"value": "Text to reply in chat"
}
}
}

Create api not create a form for sample JSON for picture choice rest of all working fine

Create api not create a form for sample JSON for picture choice rest of all working fine
{
"ref": "nice_readable_picture_choice_reference",
"title": "Picture Choice Title",
"type": "picture_choice",
"properties": {
"description": "Cool description for the picture choice",
"randomize": true,
"allow_multiple_selection": false,
"allow_other_choice": true,
"supersized": false,
"show_labels": false,
"choices": [
{
"ref": "foo_choice_ref1",
"label": "Foo 1",
"attachment": {
"type": "image",
"href": "https://images.typeform.com/images/4bcd3"
}
},
{
"ref": "foo_choice_ref2",
"label": "Foo 2",
"attachment": {
"type": "image",
"href": "https://images.typeform.com/images/4bcd3"
}
}
]
},
"validations": {
"required": false
}
}

List_card in AoG passing item title to the next query instead of key

In an app, I'm returning messages of type list_card with option key for an intent.
Here is the json of a sample query:
{
"id": "275212ef-cf97-4576-afa7-facfbc044ada",
"timestamp": "2017-07-17T17:36:03.655Z",
"lang": "en",
"result": {
"source": "agent",
"resolvedQuery": "who is Sneha",
"action": "cp.name_search",
"actionIncomplete": false,
"parameters": {
"keyword": "Sneha"
},
"contexts": [
{
"name": "cpname_search-followup",
"parameters": {
"keyword.original": "Sneha",
"keyword": "Sneha"
},
"lifespan": 2
},
{
"name": "cpuid_search-followup",
"parameters": {
"keyword.original": "Sneha",
"keyword": "Sneha"
},
"lifespan": 1
}
],
"metadata": {
"intentId": "86bd1a17-8e9a-4956-b270-5fb4ac952f5f",
"webhookUsed": "true",
"webhookForSlotFillingUsed": "false",
"webhookResponseTime": 135,
"intentName": "cp.name_search"
},
"fulfillment": {
"speech": "Searching...",
"source": "agent",
"messages": [
{
"type": "simple_response",
"platform": "google",
"textToSpeech": "Here are the search results. \nWant anything else?"
},
{
"type": "list_card",
"platform": "google",
"title": "Search results",
"items": [
{
"optionInfo": {
"key": "uid 72",
"synonyms": []
},
"title": "Sneha Vasista",
"description": "Srinivas Institute of Technology",
"image": {
"url": "//www.curlpad.com/assets/img/custom_images/user.png"
}
},
{
"optionInfo": {
"key": "uid 2053",
"synonyms": []
},
"title": "Sneha Bhat",
"description": "Canara Engineering College",
"image": {
"url": "//www.curlpad.com/assets/img/custom_images/user.png"
}
},
{
"optionInfo": {
"key": "uid 2114",
"synonyms": []
},
"title": "Sneha Sajan",
"description": "P.A College of Engineering",
"image": {
"url": "//www.curlpad.com/assets/img/custom_images/user.png"
}
},
{
"optionInfo": {
"key": "uid 2320",
"synonyms": []
},
"title": "Sneha ",
"description": "sdit",
"image": {
"url": "//www.curlpad.com/assets/img/custom_images/user.png"
}
},
{
"optionInfo": {
"key": "uid 2363",
"synonyms": []
},
"title": "Sneha ",
"description": "Srinivas School of Engineering, Mukka",
"image": {
"url": "//www.curlpad.com/assets/img/custom_images/user.png"
}
}
]
},
{
"type": "0",
"speech": "Here are the search results."
}
]
},
"score": 1
},
"status": {
"code": 200,
"errorType": "success"
},
"sessionId": "e6aa9e52-a9e1-481a-adb5-476c5b386e02"
}
Now the problem is, when I tap the list item in AoG simulator, it passes title of item to next query.
But while testing in Api.ai simulator, it behaves well and passes that key to the next query.
What can be the problem here?
Any hints?
If you're using API.AI, then it will appear in the Intent as an actions_intent_OPTION Event.
One good solution is to have the Intent that sends the list with an OutputContext. Then create a particular Fallback Intent with actions_intent_OPTION as Event and your desired action for that Context which should handle both the voice and press responses.
And you will find your option_key at ["originalRequest"]["data"]["inputs"][0]["arguments"][0]["textValue"] instead of parameter.
You can also see the response value in the actions_intent_option context.
What you need to do is set up a fallback intent directly under your current intent.
For example, if you display the list from the default welcome intent, you can do the following.
Click "Add follow-up intent" and choose fallback.
Don't forget to set the action and enable webhook in the fallback intent.
Now, you should be able to retrieve your answer from the fallback intent using the following code.
const param = app.getContextArgument('actions_intent_option','OPTION').value;

Resources