slack-api

How to upload an image to Slack using node.js on Windows?

空扰寡人 提交于 2020-01-25 08:04:45
问题 I'm trying to upload an image via Slack using node.js and the request package, but not having much luck. Either I receive invalid_array_arg or no_file_data errors from the API. Here is my request: var options = { method: 'POST', url: 'https://slack.com/api/files.upload', headers: { 'cache-control': 'no-cache', 'content-type': 'application/x-www-form-urlencoded' }, form: { token: SLACK_TOKEN, channels: SLACK_CHANNEL, file: fs.createReadStream(filepath) } }; request(options, function (error,

Can I create a link on a web-page to dm someone on slack? (in a specific work-space)

拜拜、爱过 提交于 2020-01-24 10:38:05
问题 Can I create a link on a web-page to dm someone on slack? (in a specific work-space) according to the documentation, something like this should work <a href="slack://user?team=TEAM-ID&id=USER-ID" target="_blank"> click to dm me on slack </a> Where do I find the team id? Is it the subdomain in the workspace URL TEAM-ID.slack.com When I tried this all it does is open slack to whatever was open last. I want it to open a direct message to the user whose user id is in the link. Update: being that

Does Slack support Markdown tables?

让人想犯罪 __ 提交于 2020-01-22 14:34:26
问题 I want to send a Markdown table to Slack with its postMessage API, but I got raw content in Slack instead of a rendered table. Does Slack support Markdown tables? Ir is there any other way to present tabular data in Slack? I know Slack doesn't support HTML. I tried chat.postMessage and files.upload , also formatting text with fixed column length but it looks kind of ugly, so I am figuring out a way to make it look better. Here is my HTTP request code, content-type is JSON: url : https://slack

Webhook incoming with event subscription create loop

半世苍凉 提交于 2020-01-21 20:23:07
问题 I am using a web service api to receive message from a slack channel (event subscription) and the same web service api to send message (Incoming webhook) to the user on the same slack channel. But when I send a message, this same message is send back to my api by the slack event subscription. That create an infinite loop. How can I declare my message that I am sending to the channel which I can check when I receive back by the event subscription ? 回答1: This is normal behavior of Slack and can

Python can't find installed module slackclient on MacOs. Any suggestions?

大城市里の小女人 提交于 2020-01-16 09:19:29
问题 I'm developing a slackbot. After importing slackclient, I got ModuleNotFoundError: No module named 'slackclient' . I tried all the options and followed suggestions showed in the post here- Python can't find installed module ('slackclient'). By those suggestions, I installed slack but got the following error while importing WebClient. >>> from slack import WebClient Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name 'WebClient' from 'slack' (

Upload Excel to Slack using files.upload API - file uploads, but is corrupted

只愿长相守 提交于 2020-01-15 10:13:11
问题 I'm using Slack's files.upload API to upload an Excel doc retrieved from an AJAX response. I'm using jQuery's AJAX for the upload and the file is uploading correctly except that it's corrupted. When I open the file downloaded from Slack, it contains many "?"s and other characters indicative of bad encoding. Downloading the file and then uploading using Slack's tester tool, works correctly and does not result in corruption. The most relevant portion is the ajaxConfig ; this is the object

How to get username/userID in slack bot

可紊 提交于 2020-01-14 09:57:08
问题 https://github.com/DeronLee/starbot.git I created a slack bot and it worked fine. But when somebody sends message to the bot, I'm not able to tell who sent it. I tried msg.user msg.username , but all of them are undefined. I just want my output to look like this abc: @starbot hello starbot: hello. abc finally. I got it. slack.users.info({ token: config('SLACK_TOKEN'), user: msg.user }, (err, data) => { if (err) throw err var text = makeMessage.makeMessage(msg.text, data.user.name);

How can I trigger a slash command in Slack every day at a certain time

假装没事ソ 提交于 2020-01-13 20:36:04
问题 I want to trigger a slash command in Slack every day at a certain time. Specifically, I want to clear my status every night at midnight. From the documentation it seems like the only way to do this would be via an Incoming Webhook. However POSTing with the following JSON body just creates a message in Slack /status clear and does not actually run the command. '{"text":"/status clear"}' It also posts the message on behalf of the app associated with the webhook, not under my username. Is there

How can I trigger a slash command in Slack every day at a certain time

六眼飞鱼酱① 提交于 2020-01-13 20:35:06
问题 I want to trigger a slash command in Slack every day at a certain time. Specifically, I want to clear my status every night at midnight. From the documentation it seems like the only way to do this would be via an Incoming Webhook. However POSTing with the following JSON body just creates a message in Slack /status clear and does not actually run the command. '{"text":"/status clear"}' It also posts the message on behalf of the app associated with the webhook, not under my username. Is there

How can I trigger a slash command in Slack every day at a certain time

不羁的心 提交于 2020-01-13 20:35:05
问题 I want to trigger a slash command in Slack every day at a certain time. Specifically, I want to clear my status every night at midnight. From the documentation it seems like the only way to do this would be via an Incoming Webhook. However POSTing with the following JSON body just creates a message in Slack /status clear and does not actually run the command. '{"text":"/status clear"}' It also posts the message on behalf of the app associated with the webhook, not under my username. Is there