Brainstorming About Webhooks
Quite unintentionally.
Okay, I may be at one of the more challenging points in this process to get my bot to respond to webhook data. But before I get to that, I managed to figure out the permissions issue I was having in working through the role assignment function. Turns out, the bot can only do work on members with a lower role in the hierarchy than itself. Easy enough fix. I bumped up its permissions, et voila! My bot can assign roles to other members on the server.
This brings me to dealing with webhooks. The concept is simple enough: an action on the source site triggers a webhook to send data to the bot, which then does whatever it needs to do based on the information it is given. The challenging part is where to send the data. I run the code from my IDE, play.js, on my iPad, and am able to launch and operate the bot from this source. I can run the bot from my server …
I think I just recognized a roundabout way to work with this. I can run the bot from my server, have the webhooks delivery URL pointed there, and run my IDE next to it to make edits as necessary. The pain-in-the-ass part will be having to commit and push changes every single time I make an edit to test. This may work as a short-term solution, but I’m going to have to figure out something better when my commands based on webhook data get more involved.
Quite a lot to consider. If I can figure this out early on, as in NOW, that may save me a major headache when troubleshooting further down the road.
Essentially, I need to figure out a way to locally capture webhook data. This is going to be interesting, as I know very little, if anything, about sending and capturing data in this manner. In the bot tutorial, postman is brought up as a means to test webhook data. I signed up for a free account, but have no idea how to use it as of now.
Speaking of tools I need to learn how to use, I just thought of something. What if I sent the webhook data to my cloud-hosted Mongo database? Since I can access that through my IDE locally, I wonder if I can store the data on the database, and then have my bot read or retrieve the information and then do what it’s programmed to do based on that. This may be well worth pursuing for a number of reasons, the primary of which is: DATA.
Well, this turned into a fruitful brainstorming session. Now I have a legitimate reason to get into the database docs.
84/100