I have a React-Native app that if I use the component and post an image to the timeline it is a full screen image. However... I am wanting to post an image server side using Python and I am unable to get the code right for posting an image that is full screen.
I have found the examples for posting images to be quite limited, and I have tried a few different combinations which I have pasted below.
user_feed = client.feed('timeline', user_id)
user_feed.add_activity({'actor': client.users.create_reference(user_id),
"verb": "post",
"object": 'my message to see if this thing actually works',
"attachments": {
"og": {
"title": "Crozzon di Brenta photo by Lorenzo Spoleti",
"description": "Download this photo in Italy by Lorenzo Spoleti",
"url": "https://unsplash.com/photos/yxKHOTkAins",
"images": [
{
"image": public_image_url
}
]
}
}})
The code above posts the image as a thumbnail with a description. If I remove the title and description, the image still posts as a small thumbnail - is there a way to get rid of the box and make it look like image 2 (full screen)? Image 1
image 2
As per https://getstream.github.io/react-native-activity-feed/#!/UI%20Components
const activity = {
actor: {
data: {
name: 'Nora Ferguson',
profileImage: 'https://randomuser.me/api/portraits/women/72.jpg',
},
},
verb: 'post',
object: 'Just came back from this hike! #Hiking #Madeira',
image:
'https://handluggageonly.co.uk/wp-content/uploads/2017/08/IMG_0777.jpg',
time: new Date(),
};
Related
I'm trying to display only one colour variant of my product at any time when one is selected.
I can get it to work when I manually assign an image to each of the product colours, but when I upload a new .CSV, this is overwritten. Since there are going to be hundreds of products on this store, this isn't a viable solution.
Any help would be greatly appreciated. Thank you.
Link to .CSV
https://docs.google.com/spreadsheets/d/1trq0X3MjR-n2THFnT8gYYlwKscnQavCeeZ8L-ifYaHw/edit?usp=sharing
Link to Product page
https://tomgarrad.myshopify.com/products/lightweight-trainers?variant=37878137356461
Use the Shopify API instead of uploading from a spreadsheet. It allows you to do a lot of things, the following code would upload a product:
POST /admin/api/2021-01/products.json
{
"product": {
"title": "Lightweight Trainers",
"body_html": "<strong>Great trainers!</strong>", #Description
"vendor": "Tom", #The name of the products vendor
"product_type": "Trainer",
"variants": [
{
"option1": "Blue",
"price": "10.00",
"sku": "123" #code
},
{
"option2": "Red",
"price": "10.00",
"sku": "123"
}
],
"images": [
{
"attachment": "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==\n"
}
]
}
}
The image attachment is base64 encoded so keep that in mind when uploading images. Shopify has a very detailed documentation of their API and it's easy to setup. Hopefully this will work for you.
I am trying to build a Slack app by using AWS lambda and NodeJs. The issue I am facing is that I don't understand in what format does the SlackBot need the JSON payload from my AWS lambda code to display it.
I followed the tutorial video suggested on Slack linked here. In the video, the following JSON object is created and returned from the AWS lambda.
const response = {
statusCode: 200,
body: "Sample Response",
};
The SlackBot posts the text entered in the 'body' property (i.e. 'Sample Response' in this case) as a response. This seems to be working well. But, I need some more flair than simple text so I looked into their Block Kit UI builder. But there seems to be no documentation for how to do this with a similar 'response' JSON object like this. How exactly am I supposed to use the JSON object created by the UI builder?
I do not know much about Web development so sorry if this seems like a very basic question. I wish there was a sample Slack app on their website which showed this.
The following may work for you (I use a similar one on the production);
{
"channel": "your-channel-name",
"username": "channel-username",
"attachments": [
{
"title": "some-title",
"fallback": "some message",
"text": "some text",
"fields": [
{
"title": "sub-title",
"value": "sub-title-value",
"short": true
},
{
"title": "some-other-title",
"value": "some-value"
}
],
"color": "red"
}
],
"icon_emoji": "gun"
}
This link or this one may provide some extra information.
Whenever the user invokes my agent then it shows a list of options to select and also a simple response but the agent first speaks the simple response and then shows the list
Actual
user: Ok google talk to my test app.
bot: Welcome to my test app, Here's the list of options to select. (WELCOME MESSAGE)
Please select your preference (RESPONSE)
<list appears> (LIST)
Expected
user: Ok google talk to my test app.
bot: Welcome to my test app, Here's the list of options to select. (WELCOME MESSAGE)
<list appears> (LIST)
Please select your preference. (RESPONSE)
Is it possible that the assistant first speaks the welcome message,shows the list and then speaks out the response after a certain delay?
No, showing the bubble after the list is not possible.
When you add a list to your response, the spoken text will always appear before the list. This is mainly due to the fact that the spoken/chat part of the conversation is separate from the visual part of your conversation. Even when adding the response after the list in your code, the displaying of rich response is controlled by Google.
Example:
conv.ask('This is a list example.');
// Create a list
conv.ask(new List({
title: 'List Title',
items: {
'SELECTION_KEY_ONE': {
synonyms: [
'synonym 1',
'synonym 2',
'synonym 3',
],
title: 'Title of First List Item',
description: 'This is a description of a list item.',
image: new Image({
url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png',
alt: 'Image alternate text',
}),
},
'SELECTION_KEY_TWO': {
synonyms: [
'synonym 4',
'synonym 5',
'synonym 6',
],
title: 'Title of Second List Item',
description: 'This is a description of a list item.',
image: new Image({
url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png',
alt: 'Image alternate text',
}),
}
}
}));
conv.ask("Please make your selection");
By the look of your example it seems as if you are trying to show the user a couple options on the screen to control the conversation, are you sure Suggestion Chips wouldn't be a better fit for this? These chips are intended to give the user options and are far easier to implement than a list.
Delaying the speech, not the bubble
If you don't want to go that way, what you could do, is add an delay in the spoken text via SSML, but this would only change the experience for people using your action via voice. It wouldn't change the display location of the speech bubble when using the Google Assistant on your phone. For anyone using your action without a screen, this could cause confusion because the speech is being delayed for a list, which is never going to show on their device since it has no screen.
Design in a voice first experience
In general it is a good practice to design your conversation around the voice only part of your conversation. By making your conversation dependable on a list, you limit the amount of platforms you can deploy your action to. A voice first approach to this problem could be to create intents for each option your action supports and opening your welcome intent with a generic message such as "How can I assist you?" and having a fallback intent in which you assist the user by speaking out the different options that they can use. This could be combined with Suggestion Chips to still give the guiding visuals that you desire.
It is a bit more work to implement, but it does give your bot a great more amount of flexibility in its conversation and the amount of platforms it can support.
Add webhook to your action and use the Browsing Carousel JSON for the intent. Add simpleReponse node after the list items to add a response after list is displayed. Sample JSON for Browsing Carousel:
{
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "Here's an example of a browsing carousel."
}
},
{
"carouselBrowse": {
"items": [
{
"title": "Title of item 1",
"openUrlAction": {
"url": "https://example.com"
},
"description": "Description of item 1",
"footer": "Item 1 footer",
"image": {
"url": "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png",
"accessibilityText": "Image alternate text"
}
},
{
"title": "Title of item 2",
"openUrlAction": {
"url": "https://example.com"
},
"description": "Description of item 2",
"footer": "Item 2 footer",
"image": {
"url": "https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png",
"accessibilityText": "Image alternate text"
}
}
]
}
}
]
}
}
}
}
Refer to https://developers.google.com/assistant/conversational/rich-responses#df-json-basic-card
Attempting to pilot a server-side render of a gantt chart using highcharts-export-server, but unable to get the series data to render at all.
As per the docs, I've tried running the export via commandline and as a node module, but I always get an empty graph with the title, subtitle and series name displaying, but none of the actual data.
Failed Gantt Render
All the basic line graph example configurations work and I'm able to render the chart using the Highcharts.ganttChart method via the browser, so I believe it's specific to the Gantt chart configuration for the export server, or related to the millisecond date conversion (as you can see in the screenshot, the X Axis is not rendering as dates, but rather plain numbers). As per suggestions on other threads, I ran build.js in the node_modules/highcharts-export-server, globally for the commandline attempt and project-locally for the node module attempt, making sure to enable the both the gantt and moment libraries, but that didn't help either.
Including my options json below. I haven't been able to find a gantt config example specifically for the export server, so this is my best attempt to interpolate what they'd be:
{
"title": {
"text": "Gantt PoC"
},
"subtitle": {
"text": "Timeline"
},
"series": [
{
"name": "Gantt Demo",
"type": "gantt",
"data": [
{
"name": "Demo Task 1",
"id": "demo_task_1",
"start": 1564113600000,
"end": 1564718400000
},
{
"name": "Demo Task 2",
"id": "demo_task_2",
"start": 1564113600000,
"end": 1564718400000
}
]
}
],
"xAxis": {
"min": 1563681600000,
"max": 1571803200000
}
}
Please let me know if there's anything obviously wrong with my config, if I missed any crucial steps to prep the environment, or any ideas you may have for me to troubleshoot. Thanks!
i also tried to generate image using ganttchart, just i tried constructor which you suggested working perfectly, Thanks.
highcharts-export-server --infile gantt.json --outfile gantt.png --type png --constr ganttChart
actually i tried with HTTP Server as well, working perfectly. Thanks #pawel_d
const fs = require("fs");
const chartExporter = require('highcharts-export-server');
chartExporter.initPool();
const chartDetails = {
type: "png",
constr : 'ganttChart',
options: {
series: [{
data: [{
start: 1,
end: 10
}]
}]
}
};
chartExporter.export(chartDetails, (err, res) => {
// Get the image data (base64)
let imageb64 = res.data;
// Filename of the output
let outputFile = "bar.png";
// Save the image to file
fs.writeFileSync(outputFile, imageb64, "base64", function(err) {
if (err) console.log(err);
});
console.log("Saved image!");
chartExporter.killPool();
});
When I make a call to the endpoint
https://api.instagram.com/v1/users/self/media/recent/?access_token=ACCESS-TOKEN
I get a response which includes this kind of thing:
{
...
images: {
low_resolution: {
url: "http://example.com/s320x320/oijwef/filename.jpg"
},
standard_resolution: {
url: "http://example.com/s640x640/23o8dn/filename.jpg"
},
thumbnail: {
url: "http://example.com/s150x150/20398x/filename.jpg"
}
}
}
The problem here is that even the standard resolution file is not the full image, and includes white bars in the image if the original is not a square.
Looking through their API docs, I don't see any way to get the original image path. Does anyone know how?
Looks like the same problem discussed here: Instagram Square photos API
So How do you get the original image for a photo uploaded as a
landscape or portrait?
Since the API returns only 1 set of images as
of now, but the site is able to show the original aspect ratio images,
I did some digging around, and realized that if you remove the last
but 1 section of the url from the square image urls (in this example,
remove /c0.135.1080.1080 ) you get to the original aspect ratio sized
(and uncropped) landscape, portrait images.
Example:
"images": {
"low_resolution": {
"url": "https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s320x320/e35/c0.135.1080.1080/11909195_1715998838621946_791786043_n.jpg",
"width": 320,
"height": 320
},
"thumbnail": {
"url": "https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s150x150/e35/c0.135.1080.1080/11909195_1715998838621946_791786043_n.jpg",
"width": 150,
"height": 150
},
"standard_resolution": {
"url": "https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s640x640/sh0.08/e35/c0.135.1080.1080/11909195_1715998838621946_791786043_n.jpg",
"width": 640,
"height": 640
}