Microsoft Teams: Inline image links from chat messages - can they be re-used in other chats? - chatbot

Let's assume a chat bot (built using the Microsoft Bot Framework) receives chat messages from users in 1:1 Teams chats. Those messages contain inline images that users paste from the clipboard directly into the chat message.
Those images are represented in the message as img elements like this:
<div>Check this out:<span><img height="20" src="https://eu-api.asm.skype.com/v1/objects/0-weu-d19-123400000000000000000000/views/imgo"
width="20" id="x_0-weu-d19-123400000000000000000000" itemscope="" itemtype="http://schema.skype.com/AMSImage"
style="vertical-align:bottom; width:20px; height:20px"></span></div>
The bot sees those image links and needs to somehow store them, or a link to them. Let's say we want to keep it easy and only store the link.
Here's the question: Can those inline image links be stored and later re-posted in other Teams chats?
Let's say the bot chooses the "best" images and re-posts them once a week to a "best photos" Teams channel. This new chat message - can it just re-use those original image links?
There are similar questions out there which mainly focus on downloading inline images, which apparently requires some kind of authentication. Here is somebody trying to grab those images via Power Automate: Power Automate - retrieve an inline Teams image from Microsoft graph
Is there any documentation about those image links? Who has access to those images? How long? When do those links expire? After removing the chat message that contained the link? Never?
Any insights about those inline image links and the access mechanisms involved are appreciated.

using https://graph.microsoft.com/beta/me/chats/{chat-id}/messages/{id} graph request you will get src as shown in the below image.
you can get images from the request url in the src, from there you can store those images and can re-posted to another chat.

Related

Is there a way to embed an iframe in an email with text that updates?

I want to embed an iframe inside an email that contains the 10 most recent chat messages. Is there a way to make this iframe dynamic so that it always shows the latest 10 chats regardless of when the email is opened? If the iframe is not the correct way to do this, is there a better way?
You can implement an iframe into the email - but your mail will be recognized as spam by many providers.
You should try to render your content dynamically into an image and implement that image into the email.
There kind of is a solution. It is using Dynamic CSS with a fallback of a Dynamic image to pull the information. It is not elegant really as for some clients (e.g. Outlook) this is not available at all and will only display initial information. It also utilizes a link for a style sheet which also severely limits which clients this will work in.
The fall back dynamic image is a bit more comprehensive in client support, but much harder to maintain as you will need to build something that programatically pulls the tweets (HTML webpage potentially) and then also have something that creates and hosts an image for the email to pull. This is not a short, simple thing to set up and may not be worth the required back end work for a simple email.
See this link for a bit more in-depth info on how this can be done for adding a live twitter feed into an email: https://litmus.com/blog/how-to-code-a-live-dynamic-twitter-feed-in-html-email
Since there was no accepted answer i thought i would give my input as well.
Litmus had done something similar for their live twitter feed in emails sometime ago.
The method i can think off is to create a PHP page which takes 10 images and makes it into 1. PHP can have a loop that checks for increments from a specific number and if it exists then add to that 1 image. When there is a new chat image added, PHP will disregard the last one and add the new in the loop.
For anyone reading this in 2022, this is possible with AMP.
Instead of an iframe, you can create a dynamic email easily.
check out amp.dev
Note: AMP is not supported by many email clients

How to track direct URL referrer

Most hosts come with softwares or google analytics which allows you to know how a person got to your site, for example: a link on yelp.com or a facebook.com page link.
But it is impossible for the software to know what method of marketing got a person to visit your site if he directly typed the url (those analytic softwares show them as "direct url").
I need a creative idea where I can refine this broad term "direct url".
One way would be to use flyers with QR codes (links to the website) but instead of the website itself I direct them to clickemart.ca/flyer1_referrer which in turn sends him to the website clickemart.ca but a different flyer distributed to a different location would have a QR code which can be scanned to direct a mobile user to clickemart.ca/flyer2_referrer
So my question is, is this possible, will I be able to figure out which flyer 1 or 2 was more effective based on visits to the redirect urls? If it is possible can you give me a brief idea on how to implement it?
I know a lot of you will say add a form field with "source of referrer" on the site but from my experience this is never filled or filled with incorrect values (typically the closest to the mouse pointer or the top most option or "other" - you get it, something useless).
Any help or guidance is really appreciated!
Solved it here is how:
Connect your site to Google Analytics (www.google.ca/analytics)
Create a campaign URL (support.google.com/analytics/answer/1033867?hl=en)
OPTIONAL: shorten the URL (www.bitly.com)
Create a QR code to the URL (www.qrstuff.com/)
Scan the QR code and watch it appear as a campaign referral under Google Analytics
Here is an explanation to the different steps:
Once you create an account on Google Analytics, you can connect the site by copying a PHP script or a JavaScript onto every page or in my case (magento) the user code can simply be connected through the configuration settings
The campaign URL adds information to the URL link of your website just like the current link on stackoverflow.com variables such as noredirect="..." contains info for your server to process, so using the campaign URL could be used as a tag to determine the source of the referral
Shortening the URL is recommended because the QR code becomes less dense and this in turn reduces the chance of error while scanning the code, the shortened URL links directly to the campaign URL link you provided so it is a seamless process
QRStuff is a good place to download the QR code image at a high resolution
So when you scan this is what happens:
CODE SCANNED >> PHONE COMMAND TO GO TO SHORTENED URL LINK >> REDIRECT TO CAMPAIGN URL >> GOOGLE ANALYTICS RECEIVES INFO ABOUT CAMPAIGN REFERRAL >> YOU CAN SEE IT BY LOGIN INTO GOOGLE ANALYTICS

