discord-interactions-js
discord-interactions-js copied to clipboard
Use case
Can someone explain me what would be the potential use case of this package? I'm new to this repo and wanted to use this package 🗡️
Thanks
The library's use is for validating the request signatures of payloads sent to your interaction endpoint url, when receiving interactions via an outgoing web-hook. See more here. Request signatures are composed of multiple data(s) together, and they're a type of HTTP request header sent.
This won't affect your app's functionality when using slash commands or components, but it's just so you could:
- Secure your endpoint from invalid requests,
- Have an easier time when handling interaction payloads, this would be true since:
- Discord regularly sends HTTP POSTs to your server to make sure it can handle requests - both invalid and valid, as stated in the docs, and,
- Discord's API sends a "dummy" POST request to your server upon enlisting the url in your app's home page, and,
- This is an easier way of implementing them.
If you want to know how to use this library, you may always see the examples folder, or browse the source files. The official Discord API docs are helpful:
- https://discord.com/developers/docs/interactions/slash-commands
- https://discord.com/developers/docs/interactions/message-components
TL;DR: this library provides middleware that are helpful when making an HTTP-based server for your app that receives interactions over an outgoing webhook.
Thank @J-Human For all the references and explanation.
Thank @J-Human For all the references and explanation.
Your welcome. 👍