How do I change the background image on an Alexa Show skill card? - background

I'm new to programming Alexa skills, especially with the Echo Show. I am trying to change the background image of the skill card from the default dark grey to something else. I know there has to be a way to do this because when I say, "Alexa, tell me a joke." that skill's background is red. And when I say, "Alexa, tell me about LeBron James." Alexa changes the background to LeBron James and the text auto scrolls. Any help on this would be great.

You can indeed change the background of an Alexa Show skill. Unfortunately, at this time Amazon does not offer a bunch of styling functionality beyond that for the Show skills.
The display interface reference is the documentation that you should read. It will give you an understanding of how all your calls and responses will be sent/received as JSON objects. In order to change the background you must choose one of the few template options they have available and add the background key and value to your JSON response structure.
For example, check out the following response structure you should send back from your AWS lambda function. It renders BodyTemplate2 which displays an image on the side of the screen with text on the other side. (This was taken from the display interface reference). Look at the key, "backgroundImage" and the following value.
{
"type": "Display.RenderTemplate",
"template": {
"type": "BodyTemplate2",
"token": "A2079",
"backButton": "VISIBLE",
"backgroundImage": {
"contentDescription": "Textured grey background",
"sources": [
{
"url": "https://www.example.com/background-image1.png"
}
],
"title": "My Favorite Car",
"image": {
"contentDescription": "My favorite car",
"sources": [
{
"url": "https://www.example.com/my-favorite-car.png"
}
]
},
"textContent": {
"primaryText": {
"text": "See my favorite car",
"type": "PlainText"
},
"secondaryText": {
"text": "Custom-painted",
"type": "PlainText"
},
"tertiaryText": {
"text": "By me!",
"type": "PlainText"
}
}
}
}
}

Related

Custom 'rendering' of Display Value completing a Survey in SurveyJS

I can't find anything in the documentation of SurveyJS. If there is something I missed, a link would be great!
We have implemented a Custom Widget as described here and it works well. What we want to do next is to change the Display Value on the 'Survey Results' section when testing the survey from the creator. In other words, a 'Signature' question's result is displayed as data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADICAYAAABS39xVAAAUGklEQVR4nO3dz28j53kH8PwZFYM6btOGAnIwWpRCe2iLAFSK2IgLUD20PTRa9GL4IiUHF2hBnZxDUuoSyT8623rLxAmpbFdCxaVn15n1luQOC3K7IW1yzRKt6HpEgQfyMOSBGPDy9CC9s8MhJc4MZzjvkN8PwIN3sdrZxerr933meZ/3KwQAEBBf8fsBAACsQmABQGAgsAAgMBBYABAYCCwACAwEFgAEBgILAAIDgQUAgYHAAoDAQGABQGAgsABM1JFGtX6Xav0upZUGHZ1ffm63qhOfYu+Cir0LqvW7fj/2SkBgwcpSRxqJnTPab5bp1tMsbebSFMocUihzSGFRoIiUpJh8rH+2y9mx/47mUhSRkhQWBf3XrYsCbRVPaLci0e1WlWr9LinDgd9...
but we don't want to do this, we want to render the result... but not for the signature but for our custom widget.
Also, is there a function to review your answers before submitting? If there is, we'll most probably also need to display a rendered answer of our custom widget here.
Showing a preview of answers before submitting
There is a SurveyJS feature, which does that. To enable it you need to add a survey-level parameter called showPreviewBeforeComplete. You can choose from the following values:
showAllQuestions
showAnsweredQuestions
This feature will automatically render all images or signatures on the preview page.
The feature is also available through the Survey Creator's UI under the "Navigation" section of the survey settings panel.
Here's an example:
{
"pages": [
{
"name": "page1",
"elements": [
{
"type": "signaturepad",
"name": "question1"
}
]
}
],
"showPreviewBeforeComplete": "showAnsweredQuestions"
}
Rendering uploaded images
If you would like to create your own widget, which renders uploaded images or signatures, you can base it on the HTML widget. It should contain an <img src='{question1}' /> tag, where the value of the src parameter should be the base64 data string, which you retrieved from the signature pad widget.
Here's an example:
{
"pages": [
{
"name": "page1",
"elements": [
{
"type": "signaturepad",
"name": "question1"
}
]
},
{
"name": "page2",
"elements": [
{
"type": "html",
"name": "question2",
"html": "<img src='{question1}' />"
}
]
}
]
}

