Upload file using slackbot as Direct message - slack-api

I am created slack bot, is there is any possible way send reply message as file? (I need to sent some file as reply message based on input). I tried using api file.upload it make the file as private not able access using url, but if i am upload to channel using sampe api, file is public, is there any way to send direct message as file by bot)

Yes. You can share a file directly and privately with a user by sharing it in a direct message channel with the user.
Just put the {user-id} of the user you want to share the file with in the channels parameter of the files.upload API method and you are all set.
Your slack app will need the files:write:user scope. This also works with bots.
Example for user with ID U12345678:
curl -F content="Hello" -F channels=U12345678 -F token=xoxp-your-token-here https://slack.com/api/files.upload

Related

Video as attachment in email

I use graph api to send emails to users. Is it possible to add video as attachment to email ? I converted .mp4 to binary string, set contentType to video/mp4, id to new Guid.
I created a request to send email, got correct response, but I don't recieve email (emails without videos works fine).
Documentation is not really helpful.
If the file size is between 3MB and 150MB, create an upload session, and iteratively use PUT to upload ranges of bytes of the file until you have uploaded the entire file. A header in the final successful PUT response includes a URL with the attachment ID.
There is a one limitation. An app with delegated permissions returns HTTP 403 Forbidden when attempting to attach large files to an Outlook message that is in a shared or delegated mailbox. With delegated permissions, createUploadSession succeeds only if the message is in the signed-in user's mailbox.
Resources:
Atttach large file

Telegram URL to send message to specific bot

Is it possible to craft a t.me URL that prompts the user to send a specific message to a specific bot. The closest I've found so far is t.me/share/url?url=my%20message, but that doesn't specify a username so the user has to choose one. I don't see the t.me URLs documented anywhere.
Note: this is not the same as sending a message via the API.
You can use deep linking to bot, use following format like this link:
https://t.me/username?start=<token>
Your backend will receive /start <token> . The user however will just see normal
/start
on their chat window.

Using the Slack web API when deep linking to direct message/IM, I get "#deleted-channel"

When responding to a slash command with a string that includes a channel ID like <#C3989289>, the response in Slack shows a deep link to that channel "#general.
When I do the same for a direct message or IM, the response in Slack shows "#deleted-channel" and it's not a link.
I don't see anything in the docs about why this: https://api.slack.com/docs/message-formatting#linking_to_channels_and_users
Slack has confirmed that their system is designed in this way to protect private channels/direct messages from being made aware to users, even if the recipient of the message containing the deep link does belong to that particular channel/DM.

Slack URL to open a channel from browser

This iTunes URL will open The Hitchhiker's Guide to the Galaxy in your iTunes:
itmss://itunes.apple.com/us/audiobook/hitchhikers-guide-to-galaxy/id315596797
This Spotify URL will open ALL by the Descendents in Spotify:
spotify:track:22feF2sbtGydtvx1OeLSih
Does Slack have a URL scheme to open a #channel in the Slack app from a link?
I want to put a link on my team's site that can link to the Slack #channel we use, for use by other people in the company.
Referencing a channel within a conversation
To create a clickable reference to a channel in a Slack conversation, just type # followed by the channel name. For example: #general.
To grab a link to a channel through the Slack UI
To share the channel URL externally, you can grab its link by control-clicking (Mac) or right-clicking (Windows) on the channel name:
The link would look like this:
https://yourteam.slack.com/messages/C69S1L3SS
Note that this link doesn't change even if you change the name of the channel. So, it is better to use this link rather than the one based on channel's name.
To compose a URL for a channel based on channel name
https://yourteam.slack.com/channels/<channel_name>
Opening the above URL from a browser would launch the Slack client (if available) or open the slack channel on the browser itself.
To compose a URL for a direct message (DM) channel to a user
https://yourteam.slack.com/channels/<username>
Sure you can:
https://<organization>.slack.com/messages/<channel>/
for example:
https://tikal.slack.com/messages/general/ (of course that for accessing it, you must be part of the team)
The URI to open a specific channel in Slack app is:
slack://channel?id=<CHANNEL-ID>&team=<TEAM-ID>
You will probably need these resources of the Slack API to get IDs of your team and channel:
GET https://slack.com/api/team.info
GET https://slack.com/api/channels.list?exclude_archived=1
Here's the full documentation from Slack
This link opens the channel in the browser
https://<org-name>.slack.com/channels/<channel-name>
This link opens up the slack channel in the App
https://<org-name>.slack.com/archives/<channel-name>
You can use
slack://
in order to open the Slack desktop application.
For example, on mac, I've run:
open slack://
from the terminal and it opens the Mac desktop Slack application.
Still, I didn't figure out the URL that should be used for opening a certain team, channel or message.
When I tried yorammi's solution I was taken to Slack, but not the channel I specified.
I had better luck with:
https://<organization>.slack.com/messages/#<channel>/
and
https://<organization>.slack.com/messages/<channel>/details/
Although, they were both still displayed in a browser window and not the app.

Objective-C: Saving a sent email as a file

I would like to compose and send an email programmatically via an iOS app. On a successful send, I want to be able to store a copy of the sent email as a file so that I can integrate and store the email in a document/contact management system.
Does anyone know if this is possible and if so, which libraries are available? I have had a look at some of the SMTP libraries on GitHUb but cannot find how to save emails as a file
You can not save an email from email composer in iOS.
All you need to do is, You can generate email format file manually with code (as you already have all the data of email) and save it if you get success flag in delegate method when user send an email.

Resources