Inumedia/SlackAPI

Cannot post to #general channel

lorddev opened this issue · 2 comments

When I use my slash command, the response is only visible when I chat directly with the bot, but doesn't work when I post in #general.

if (!_verifier.VerifyRequest(HttpContext.Request, Encoding.UTF8.GetBytes(body)))
	return Unauthorized();

ThreadPool.QueueUserWorkItem(async cb =>
{
	_logger.LogDebug("Attempting to fill Slack with beans...");
	try
	{
		SlackTaskClient client = new SlackTaskClient(_settings.BotToken);
		await client.PostMessageAsync(request.channel_id,
			"I want to fill your computer with beans but all I could find was this potato 🥔");
	}
	catch (Exception e)
	{
		_logger.LogError(e, "Error posting message");
	}
});

No errors are thrown.

I solved the slash command response issue using

HttpClient client = new HttpClient();

await client.PostAsync(request.response_url,
	new StringContent(JsonConvert.SerializeObject(new
	{
		text = "I want to fill your computer with beans but all I could find was this potato 🥔"
	})));

But I still don't know why I can't post to #general. Which scope is required for that?

Not really the best place for this question; turned out to not be a code issue.