• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

EN [Solved] How to perform a web API event call to a script?

cakemasher

Well-Known Member
Contributor
Hey,

Currently I'm using Sinusbot 0.13.37-9791176 and I'm trying to perform a API call from the 'enableWeb' web interface. Gathering information like the instances on the bot is not a problem, neither is the authentication header.

I couldn't find anything about sending an event on the API page.

What is the URL to send an event to the script from the webpage? I've tried:
Code:
/api/v1/bot/i/:instanceId/event/:eventName
but this gives me a 404 error. Changing 'event' to 'scriptEvent' for example, gives me the HTML of the Sinusbot web interface.

Thanks in advance!

Kind regards,
Cakemasher


Edit / Solution:
Turned out I was performing a GET request instead of a POST request (Doink!).
 
Last edited:

cakemasher

Well-Known Member
Contributor
FYI:
There's also a public endpoint available at /api/v1/b/<botID>/i/<instanceID>/event/<ev> which triggers events you can listen to with event.on('public:<ev>'...)

Thanks, didn't knew that! Maybe it should be added to the API page(s) eventually to prevent future questions of this matter.
 
Top