[Feature] Post ephemeral message using responseURL
#27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows for use of
response_url
incoming webhook to post an ephemeral message (a common pattern after closing a modal, for example). It could easily be applied to message too, but I figured ephemeral was a good starting point.Unfortunately, when posting a message or ephemeral message using
response_url
, slack doesn't give back themessage_ts
, just an "ok" or error code. To work around, I'm using theresponse_url
as the key for the phelia cache instead ofchannel_id:message_ts
. I prefix eachaction_id
with the response_url transparently , then use that URL to look up the cache we need.One caveat:
response_url
, I think, can be used up to three times within a 30-minute timeframe. I just assume that we use it to post one-and-only-one message. We may want to enforce this by ensuring the phelia cache incurs a miss when callingpostEphemeralResponse
.Followups that would be valuable:
postMessageResponse
as well.Very happy to work on those if we're feeling this is a good direction.