Closed NiklasBorglund closed 2 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Why are you wrapping your response code in an additional promise? I think that might be the problem.
The extra promise was just a desperate attempt to try fix the issue - it was an issue before I had that in. I just forgot to remove it.
I managed to solve the issue by disabling retries like this:
const controller = new Botkit({
webhook_uri: '/api/messages',
adapter: adapter,
webserver_middlewares: [
(req, res, next) => {
if (req.headers['x-slack-retry-num']) {
res.status(200).send()
return
}
next()
}]
})
And then when I got the message, I immediately set the status to 200 as well with: bot.httpStatus(200). Not sure if this is the best way to solve it. First slack-bot I've ever written, but it solved the issue for me
Ah, Thanks for adding what worked for you!
Hi! I'm writing a super simple bot to take one message that's bloated and reposting a less bloated one in another channel. But I can't seem to get it to work properly.
What was the result you received?
I'm getting multiple messages posted in slack when I use the reply method
What did you expect?
I just want one message in slack.
Screenshots and animated GIFs
I want to take this type of message:
And make it into this:
But i get multiple messages and it looks like this:
Context:
I'm writing a super simple bot just taking a bloated slack message from the Unity 3D Engine Service->rewrite it to be more condensed and post it in another channel.
The original message from unity is posted into a channel named rawbugreports. Depending on the content of the message it till be posted into either a bugreports channel or bugreports-master channel in slack.
I cannot figure out what's wrong here. To me the code looks fine. Anyone knows? Or is it a bug?
The git repo for the bot: https://github.com/NiklasBorglund/UnityUserReportingSlackBot/blob/main/start/bugreportersqueezer.js
I used this guide to create the bot: https://codelabs.developers.google.com/codelabs/cloud-slack-bot#0
Here are the slack scopes:
Here are the event subscriptions:
Here's the code for the bot: