我创建了一个小型测试机器人,将本地python脚本与Slack连接起来。机器人的主要任务是创建自定义字符串,并将其发送到Slack中的频道。这是用来完成的 from slack_sdk import WebClient
client = WebClient(token = slack_token)
slack_message = "Hello @demo_user" # @demo_user is an existing user, which can be mentioned in chat
client.chat_postMessage(channel = channel
我正在创建一个来连接到Jira。但是,当我将服务器部署到VM (Azure)上时,它会给出这个错误。有什么想法吗?错误:
401 Client Error: Unauthorized for url: https://***.atlassian.net/rest/api/2/search?startAt=0&fields=%2Aall&jql=project%3Dtest
2022-11-09 17:31:40,851 - ERROR - slack_bolt.App - Failed to run listener function (error: Object of typ
我知道如何打印使用slack向slack发送通知,例如,如果我有一个名为#testbot的空闲通道,那么我可以将通知打印为:
slack.chat.post_message('#testbot','This is a test',username='NMAP_bot')
在python中,我遵循一个面向对象的apporoach,其中我有两个类,最重要的是,定义了一个方法如下:
def notify_slack():
class Report(object):
.
.
def new_hosts(self):
"
我知道松弛的API auth.revoke,但是当我使用它时,它不起作用。
我正在尝试以下方法,将其输入到我的终端中,其中<TOKEN>是空闲令牌。
curl -i https://slack.com/api/auth.revoke H "Authorization: Bearer <TOKEN>"
我得到的错误是:
{"ok":false,"error":"not_authed"}curl: (6) Could not resolve host: H
curl: (3) Port number ended
我试图创建一个简单的装饰器,以便与Slack API一起使用,以进行进一步的编码,以便在以后更容易和更有条理地改进功能(也就是说,在将来,我希望包含一个我希望机器人完成的新函数/命令) 但它并没有像我预期的那样工作。让我解释一下,这是我的代码(我省略了大量代码,如实例化、令牌等,以保持问题简短并说明要点)它包括一个简单的函数,该函数应该在Slack通道中输出一条消息: class Bot(object):
def __init__(self):
# Bot's user ID in Slack: value is assigned after the bot
我正在尝试使用python SlackClient来打印发布消息的通道。运行这段代码后,我只得到一个ID,而不是频道名。
import time
import os
from slackclient import SlackClient
BOT_TOKEN = os.environ.get('SLACK_BOT_TOKEN')
def main():
# Creates a slackclient instance with bots token
sc = SlackClient(BOT_TOKEN)
#Connect to slack
i
我想在我的邮件呼叫中添加多个附件。 我使用了这篇文章中的示例代码How to upload any file on Slack via Slack-App in c# public class SlackAttachment
{
public string fallback { get; set; }
public string color { get; set; }
public string pretext { get; set; }
public string author_name { get; set;
当一个作业失败时,我的通知就不会到达,我也不知道为什么。在我的工作中:
use Notification;
use App\Notifications\MonitoringMessage;
public function handle()
{
asdf;
}
public function failed(Exception $exception)
{
$message = ':warning: A job failed.';
Notification::route('slack', config('services.slack.webhoo