Delete content block after button click

23 views Asked by At

I want to delete a content block with a Slack bot and I have this:

app.blockAction("confirm-block") { req, ctx ->
            val ack = ctx.ack()
            println("Channel ${req!!.payload!!.container.channelId} ts ${req.payload!!.container.messageTs}")
            val result = ctx.client().chatDelete { r ->
                r // The token you used to initialize the app, stored in context
                    .token(ctx.botToken)
                    .channel(req!!.payload!!.container.channelId)
                    .ts(req.payload!!.container.messageTs)
            }
            LOG.info("Delete result ${result}")

I get good output: Channel D05DXXXXXXX ts 1697577346.xxxxx

If I open the browser and look at the content block div its id is that timestamp (1697...) - but my response is always ok=false and error=message_not_found

How do I delete the content block that caused the event?

0

There are 0 answers