我目前使用SlackConnector回收https://github.com/noobot/SlackConnector。我创建了一个机器人,并将交互式消息发送给我的聊天。我想添加功能到我的交互式按钮,但点击它们后,我得到了这个回应。 Darn – that didn’t work. Only Slack Apps can add interactive elements to messages. Manage your apps here: https://api.slack.com/apps/
所以它看起来像我需要一个请求的URL来让我过去我目前的障碍。有没有办法在本地测试交互式消息按钮?在本地测试Slack交互消息
List<SlackAttachment> attachments = new List<SlackAttachment>();
List<SlackAttachmentAction> actions = new List<SlackAttachmentAction>();
actions.Add(new SlackAttachmentAction
{
Name = "game",
Text = "chess",
Type = "button",
Value = "Chess"
});
actions.Add(new SlackAttachmentAction
{
Name = "game",
Text = "Falken's Maze",
Type = "button",
Value = "Maze"
});
actions.Add(new SlackAttachmentAction
{
Name = "game",
Text = "Thermonuclear War",
Type = "danger",
Value = "war"
});
attachments.Add(new SlackAttachment
{
Text = "Choose a game to play",
Fallback = "You are unable to choose a game",
CallbackId = "wopr_game",
ColorHex = "#3AA3E3",
Actions = actions
});
connection.Say(new BotMessage
{
ChatHub = chatHub,
Text = "Usage: !talk <user>",
Attachments = attachments
});
return Task.CompletedTask;
有一两件事我想是我设置的请求URL使用来自https://webhook.site/#/生成一个URL,我仍然可以在点击
也许你可以把这个答案带回原来的问题?就目前而言,很难看出这可能会如何或为何解决他的问题。 – theMayer
当然,我会延长我的回答 –
嗨@ErikKalkoken谢谢你的伟大答案。我正在尝试使用ngrok,但我觉得我正在设置它错误。我与ngrok联机,并且我将Forwaring地址设置为Interactive Message的请求URL。所以看起来像http://1e9ede37.ngrok.io,当我点击一个按钮,我得到相同的响应,ngrok也没有得到一个请求。有什么想法吗? – Master