phelia
phelia copied to clipboard
[Feature] Post ephemeral message using `responseURL`
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 the message_ts
, just an "ok" or error code. To work around, I'm using the response_url
as the key for the phelia cache instead of channel_id:message_ts
. I prefix each action_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 calling postEphemeralResponse
.
Followups that would be valuable:
- Making it more explicit that ephemeral messages cannot actually use state. They cannot be updated per slack API.
- I think we probably need to have a clearer API for dealing with the various ways to respond to a slack message: triggerID and responseURL.
- Add
postMessageResponse
as well.
Very happy to work on those if we're feeling this is a good direction.