How to make a BigCommerce widget compatible with PageBuilder

I'm following the tutorial here https://developer.bigcommerce.com/api-docs/storefront/widgets/widgets-tutorial
I made the widget template by performing a post request to https://api.bigcommerce.com/stores/81mdugvyu5/v3/content/widget-templates with this in the body
{
"name": "Header Images",
"template": "{{#each images}}<a href='{{image_url}}'><img src={{image_source}} style='width:33.3%'/></a>{{/each}}"
}
The response was successful.
I then performed a post request to https://api.bigcommerce.com/stores/81mdugvyu5/v3/content/widgets
with this in the body
{
"name": "Header Images",
"widget_configuration": {
"images": [
{
"image_url": "https://google.com",
"image_source": "https://cdn11.bigcommerce.com/s-n0i50vy/images/stencil/1280x1280/products/91/309/thekinfolktablecover_1024x1024__80715.1456436719.jpg?c=2&imbypass=on"
},
{
"image_url": "https://google.com",
"image_source": "https://cdn11.bigcommerce.com/s-n0i50vy/images/stencil/1280x1280/products/109/361/kinfolkessentialissue_1024x1024__22507.1456436715.jpg?c=2&imbypass=on"
},
{
"image_url": "https://google.com",
"image_source": "https://cdn11.bigcommerce.com/s-n0i50vy/images/stencil/500x659/products/85/282/livingwithplants_grande__26452.1456436666.jpg?c=2&imbypass=on"
}
]
},
"widget_template_uuid": "7c5f05c2-2361-45a3-bb99-89554dd145ee"
}
The response was successful.
My custom widget does then appear in page builder but when I try to add it I receive this error
This widget is not supported by Page Builder. Please consult our developer documentation for more information on how to make your
widget compatible with Page Builder
When I visit the developer documentation it links to on how to make it compatible with Page Builder I don't see any mention of Page Builder.
Is there any way to find out how to make the tutorial widget compatible with Page Builder?
#Mikhail was correct. I was able to add it as a widget accessible by page builder by specifying a schema in the body of my widget-templates post request. After sending another request with the schema added like this:
{
"name": "Header Images",
"template": "{{#each images}}<a href='{{image_url}}'><img src={{image_source}} style='width:33.3%'/></a>{{/each}}",
"schema": [
{
"type": "tab",
"label": "Content",
"sections": []
}
]
}
It worked.
You can find more information about schema settings for page builder here https://developer.bigcommerce.com/stencil-docs/page-builder/page-builder-overview
and you can find a list of the items available in your schema here https://developer.bigcommerce.com/stencil-docs/page-builder/schema-settings

Latest one video uploaded in youtube channel

