How to set message caption using Facebook Messenger SDK for iOS - objective-c

I need to set a caption when I share a picture (QR code) from my app integrated with Facebook Messenger.
There is metadata NSString field but I don't see a way how to use it. Did anyone solve that problem?
metadata field You can see that we're passing options to the share
method. This contains two fields we want to send back to Messenger:
metadata and contextOverride.
The metadata field takes a NSString and is optional. It can be used to
give information about the content being shared. For example, you can
store a serialized JSON string. This is useful during replies as this
data is passed back to your app.
https://developers.facebook.com/docs/messenger/ios#bp_using_metadata

The metadata is meant for you, as a developer, to use. For example, when a user creates an image from your app you can attach metadata to it, at that point. This metadata is sent, in the background, together with the image to the recipient. When they decide to reply, using your app, you will receive the metadata there.
You can use this, for example, if in your app somebody selected a category to get the image. When you pass in this category in the metadata (which is up to you to format, but JSON is convenient), you get this metadata/JOSN in your app when the recipient replies. You can read the category and load the images on that category already.
The metadata does not set a caption to your image. Actually, there is no integrated way to add a caption to your images.
I would advise to generate the QR-code part of the image and the caption in your app. The image that you post to the Messenger API is thus a combination of the QR-code and a textual caption above or below it. Does that make sense?
ps: about the credible source; I'm a developer support engineer at Facebook :)

Related

How to upload custom image when create new channel

We need to have the ability to set a custom image for new channels.
From docs https://getstream.io/chat/docs/#initialize_channel, I can see the field image and if send here some remote URL - works fine.
But what to do when we need to send an image from the phone? For sending image for message I can see the functionality. But it's bonded to channel which is going to be created.
I know we can use base64, but I hope there is a better way of doing the required functionality? (like upload the image to server and get remoteURL)?

How to add `c8y_Address` property to a device using API in cumulocity?

Here is the image of the asset information widget, which can add a property called c8y_Address
I would like my device to show their address information on the asset information widget, but I don't really know how to upload these properties to a device.
I am using MQTT. So I created a customised SMQRT Template, which is a POST inventory method 001,<region>,<street>,<territory>. And then I publish it using client.publish('s/uc/TemplateName',001,${region},${address},${territory});. But it doesn't work.
I'm just wondering how can we use API to add the address information as a property of a device?
Thank you.
POST would create a new object. I guess what you want to do is updating the device with this properties. So a PUT template would be the correct choice.
Note that the preview shown in the UI currently is incorrect for PUT templates.
It says:
999,<c8y_Address.region>,<c8y_Address.street>,<c8y_Address.territory>
but it actually needs to be (like described in the SmartREST 2.0 guide):
999,<externalId>,<c8y_Address.region>,<c8y_Address.street>,<c8y_Address.territory>
The externalId needs to be from the device you want to update (if you only have a single device without children it would be what you also use as MQTT clientId).

Google Custom Search API Search Image by Image URL

I am working on an application which will have an option for users to upload images. Once uploaded, the application will show other images from the web which look exactly similar, whether or not of the same size.
For this, I will create a temporary URL for the image so that I could provide Google custom search API the URL of the image. I would expect in response, URL's of images that are exactly the same or similar to it, perhaps in JSON format.
I did find a similar question posted in January. Till then Google did not support anything like this, apparently:
Google Javascript Custom Search API: Search images by image url
One can also simply do:
http://images.google.com/searchbyimage?site=search&image_url={Image URL}
Since that is not part of an official API, it may not be right to use this method.
Can someone help me?
Well, the answer quite simply is TinEye Commercial API https://api.tineye.com/welcome. I was looking in the wrong place I guess, I did not have any luck with Google Custom Search API.
Would you need a simple result?
If you are, you can use Vision API of Google.
This is very simple.
https://cloud.google.com/vision/
You can try on the top.
First, access the URL.
Second, upload your image file on the "Try API"
Third, click "JSON" tab menu on the result.
You can be seen JSON about similar images.

Show a single thumbnail when posting on facebook

A little background info is that my team and I developed a website for a Real Estate Agency and I've been assigned the task of setting the image of the currently selected property into facebook's sharing feature.
The webpage for the property is dynamic as there are several listings, so what I've done is select the first image that is loaded on the page and set it to the og:image meta tag.
Now let's say I copy the URL and post it on Facebook, it'll show the correct thumbnail, HOWEVER, it'll also show multiple thumbnails from other listings.
All images on the website are over 200 x 200px and are within an aspect ratio of 3:1.
My question is, how do I tell Facebook to only take my initial image and not grab others while it's as it.
Is there perhaps a SelectSingleImage property that I can apply?
I've already spent more time searching for the answer to this issue than I would have liked, so thanks for any help provided, it's much appreciated.
One method I use sometimes is to recognize Facebook's server and simply provide it with different data. This way you can actually only have one image on the page (as far as Facebook knows).
I don't know anything about vb.net, but here is a simple code sample in PHP. All it does is perform a regular expression on the user agent of the request to match it against the string "facebook".
$isFacebook = false;
if(preg_match("/facebook/",strtolower($_SERVER["HTTP_USER_AGENT"]))) {
$isFacebook = true;
}
Facebook may very well change their user agent signature one day, but for now, I'm pretty sure you'll be safe but keep synced with the Developers Blog and the Roadmap.
It seems that Facebook saved those images in cache for some bizarre reason, but to resolve this issue all I had to do was enter the URL into Facebook's Linter tool which in turn cleared the cache on their server.

Xcode tag users in image

I want to make something similar to facebook tag mechanism. I will display an image of a building to the users and i want them to be able to tag themselves in which room they are at the moment. The location would be sent to a web server so all users can see other's location. Is that possible and how? Thanks in advance.
It is likely to be possible.
I can suggest the following solution: store the building photo/scheme AND rooms information on server.
In your App, you will display image (perhaps in ScrollView), there you will have just TapGestureRecognizer which will recognize the room, depending on coordinates of tap.
In case of this solution, you will have to manually store information about each tap-zone corresponding to a room. But that's the most likely case.