Alexa APL. Problems getting AlexaHeader component to sit atop single Image component? - alexa-skills-kit

I want to have a header at the top of my Alexa Skill APL page that shows a Title and a Sub-Title. Directly below it, I want to have an image. In other words I want to have the Title and Sub-Title in a box that sits at the top of the image, occupying the top row of the screen.
The AlexaHeader component seems perfect for this. But when I use it in a container as the first child item, with the Image component next with its scale property set to best-fit, the Image component takes up the whole screen and the AlexaHeader component is behind the image, centered vertically and not at the top of the APL page. I can see it behind the image because the image does not fill the screen horizontally, only vertically.
How can I get the look I want?
Here is my APL JSON for the layout element I am working with:
"my-layout": {
"type": "Alexa.Presentation.APL.RenderDocument",
"token": "ABC_RENDERED_DOCUMENT",
"version": "1.0",
"document": {
"type": "APL",
"version": "1.0",
"import": [
{
"name": "alexa-layouts",
"version": "1.0.0"
}
],
"mainTemplate": {
"description": "********* Minimal APL document **********",
"parameters": [
"payload"
],
"items": [
{
"type": "Container",
"width": "100%",
"height": "100%",
"alignItems": "center",
"justifyContent": "center",
"items": [
{
"type": "AlexaHeader",
"headerBackButton": true,
"headerBackButtonAccessibilityLabel": "back",
"headerBackgroundColor": "orange",
"headerTitle": "${payload.visualProperties.title}",
"headerSubtitle":"${payload.visualProperties.subtitle}",
"headerAttributionText": "photos by Pexels.com",
"headerAttributionImage": "https://d2o906d8ln7ui1.cloudfront.net/images/cheeseskillicon.png",
"headerAttributionPrimacy": true,
"headerDivider": true
},
{
"type": "Image",
"source": "${payload.visualProperties.background}",
"position": "absolute",
"width": "100vw",
"height": "100vh",
"scale": "best-fit"
}
]
}
]
}
},
"datasources": {
"visualProperties": {
"background": "https://m.media-amazon.com/images/G/01/alexa-games/backgrounds/memorystory-gui-1._CB473869069_.png",
"title": "",
"subtitle": ""
}
}
}

Seems you have the absolute positioning set so that the image will go on top of your header (you just need to swap the order) as well as a few other items that needs tweaking.
I might misinterpreted your requirements but below is my best guess of what you want. Let me know if you want any tweaks.
"my-layout": {
"type": "Alexa.Presentation.APL.RenderDocument",
"token": "ABC_RENDERED_DOCUMENT",
"version": "1.0",
"document": {
"type": "APL",
"version": "1.0",
"import": [
{
"name": "alexa-layouts",
"version": "1.0.0"
}
],
"mainTemplate": {
"description": "********* Minimal APL document **********",
"parameters": [
"payload"
],
"items": [
{
"type": "Container",
"width": "100%",
"height": "100%",
"items": [
{
"type": "AlexaHeader",
"headerBackButton": true,
"headerBackButtonAccessibilityLabel": "back",
"headerBackgroundColor": "orange",
"headerTitle": "${payload.visualProperties.title}",
"headerSubtitle": "${payload.visualProperties.subtitle}",
"headerAttributionText": "photos by Pexels.com",
"headerAttributionImage": "https://d2o906d8ln7ui1.cloudfront.net/images/cheeseskillicon.png",
"headerAttributionPrimacy": true
},
{
"type": "Image",
"source": "${payload.visualProperties.background}",
"width": "100vw",
"height": "100vh",
"scale": "best-fit",
"align": "bottom"
}
]
}
]
}
},
"datasources": {
"visualProperties": {
"background": "https://m.media-amazon.com/images/G/01/alexa-games/backgrounds/memorystory-gui-1._CB473869069_.png",
"title": "Header",
"subtitle": "Header Subtitle"
}
}
}

Related

Wordpress ACF fields not showing or letting me update them on POST request

