我目前使用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