Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable way to see Message ID of interaction source and response #2410

Closed
SpencerSharkey opened this issue Dec 23, 2020 · 17 comments
Closed

Enable way to see Message ID of interaction source and response #2410

SpencerSharkey opened this issue Dec 23, 2020 · 17 comments
Assignees
Labels
api API issue feature request planned We're going to fix this pretty soon slash commands synced Synced to internal tracker

Comments

@SpencerSharkey
Copy link

SpencerSharkey commented Dec 23, 2020

Description

After acknowledging a slash command interaction, there appears to be no way to get the channel message id for the interaction source message (if you decide to show it), or the message you reply with in the initial response.

Why This is Needed

I think it's important to be able to link an interaction to the messages it sends in a channel. An example could be deleting messages related to the command run after X amount of time to clean up the channel, or to link reactions, replies, etc up to the original messages sent.

Alternatives Considered

  • A way to hide the interaction source message after acknowledging it, which may be enough for most folks.
  • Including an interaction ID on the message objects (painful to sync these events w/ interaction flows)

Additional Details

I know this wouldn't be too useful if your application doesn't have a bot user- but for the ones that do the extra control would be appreciated. It looks like you can hack something together by comparing a message's content (</slash:12312312312> <args>) and type against the interactions your app provides, but it would be a lot of extra work for something that could be provided w/ the interaction API.

@typpo typpo added the api API issue label Dec 23, 2020
@discord discord deleted a comment from drzheer Jan 6, 2021
@msciotti
Copy link
Contributor

msciotti commented Jan 6, 2021

Definitely valid. A little tricky from an API ergonomics perspective--you respond to an interaction by issuing an HTTP response code, so we can't like...respond to your response 😄

We could perhaps allow you to GET /@original much like you can EDIT and DELETE. It would be an extra step but maybe an OK enough short term fix?

@ckohen
Copy link
Contributor

ckohen commented Jan 6, 2021

Maybe if the response is sent to the /callback endpoint you can respond to that with the message ID, and provide that GET /@original endpoint for the REST only applications

@msciotti msciotti added the synced Synced to internal tracker label Jan 6, 2021
@msciotti
Copy link
Contributor

msciotti commented Jan 15, 2021

We're going to support this by making the GET /@original endpoint. It definitely is less ergonomic for gateway connections--which sucks, I apologize--but it's an easy way to support both methods with the same code.

EDIT: I realized that addressed half the issue. As for getting the ID of the source message, we have some thoughts there about how design changes may impact the relationship between source and responses, so no update on the source message id yet as we figure that out.

@msciotti msciotti added the planned We're going to fix this pretty soon label Jan 15, 2021
@SpencerSharkey
Copy link
Author

If the GET ../@original returns the full message object, that sounds great.

@msciotti
Copy link
Contributor

It should. You can technically mock this behavior today by sending an empty PATCH ../@original :p

@msciotti
Copy link
Contributor

msciotti commented Mar 3, 2021

So, with some changes to messages and interactions in #2615, this "source message" concept is going away. And, some interaction metadata is sent on the message object that you'd receive in a message create.

So, you could:

  1. Receive an interaction
  2. Respond to it, noting it's unique id
  3. Listen for MESSAGE_CREATE events on the gateway with the matching ID

Since deleting the original source message isn't a thing (they're now all one message), is a GET endpoint still needed, or does this new metadata help?

@ckohen
Copy link
Contributor

ckohen commented Mar 3, 2021

Would that mean that the interaction id received with the INTERACTION_CREATE payload is now the same as the message id of the response message? Or am I misunderstanding that.

Also, I still believe the GET endpoint would be necessary, as you will get the message object when using type 5 inherently by using the PATCH endpoint to finish your response, but when responding directly, there's no way to achieve this without a bot.

I also assume PATCH would no longer work after the 15 minute expiry period, whereas GET might? I generally think more from a gateway perspective, so this wouldn't really affect me personally, but there might be some use for those only using HTTP.

@A5rocks
Copy link
Contributor

A5rocks commented Mar 3, 2021

Would that mean that the interaction id received with the INTERACTION_CREATE payload is now the same as the message id of the response message? Or am I misunderstanding that.

I believe Mason is referring to ddc0d13.

@ckohen
Copy link
Contributor

ckohen commented Mar 3, 2021

Ah, I missed that commit 🤦. I still believe the rest of points are valid though.

@TorKallon
Copy link

Any news on this? Will there still be a GET method or will watching for the message in the event stream be the only way to get the message ID?

@Skillz4Killz
Copy link
Contributor

Quick hackish workaround:

You can use the interaction webhook token as a normal webhook execution with ?wait=true and get the message id from that.

@msciotti
Copy link
Contributor

msciotti commented Apr 9, 2021

Update on this: we had a PR that got merged, then reverted due to some failing tests.

We'll be adding:

/webhooks/<webhook_id>/<webhook_token>/messages/@original
/webhooks/<webhook_id>/<webhook_token>/messages/<message_id>

And will document them when they're merged!

@ThaTiemsz
Copy link
Contributor

Update on this: we had a PR that got merged, then reverted due to some failing tests.

We'll be adding:

/webhooks/<webhook_id>/<webhook_token>/messages/@original
/webhooks/<webhook_id>/<webhook_token>/messages/<message_id>

And will document them when they're merged!

These endpoints are live now

vladfrangu added a commit to discordjs/discord-api-types that referenced this issue Apr 14, 2021
BREAKING CHANGE: possibly a breaking change due to the fact that the
messageID is now strictly typed as a Snowflake or `@me`
  - Reference: discord/discord-api-docs#2410
@qaisjp
Copy link
Contributor

qaisjp commented Apr 14, 2021

This is great news. Will this pave some road for #2251?

@RedDaedalus
Copy link
Contributor

RedDaedalus commented Apr 14, 2021

Discord has said multiple times that webhooks replying to messages will never happen. Allowing replies would let webhooks access any message but this behavior only lets them access their own (which they could theoretically access anyway by caching sent messages).

@qaisjp
Copy link
Contributor

qaisjp commented Apr 14, 2021

My implication here is that replies could be possible for replying to own webhook-created messages.

I'm aware of one engineer's immediate feedback that this is not going to happen right now. Considering the fact that #2251 is still open, I am hopeful that this is not a "will never happen" situation.

@night
Copy link
Contributor

night commented Apr 19, 2021

Closing this since the endpoint is live

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api API issue feature request planned We're going to fix this pretty soon slash commands synced Synced to internal tracker
Projects
None yet
Development

No branches or pull requests