I need to show the thumbnail of the latest video on my youtube channel on my website and add a link to that video. While using the API parameter date it's showing the first video in that channel. Instead of that, I need the last published video details how to solve this
This is what I used as I require only one last video
https://www.googleapis.com/youtube/v3/search?key=[key]&channelId=[channel-id]&part=snippet,id&order=relevance&maxResults=1
(option 1)
You could try replacing order=relevance with order=date
try:
https://www.googleapis.com/youtube/v3/search?key=[key]&channelId=[channel-id]&part=snippet,id&order=date&maxResults=1
(option 2)
You could also try using publishedAfter command (which takes a year-month-day format).
Example: publishedAfter=2019-03-25T00:00:00Z (because yesterday was March 25th).
try:
https://www.googleapis.com/youtube/v3/search?key=[key]&channelId=[channel-id]&part=snippet,id&publishedAfter=2019-03-25T00:00:00Z&order=date&maxResults=1
(option 3)
Use your programming language to fetch / read the HTML source-code of the channel's uploads page. The first thumbnail listed after gridVideoRenderer is the latest, along with relevant URL.
Example steps:
1) Go to user's uploads page and use "view source" option to see the HTML text (source code).
This text is what your programming language should show you when you http request the link of the channel's uploads.
https://www.youtube.com/user/MARVEL/videos
2) After acquiring (or viewing) the source code
From there find position of the word gridVideoRenderer.
Then starting after position, now find the first occurence of word "url":".
That is the URL. Extract manually by hand or write code to do it automatically.
PS: Replace any unicode in the link, like \u0026 with &.
https://i.ytimg.com/vi/QuP7V2gKgPI/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLDBeSfAIiCdLDKtA8h2G-AZqk-xhQ
I tried "option 1" with my own Key, and got the correct response as far as which "video" from the "Channel" - NO THUMBNAILs, just references to it/them, code follows:
{
"kind": "youtube#searchListResponse",
"etag": "EymHvUd1w4o13UcSUT0C9YINu3o",
"nextPageToken": "CAEQAA",
"regionCode": "US",
"pageInfo": {
"totalResults": 181,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#searchResult",
"etag": "23QGL4Y9Du8EXMntX5ZNdr1F7_k",
"id": {
"kind": "youtube#video",
"videoId": "RRQjUvoSuKU"
},
"snippet": {
"publishedAt": "2022-11-13T15:09:07Z",
"channelId": "UCbhMYK2QQXgHjgnMN3zegRQ",
"title": "All Things Closely",
"description": "Luke 1:1-4.",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/RRQjUvoSuKU/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/RRQjUvoSuKU/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/RRQjUvoSuKU/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "Restoration Church Homestead",
"liveBroadcastContent": "none",
"publishTime": "2022-11-13T15:09:07Z"
}
}
]
}
THAT's all that showed on a browser page, no Thumbnails-just code, but could not figure out how to get any code in the string to PLAY that video ...
any ideas?
I would love to just have it as a LINK rather than any other scripts loaded on the server. I'm missing something, probably simple I bet, to get the returned video related to the data to play.

Accessing a Word(.docx) file's content with Microsoft Graph REST API?

Is there a way to obtain the content of a Word document stored in the cloud through the Microsoft Graph API without having to download the file locally?
The goal is to build an app that analyzes a Word document's inner content and produce some interesting data from it. However after searching through Microsoft's Dev Center, Graph Explorer, and their API's documentation repository, I can't find any API endpoints that can serve me that data.
I can find some endpoints that deal with manipulating Excel's contents, but not one that deals with Word. Does Microsoft Graph not support retrieving a Word document's content?
EDIT: For example, I know I can read the contents of a "message" and even apply a search on it through query parameters, as demonstrated by one of Microsoft's samples. But I can't seem to find how to do this with Word documents.
Well, it's possible to download the content of the document.
See: Download the contents of a DriveItem.
For example:
GET /v1.0/me/drive/root:/some-folder/document.docx:/content
But you'll get the entire docx, with embedded images and all. Don't know if this is what you are looking for.
As an example, see the helix-word2md project that fetches a docx and converts it to markdown.
I'm afraid you can't direly access word content. What you can do is use web URL property of a DriveItem opening a document the associated Word Online or native world if it is installed.
You can use this below to show specific item or all items:
GET /users/{userId}/drive/items/{itemId}
GET me/drive/root/children/
This is the result below:
{
"#microsoft.graph.downloadUrl": "",
"createdDateTime": "2018-08-10T01:43:00Z",
"eTag": "\"{00000000-3E94-4161-9B82-0000000},2\"",
"id": "00000000IOJA4ONFB6MFAZXARX7L7RU4NV",
"lastModifiedDateTime": "2018-08-10T01:43:00Z",
"name": "daily check.docx",
"webUrl": "https://xxxxxxx",
"cTag": "\"c:{00000000-3E94-4161-9B82-37FAFF1A71B5},2\"",
"size": 26330,
"createdBy": {
"user": {
"email": "000000.onmicrosoft.com",
"id": "000000-93dc-41b7-b89b-760c4128455a",
"displayName": "Chris"
}
},
"lastModifiedBy": {
"user": {
"email": "0000#0000.onmicrosoft.com",
"id": "00000000-93dc-41b7-b89b-00000000",
"displayName": "Chris"
}
},
"parentReference": {
"driveId":
"b!000000000gdQMtns72t31yqWMhnFCjmCqO3tR5ypOf17NKl2USqo1bNqhOzrZ",
"driveType": "business",
"id": "00000VN6Y2GOVW7725BZO354PWSELRRZ",
"path": "/drive/root:"
},
"file": {
"mimeType": "application/vnd.openxmlformats-
officedocument.wordprocessingml.document",
"hashes": {
"quickXorHash": "OSOK7r2hIVSeY1+FjaCnlOxn2p8="
}
},
"fileSystemInfo": {
"createdDateTime": "2018-08-10T01:43:00Z",
"lastModifiedDateTime": "2018-08-10T01:43:00Z"
}
}