I am trying to create an application. I created a custom post type and added custom fields using ACF. When I try to post to save the data, it doesn't save it and when I create one inside wordpress and request it using it's ID, it doesn't show the data in the response.
Below is the JSON (I tried with acf, fields and with leaving everything outside of an object), response and URL.
{
"title": "title 7",
"acf": {
"feeling": "ok",
"feeling_at_the_moment": "relieved",
"what_have_you_been_doing": "chores",
"cognitive_distortions": "",
"challenge": "",
"interpretation": "",
"feeling_now": "",
"email": "gmail.com"
}
}
{
"id": 4392,
"date": "2022-12-03T19:49:14",
"date_gmt": "2022-12-03T19:49:14",
"guid": {
"rendered": "/?post_type=mood_tracker&p=4392",
"raw": "/?post_type=mood_tracker&p=4392"
},
"modified": "2022-12-03T19:49:14",
"modified_gmt": "2022-12-03T19:49:14",
"password": "",
"slug": "",
"status": "draft",
"type": "mood_tracker",
"link": "/?post_type=mood_tracker&p=4392",
"title": {
"raw": "title 7",
"rendered": "title 7"
},
"content": {
"raw": "",
"rendered": "",
"protected": false,
"block_version": 0
},
"featured_media": 0,
"template": "",
"meta": {
"_mi_skip_tracking": false
},
"permalink_template": "/mood_tracker/%pagename%/",
"generated_slug": "title-7",
"_links": {
"self": [
{
"href": "/wp-json/wp/v2/mood_tracker/4392"
}
],
"collection": [
{
"href": "/wp-json/wp/v2/mood_tracker"
}
],
"about": [
{
"href": "/wp-json/wp/v2/types/mood_tracker"
}
],
"wp:attachment": [
{
"href": "/wp-json/wp/v2/media?parent=4392"
}
],
"wp:action-publish": [
{
"href": "/wp-json/wp/v2/mood_tracker/4392"
}
],
"wp:action-unfiltered-html": [
{
"href": "/wp-json/wp/v2/mood_tracker/4392"
}
],
"curies": [
{
"name": "wp",
"href": "https://api.w.org/{rel}",
"templated": true
}
]
}
}
https://link.com/wp-json/wp/v2/mood_tracker
As per the ACF document. Make sure this is turned on
Make sure you do the same while you are creating the custom field group in case it overwrites the general settings
Sometimes I need to republish the already created posts so they get affected

UgcPosts -> Posts

