We can add X-Slack-Retry-Num and X-Slack-Retry-Reason values to com.slack.api.bolt.context.builtin.EventContext class.
~jayyhkwon Ah ... you are right. I have to say there is no way to directly access request headers in listeners. I will take a look at possible ways to support this use case in the future versions. As a workaround, you can use a global middleware this way:
app.use((req, resp, chain) -> {
String retryNum = req.getHeaders().getFirstValue("X-Slack-Retry-Num");
req.getContext().getAdditionalValues().put("x-slack-retry-num", retryNum);
return chain.next(req);
});
app.event(AppMentionEvent.class, (req, ctx) -> {
String retryNum = ctx.getAdditionalValues().get("x-slack-retry-num");
return ctx.ack();
});
Originally posted by @seratch in #646 (comment)