slack-api

How to use the permalink_public URL of an uploaded image to include it in a message?

眉间皱痕 提交于 2019-12-02 01:51:48
I am trying to upload an image to slack and post it in an image block of a slack message to a specific channel. upload an image to Slack. make the image public with files.sharedPublicURL check if the url is public: public_url_shared being true . use the permalink_public I receive for the uploaded image for creating the slack message (an image block). for debugging I am using Slack's Block Kit Builde. I am replacing the URL in the image_url example of the block kit demo with the one I received from slack: https://slack-files.com/T04AG7BVD-FLWHBHY86-1ba8263c00 or: https://slack-files.com

How do I prevent my Slack slash command from echoing into the channel?

谁说胖子不能爱 提交于 2019-12-02 01:11:43
问题 Using Serverless and NodeJS, I have a Slack command set up like: /myCommand doStuff When I type /myCommand doStuff , the Slack output does this: /myCommand doStuff The content of the actual response I want shown goes here. What I want to do is only have this: The content of the actual response I want shown goes here. without the /myCommand doStuff getting echoed. How do I prevent that from happening? Update - adding some code Here's the actual command: module.exports = () => { return new

Slack - Get thread id after posting message using incoming web hook

◇◆丶佛笑我妖孽 提交于 2019-12-01 23:27:56
问题 I am using slack incoming web hook to post message to a channel. Here is my code curl -X POST \ https://hooks.slack.com/services/TXXXXXXXX/BXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX \ -H 'Content-Type: application/json' \ -d '{ "text": "Test message" }' I am getting ok as response. I need thread id( thread_ts or ts ) to reply to that thread. How can I get thread id while posting message to slack using incoming web hooks 回答1: Webhooks will not return IDs for your message. So you don't get the thread

Slack - Get thread id after posting message using incoming web hook

我是研究僧i 提交于 2019-12-01 21:44:32
I am using slack incoming web hook to post message to a channel. Here is my code curl -X POST \ https://hooks.slack.com/services/TXXXXXXXX/BXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX \ -H 'Content-Type: application/json' \ -d '{ "text": "Test message" }' I am getting ok as response. I need thread id( thread_ts or ts ) to reply to that thread. How can I get thread id while posting message to slack using incoming web hooks Webhooks will not return IDs for your message. So you don't get the thread_ts and ts , which you both need to reply as thread. Its technically possible to find your message through

Can Hubot Slack bot store sessions

萝らか妹 提交于 2019-12-01 12:17:08
I am trying to implement simple slack bot. So I have configured hubot which will take inputs from slack and passing it to my webapp ( django app ) and it will take whatever the response from django-app and will reply to slack. In this process I am trying to store session in django using request.session but that is not reflected in slack . If I am accessing the django-url in browser it is able to store sessions and getting proper response with session. So does the problem lie with slack or my approach and is there a way to store sessions in hubot when requesting to django-app ?? I can not speak

Formatting posts with the Slack api

做~自己de王妃 提交于 2019-12-01 11:28:14
I'm trying to create Posts with botkit using the Slack api, but I can't find any documentation on how to format a Post file in Slack. bot.api.files.upload({ content: "# Heading", filename: "test.md", filetype: "post", channels: "random" }); Markdown formatting doesn't work for this, is there any syntax to formatting Slack Posts? Trying with HTML the response from the created file is like this: <document><p><document><h1>H1<\/h1><p><\/p><h2>H2<\/h2><p><\/p><h3>H3<\/h3><p><\/p><p>Text <i>italic<\/i> <b>bold<\/b> <a href="<a href=\"http:\/\/www.slack.com%22%3Elink%3C\/a%3E\">http:\/\/www.slack

How to delete/disable user through slack API?

寵の児 提交于 2019-12-01 07:45:30
问题 I have tried multiple approaches to this. Tried first getting the user without any user id - this returns me just my user, then tried getting user with other id's and it also retrieves data correctly. However, I can't seem to be able to set user attribute 'deleted'. i'm using this python approach. slack_client.api_call('users.profile.set', deleted=True, user='U36D86MNK') However I get the error message of: {u'error': u'invalid_user', u'ok': False} Maybe someone has already done this? It says

Get a list of all private channels with Slack API

拜拜、爱过 提交于 2019-12-01 03:28:57
I've been trying to get a list of all "groups" in my Slack team. However, even with admin privs, groups.list only provides the groups that the token owner's account belongs to. The closest solution I've seen in my research involves getting a bot to sit in the channel. The bot's membership allows it to report on the channel, but then there's the logistical problem of getting the bot into every private channel, despite the fact that we can't list them programmatically. The code I've used to dig up private channel listings: import requests import json token = '...' r = requests.post('https:/

Can you upload a file to the Slack API using files.upload as a different user?

倖福魔咒の 提交于 2019-12-01 03:23:18
问题 I'm trying to find a way to have an application post a text snippet to our support channel through the Slack API. Using the files.upload method, I can create a text snippet and share it with the channel, but the post appears to come from me (because the token used to authenticate the request is mine). I'm looking for a way to do this, but make it appear with a custom user name and icon, like you can with the chat.postMessage method's username and icon_url parameters. Is there a way to achieve

Slack webhook - Which IPs should I open?

时光怂恿深爱的人放手 提交于 2019-12-01 02:37:04
We want to use Slack Webhook (Outgoing Webhook) with an internal web service. Our company is behind a firewall, so outside connections must be whitelisted. It appears that Slack has multiple addresses it will send the API request from, and they don't seem to be documented. Which IPs/Ports should we open in the firewall (whitelist) in order to allow slack's outgoing webhooks to connect to our internal web service? An alternative could be using a VPN tunnel service to expose your internal webserver the Internet, e.g. with ngrok . I can confirm it works with Slack (I use it every day for Slack