Pinterest board list

I am looking for a way to get the list of board names from a given username. I know pinterest already provides rss for all the pins from a given user and for all the pins from a given pinboard.
All Pins from a given user: pinterest.com/[user]/feed.rss
All pins from a given user and board: pinterest.com/[user]/[board-name]/rss
Now I need a way to get the list of boards from a given user, not the pins. I know there is a way to do it because -> pinreach.com does it.
Thank you in advance :)
RSS feed only has 25 pins. To get boards or all the pins, you have to crawl the site. There is no way around it.
Here is another Unofficial API with Documentation for Pintrest
http://pinterestapi.co.uk/
Hey you can check out this unofficial Pinterest API, you can search boards by username - https://www.mashape.com/ismaelc/pinterest-1#endpoint-Show-User-Boards
Sample result below:
{
"body": [
{
"name": "Books Worth Reading",
"href": "http://pinterest.com/ismael/books-worth-reading/",
"num_of_pins": 6,
"cover_src": "http://media-cache-ec7.pinterest.com/222x/0c/31/22/0c3122735319edbf9b8aae28c9b22f86.jpg",
"thumbs_src": [
"http://media-cache-ec6.pinterest.com/75x75/2a/2d/7b/2a2d7b6f20f7518269b310b25d876810.jpg",
"http://media-cache-ec4.pinterest.com/75x75/e6/05/05/e6050519c5686ae27ad649500965f39c.jpg",
"http://media-cache-ec5.pinterest.com/75x75/07/64/c3/0764c392bae2b073c4c862a6503f09d6.jpg",
"http://media-cache-ec4.pinterest.com/75x75/61/35/0a/61350ab6eb4bb0b0d09f7c191bf30d55.jpg"
]
},
{
"name": "My Style",
"href": "http://pinterest.com/ismael/my-style/",
"num_of_pins": 0,
"cover_src": false,
"thumbs_src": false
},
{
"name": "For the Home",
"href": "http://pinterest.com/ismael/for-the-home/",
"num_of_pins": 0,
"cover_src": false,
"thumbs_src": false
},
{
"name": "Favorite Places & Spaces",
"href": "http://pinterest.com/ismael/favorite-places-spaces/",
"num_of_pins": 0,
"cover_src": false,
"thumbs_src": false
}
],
"meta": {
"count": 4
}
}
You can do this now using the Official Pinterest API using the hook:
https://api.pinterest.com/v1/me/boards/?access_token=********&fields=id%2Cname%2Curl
First, you will need to authenticate and get an acce3ss token.
The getting started doc do a good job at explaining how. https://developers.pinterest.com/docs/api/overview/