Including captions in app generated images

I am having a doubt regarding the Facebook policies. It is being stated that:
IV. Application Integration Points
.....
You must not pre-fill any of the fields associated with the following products, unless the user manually generated the content
earlier in the workflow: Stream stories (user_message parameter for
Facebook.streamPublish and FB.Connect.streamPublish, and message
parameter for stream.publish), Photos (caption), Videos (description),
Notes (title and content), Links (comment), and Jabber/XMPP.
.....
Source: https://developers.facebook.com/policy/
And from the examples & explanation page, it says the following for Photos:
You must not pre-fill Photo captions unless the user manually
generated the content earlier in the workflow. These fields are
intended for users to express themselves. Pre-filling these fields
erodes the authenticity of the user voice.
So, my question is: I have seen 99% of the apps (that I used), is auto-filling caption field for photos with say, something like: You can try it by visiting here: http://www.apps.blahblah.com/appname
Isn't that against the facebook policy ? Or they are not flagged because they are using the extended permissions(publish_stream) instead of the post_actions ?
If it is not allowed for both the permissions, then my next question is, how would we tell the users viewing the photo, the link to the app so that these audiences can also try the app ?
Also, if possible, I would like to see a small example of the caption that would be generated in the workflow as mentioned here in the policies: ...You must not pre-fill any of the fields associated with the following products, unless the user manually generated the content earlier in the workflow....
Thanks in advance.
It is against policies, but many apps do it nevertheless.
I think a compromise would be to have the user enter their own message, and then just append a little link to the end of that before posting it.
As for the example, what exactly would you like to know/see? You have the user put in a message through a text field/input box/whatever, and set that as the message while posting the image.
Currently its forbidden. User should fill the whole caption text. Adding anything to it also is also forbidden.
You can watch the Facebook policy video about pre-filling here:
https://developers.facebook.com/docs/apps/review/prefill

How to define what will be inserted in share message?

I have an app with blog records per each user. I have add share button to my app, to give ability to post interesting blog records to users time line or to send to other user. But in default it takes image and text for share as it wants and not always correctly. So I find out that it can be dirven by meta tags (using for example "image" property to set image for share dialog). That's work ok on main page (where I'd like to make ability share with whole application), but on pages of blog records I cann`t customize it. meta tag should be in , but all info (short text and image of blog post) I get later in body, so I can insert it. How can I manage with this? Or may be there is another way to share content with?
What blog engine are you using? If it is a wordpress - try this plugin http://wordpress.org/extend/plugins/facebook-share-new/ from offician facebook docs http://developers.facebook.com/docs/. Otherwise I'd suggest to find a facebook plugin for your blog engine using google and install it.

How does facebook's Share a link feature work?

I'm trying to implement a feature like that where a user inputs a url and when displaying that url I want to have a custom display (an embed object if it's a video from youtube, a thumbnail if it's an image link, title and excerpt of body if it's a normal link).
How can such a feature be realized?
There is a new idea called oEmbed that a few sites support (Flickr, Vimeo and a few others) that addresses this problem. oEmbed site
Otherwise, just check the site against a list of ones you pick and then pull out the relevant bits to construct an embed link.
I liked the idea of oEmbed a lot but unfortunately it doesn't has that much adoption yet.
oohEmbed tries to solve this issue by building oEmbed for many websites.
For the feature to work, it needs the server's interaction where I believe the following scenario is how it works
Assume that we have the site humanzz.com and that it provides such feature
A user enters a url on the humanzz.com's webpage and presses a button like facebooks' preview button
An AJAX call is made to a dedicated page on humanzz.com
humanzz.com does calls the remote website and gets its data
The AJAX call now returns the page's data (oEmbed JSON object)
This involves so much server's overhead.
I really wanted to do it using JavaScript as the server's role was only to bypass "Same Origin Policy"'s restrictions.
oohEmbed allows bypassing the server's step by specifying a callback parameter to oohEmbed so that the JSON object returned is passed to a callback function on your page.
An example illustrating this is as follows
Add a script tag dynamically to your page
< script type="text/javascript" src="http://oohembed.com/oohembed/?url=http%3A//www.amazon.com/Myths-Innovation-Scott-Berkun/dp/0596527055/&callback=myCallBack">< /script>
This would result in executing myCallback(oEmbedJSONObject) which is great.
The problem with that solution is you still have to have a fallback for websites that don't have oEmbed representations.
For the embedded things, I have been using auto_html ( https://github.com/dejan/auto_html) with great success (vimeo, youtube, images) and even added soundcloud myself. But I am still looking for a "thumbnail" generation with an image and text facebook-like.
I guess you have to construct it by yourself by manually parsing the kind of URL you get.
If it is an image url, well then you just have to rescale it and in case the user clicks on it, then handle that by opening the original one somehow.
If it is a link to some youtube video, then you have to take a look at how the embedding of Youtube videos works. You can just copy the code that is provided by Youtube itself, and then exchange the parts with the URL to the video with the URL you got from your user.
I did never implement something like that, but I assume it should work somehow like this.