I've written code which work under unversioned version and it uses ugcPosts api to gets Share/UgcPosts. In response I have thumbnails like below:
UgcPosts - https://api.linkedin.com/v2/ugcPosts/{encoded ugcPostUrn|shareUrn}?viewContext=AUTHOR
{
"author": "urn:li:person:123ABC",
"contentCertificationRecord": "{\"originCountryCode\":\"us\",\"modifiedAt\":1500590592795,\"spamRestriction\":{\"classifications\":[],\"contentQualityClassifications\":[],\"systemName\":\"MACHINE_SYNC\",\"lowQuality\":false,\"contentClassificationTrackingId\":\"B6A8B437D1D5E59D123455F6DCE5B\",\"contentRelevanceClassifications\":[],\"spam\":false}}",
"created": {
"actor": "urn:li:person:123ABC",
"time": 1500590543962
},
"firstPublishedAt": 1500590592702,
"id": "urn:li:ugcPost:123456",
"lastModified": {
"actor": "urn:li:person:123ABC",
"time": 1500590592806
},
"lifecycleState": "PUBLISHED",
"**specificContent**": {
"**com.linkedin.ugc.ShareContent**": {
"**media**": [
{
"media": "urn:li:digitalmediaAsset:123ABDEFHAG",
"status": "READY",
"**thumbnails**": [/**here i can have some thumbnail **]
}
],
"shareCommentary": {
"attributes": [
{
"length": 35,
"start": 66,
"value": {
"com.linkedin.common.CompanyAttributedEntity": {
"company": "urn:li:organization:12345"
}
}
}
],
"text": "Testing a UGC Post!"
},
"shareMediaCategory": "VIDEO"
}
},
"versionTag": "2",
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
But now after "migration" I dont see any option to get thumbnails for retriving posts ...
https://api.linkedin.com/rest/posts/{encoded ugcPostUrn|shareUrn}
and example of respone:
{
"lifecycleState": "PUBLISHED",
"lastModifiedAt": 1634790968774,
"visibility": "PUBLIC",
"publishedAt": 1634790968774,
"author": "urn:li:organization:5515715",
"distribution": {
"feedDistribution": "NONE",
"thirdPartyDistributionChannels": []
},
"content": {
"media": {
"id": "**urn:li:video:C5F10AQGKQg_6y2a4sQ**" - I can see only this, so probably I need to use VideoApi, but if there will be URN:LI:IMAGE ? Then what? How to get thumbnail for URN:LI:Image ?
}
},
"lifecycleStateInfo": {
"isEditedByAuthor": false
},
"isReshareDisabledByAuthor": false,
"createdAt": 1634790968743,
"id": "urn:li:ugcPost:6856810298419044352",
"commentary": "comment on Oct 20",
"adContext": {
"dscStatus": "ACTIVE",
"dscAdType": "VIDEO",
"isDsc": true,
"dscAdAccount": "urn:li:sponsoredAccount:520866471"
}
}
TL:DR :)
How to get thumbnail for urn:li:image ? If I get this in response content from posts, how to get this thumbnail for this type of content. For urn:li:video I guess that I can use VideoApi but for Image ?
I was looking for answer in documentation but without success.

UGC Post Image media order not respected

I'm creating an UGC post with mediaCategory IMAGE and multiple images attached uploaded with the recommended Assets Api.
I've noticed that LinkedIn does not respect the original order we are sending through.
Has anyone experienced this as well or has any idea what I'm missing?
{
"author": "urn:li:organization:5590506",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"media": [
{
"media": "urn:li:digitalmediaAsset:ID1",
"status": "READY",
"title": {
"attributes": [],
"text": "Asset 1"
}
},
{
"media": "urn:li:digitalmediaAsset:ID2",
"status": "READY",
"title": {
"attributes": [],
"text": "Asset 2"
}
},
{
"media": "urn:li:digitalmediaAsset:ID3",
"status": "READY",
"title": {
"attributes": [],
"text": "Asset 3"
}
},
{
"media": "urn:li:digitalmediaAsset:ID4",
"status": "READY",
"title": {
"attributes": [],
"text": "Asset 4"
}
},
{
"media": "urn:li:digitalmediaAsset:ID5",
"status": "READY",
"title": {
"attributes": [],
"text": "Asset 5"
}
}
],
"shareCommentary": {
"attributes": [],
"text": "Some share text"
},
"shareMediaCategory": "IMAGE"
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
POST https://api.linkedin.com/v2/ugcPosts
I think you want to maintain the order of media in single post.
But I see same media ID "media": "urn:li:digitalmediaAsset:C5500AQG7r2u00ByWjw",
5 times. May be it is just a dummy message.
I think you should try get on it
GET https://api.linkedin.com/v2/ugcPosts/{encoded ugcPostUrn|shareUrn}?viewContext=AUTHOR
and you can see media order. I think media order stays same. It is just how LinkedIn is displaying it.
{
"author": "urn:li:organization:5590506",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"media": [
{
"media": "urn:li:digitalmediaAsset:C5500AQG7r2u00ByWjw",
"status": "READY",
"title": {
"attributes": [],
"text": "Sample Video Create"
}
}
],
"shareCommentary": {
"attributes": [],
"text": "Some share text"
},
"shareMediaCategory": "VIDEO"
}
},
"targetAudience": {
"targetedEntities": [
{
"locations": [
"urn:li:country:us",
"urn:li:country:gb"
],
"seniorities": [
"urn:li:seniority:3"
]
}
]
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}

How to get rid of "API must not have local definitions (i.e. only $refs are allowed)" Swaggerhub standardization error with Springfox

I have swagger api-docs.json definition generated by SpringFox.
Below minimal-reproducible-example:
{
"swagger": "2.0",
"info": {
"description": "Example REST API.",
"version": "15.11.02",
"title": "Example REST API",
"contact": {
"name": "ExampleTeam",
"url": "https://example.com/",
"email": "support#example.com"
},
"license": {
"name": "Apache License 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
},
"host": "d01088db.ngrok.io",
"basePath": "/cloud",
"tags": [
{
"name": "All Endpoints",
"description": " "
}
],
"paths": {
"/api/v2/users/{userId}/jobs/{jobId}": {
"get": {
"tags": [
"Builds",
"All Endpoints"
],
"summary": "Get job.",
"operationId": "getJobUsingGET",
"produces": [
"*/*"
],
"parameters": [
{
"name": "jobId",
"in": "path",
"description": "jobId",
"required": true,
"type": "integer",
"format": "int64"
},
{
"name": "userId",
"in": "path",
"description": "userId",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/APIPipelineJob"
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"deprecated": false
}
}
},
"definitions": {
"APIPipelineJob": {
"type": "object",
"properties": {
"archiveTime": {
"type": "string",
"format": "date-time",
"example": "example"
},
"content": {
"type": "string",
"example": "example"
},
"createTime": {
"type": "string",
"format": "date-time",
"example": "example"
},
"id": {
"type": "integer",
"format": "int64",
"example": "example"
},
"name": {
"type": "string",
"example": "example"
},
"selfURI": {
"type": "string",
"example": "example"
},
"type": {
"type": "string",
"example": "example",
"enum": [
"BUILD",
"DEPLOY"
]
},
"userId": {
"type": "integer",
"format": "int64",
"example": "example"
}
},
"title": "APIPipelineJob",
"xml": {
"name": "APIPipelineJob",
"attribute": false,
"wrapped": false
}
}
}
}
When I import it to SwaggerHub I got standardization error:
'definitions.*' not allowed -> API must not have local definitions (i.e. only $refs are allowed)
I have found the recommended solution in SwaggerHub documentation
But here is my question how to achieve:
split into domains(then using a reference), or
inline schemas
with Springfox
Or maybe there is another way to get rid of the above standardization error?
If you go to your home page, then hover over your organization on the left hand side and go to settings > Standardization, you should see some options. Unselect "API must not have local definitions (i.e. only $refs are allowed)" at the bottom.
And don't forget to save at the top right!

How to get bold text in the title in CardAction

Is it possible to get bold text in the title of a CardAction() in bot framework v4? I'm using it in a HeroCard. I've tried ** Option One ** but it only works in the text of a HeroCard for example, but not in the CardAction() buttons.
Here's my implementation of CardActions in a HeroCard:
var Options = new HeroCard
{
Text = "What do you choose?",
Buttons = new List<CardAction>
{
new CardAction() { Title = "Option One, Type = ActionTypes.ImBack, Value = ""Option One" },
new CardAction() { Title = "Go back", Type = ActionTypes.ImBack, Value = "Go back" },
},
};
You can't. It's up to each channel to determine how to display cards.
Alternatively, you can try using an Adaptive Card with something like the following JSON:
{
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "What do you choose?"
},
{
"type": "Container",
"items": [
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "Option One",
"weight": "Bolder",
"horizontalAlignment": "Center",
"size": "Large",
"color": "Accent"
}
],
"selectAction": {
"type": "Action.Submit"
},
"id": "optionOne",
"style": "default"
},
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "Go back",
"horizontalAlignment": "Center",
"size": "Large",
"weight": "Bolder",
"color": "Accent"
}
],
"selectAction": {
"type": "Action.Submit",
"data": "goBack"
},
"id": "goBack",
"style": "default"
}
],
"style": "emphasis"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0"
}
Again, though, it will be up to the channel for how it wants to display "weight": "Bolder"

Resources