Making the thank the follower for following

As the topic says, i cant make it work.

Im using this script in JS in streamlabs:

$.ajax({
url: “https://api.nightbot.tv/1/channel/send”,
method: “POST”,
headers: {
“Authorization”:“Bearer “””,
},
data: “message={name} is now following!”
});

And inside “” next to bearer i should have my nightbot token but i cant seem to find it. I tried with client secret and client id but doesnt work.

Can someone help me before i go crazy?

Thanks in advance.

Hey @prevgoat!

Remove the extra quotes ", according to the documentation, and usual API workflow, it should be:
"Authorization": "Bearer ACCESS_TOKEN"

You need to generate the ACCESS TOKEN with your CLIENT_SECRET and CLIENT_ID.
If it’s unclear, I have a guide where I explain how to get the ACCESS_TOKEN, even though it’s for another use of the API, it may help.

I seriously recommend reading through the entire OAuth 2 section of the API documentation.


The code you provided here uses JQuery, I don’t know if Streamlabs supports it, I doubt it. Have you tried generating that code with an AI? I recommend against it, the AI aren’t aware of the context your code will be used in, therefore it won’t work most of the time.


By the way, this should interest you:

Okey thanks alot, will try it out!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.