In bot framework composer in Teams channel is there a way to determine file size of an uploaded file? - sharepoint

Bot framework composer in web channel gives you file sizes as an array in turn.activity.channelData.attachmentSizes (these don't always line up with the array order of the attachments but it's better than nothing).
However in Teams channel there's no attachment detail other than the url, some download url involving an id, and what the file says its extension is.
In response to this suggestion I tried https://<sharepointsite>/_api/web/getFileByServerRelativeUrl('/path/to/filename.ext')/Properties but it returned 403 Forbidden.
I'm wondering if Graph API is the only way (I'd rather not have to get users to agree to that) or if there's some rest api that can gather it for me?

Related

How do make a telegram bot to read a pdf file sent by user and extract data from it?

I have been checking on forums(stack overflow, git, Telegram APIs) to check how could I extract contents from a pdf file which is sent by user? I have created Telegram bot using python's python-telegram-bot library and as an efforts to try to solve my question, I had checked links eg: https://pypi.org/project/python-telegram-bot/ and https://python-telegram-bot.readthedocs.io/en/stable/index.html in search of functions but couldn't find anything there.
I did find methods to send a pdf file to user from bot and send a file from user to bot but there is nothing available where BOT can extract contents of pdf sent by user. Will be grateful if experts could guide me here.
python-telegram-bot is a library that provides a wrapper for the Telegram Bot API. As such, it provides all the methods from the API as well as auxiliary functionality to build chat bots in general, including downloading files sent by users. Extracting contents from a received PDF file after download is however far beyond the scope of this library.
Of course there are other libraries that provide such functionality and that can be used in combinantion with python-telgram-bot. See e.g. camelot.
Disclaimer: I'm currently the maintainer of python-telegram-bot.

Fetching external files from URL with custom Microsoft Teams App

Im currently making a custom app for Microsoft Teams, and im trying to get it to fetch files from a URL without One-drive and Sharepoint. I've been reading the documentation on bots and outgoing webhooks, but they seem to all utilize either one-drive or sharepoint. I want my custom app to fetch files from a URL and then upload them to the corresponding Team or Channel within MS Teams.
Any help greatly appreciated!
you can fetch the recent files using graph Api, could you please check this document to fetch the recent files.
Regarding Cards and sending notifications:
Using Adaptive Cards the source for the images or artwork for your notification can be anywhere that you have declared as a valid domain in your Teams Manifest - validDomains
Note that while ODB/SPO are the most common / natural locations for files in teams , there is nothing special about these locations or urls. (clearly you need access and authentication, but these are not special, just essential)
Sample fetching artwork from non-SPO locations: https://adaptivecards.io/samples/ImageGallery.html
Adaptive Cards in teams : https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/design-effective-cards?tabs=desktop

Add document to envelope based on tempalte

I'm not very familiar with DocuSign or its API and after playing around in Postman I'm still not sure if I'm able to:
Create an Envelope based on a Template
Attach a pdf doc to said Envelope
Send for signing.
In case I got it all wrong, I'm trying to do the following:
Get the pdf doc from a third party and send it for signing via DocuSign. The document will be the same format every time(same signature placement, names, etc) except for data in it and it will be sent to the same people for signatures.
Is it possible to do so? Am I looking at right stuff?
Yes, this is completely possible. We in fact have existing Postman requests that do just that:
https://www.postman.com/docusign/workspace/docusign-s-public-workspace/request/14257714-ef2d10ba-b540-4644-93a1-b0344c0dd82c
Examples number 15 to 18 are the ones you want to look at.
To get started with our Postman collection, you can watch our youtube video: https://www.youtube.com/watch?v=mV73U2tg9c0&t=6s

Slack bot can share file but not post message while not in channel

I am especially new to slack web api and bots. My question is what is the reason stands behind the inability of bot users to post messages into a channel, until they are implicitly invited, despite the fact that on behalf of a bot we can upload a file to it. Below are couple of code snippets
i've requested the following scopes chat:write:user bot files:write:user
when I upload a file with a bot token obtained via OAuth2 the file is present in a channel with a bot icon and name
.token(BOT_TOKEN)
.title("title")
.content("content")
.channels(Collections.singletonList("#channel"))
.build();
but when I using the same approach trying to post a message to the same channel I get an error not_in_channel
.token(BOT_TOKEN)
.channel("#channel")
.text("text")
.asUser(true)
i know it is working without passing as user true however it sets the default application icon and name not the bots one.
Is there a way to publish messages/upload files to a channel without users interaction after the authentication with a bot.
The issue here seams to be that the icon and username are different when first posting a message to a channel as bot and later uploading a file as bot. This seams to be a known issue for Slack. This is what is said in the documentation for chat.postMessage for as_user is false:
Note: In the Slack App cases above, it would certainly make more sense
for your application's name to be the default username associated with
your app. This inconsistent behavior will be corrected. Of course, you
can still name your bot "bot," if that is your bot's name.
But there is a workaround to get the same username and icon. Just set them manually when sending the message, e.g.:
curl -F token=BOT_TOKEN -F channel=CHANNEL -F text=Hello -F username=NAME_OF_BOT -F icon_url=ICON_URL https://slack.com/api/chat.postMessage

Retrieving files from blog media entries

The tool I'm building needs pull data from IBM Connections Ideation Blogs. I therefore use the Connections API with basic authentication to read Blog Entries. This goes well until the description contains images. When I ask the API to provide media resources for the blog, it does not show any entries of the /BLOGS_UPLOADED_IMAGES location - the one containing images uploaded through the blog's richtext editor. The user I use in my API call is the same user who created blog entries and uploaded pictures.
However the API call DOES contain images I publish using the API and a POST request to the blog's media entry collection. This is where the next problem appears. Those Atom entries for images contain various links, one of them with a ref="enclosure", of which the API documentation (link) tells me to "Use the web address in the href attribute to obtain the binary content of the file". However, my calls to this adress are always answered with 404 response code.
Another url in the Atom entry (this time of the element) is described by the same documentation (see link above) as: "Provides access the document's media. The following operation is supported: GET: Use the web address to obtain the media." When I make a call to this url, as always with basic authentication credentials attached, the response contains the html of the login form of Connections, so API authentication does not seem to be supported on this url. This is only the case for non-public communities, which require authentication, of course, if the picture is publicly availabe all works just fine.
Am I missing something out? Is there another way to retrieve the actual image from a blog's media entry through the API? Are manually uploaded pictures never contained in the media entries result or is this a bug?
It now magically works using the link with ref="enclosure" from the atom entry. I might have gotten something wrong with authentication I guess (although I'm not actually realizing what I'm doing different now than I did before).
Problem remaining: Pictures uploaded through the rich-text editor in the folder /BLOGS_UPLOADED_IMAGES do not appear in the media feed of the blog.

Resources