Getting "404 Not Found" from twitch-cli

Hi,

I’m testing twitch-cli and would like to make an announcement to my channel.
I’ve configured client id + secret and set my user token to include the “moderator:manage:announcements” scope.

This is the command I use:

twitch api post chat/announcements -q broadcaster_id=108902201 -q moderator_id=108902201 -b '{message: "hello"}'

At first it was just giving me a “404 Nout Found” error. After adding an -v for verbose output, I can actually see what’s wrong:

> POST /helix/chat/announcements/hello%7D%27?broadcaster_id=108902201&moderator_id=108902201

Yeah well this doesn’t look right. It seems like I’m not using the -b switch correctly but I don’t understand what I’m doing wrong here.

Also, would you be able to give me an example what the command has to look like if I’m using a .json file on my pc rather than raw data (let’s say “C:\test.json”)?

On windows I suspect the issue is down to using ’ instead of "
So windows is doing a odd with it perhaps.

However your -b payload is also invalid JSOn

should be:

twitch api post chat/announcements -q broadcaster_id=108902201 -q moderator_id=108902201 -b '{"message":"hello"}'

For a valid JSON payload.

But on windows

twitch api post chat/announcements -q broadcaster_id=108902201 -q moderator_id=108902201 -b "{\"message\":\"hello\"}"

perhaps. (I don’t have the CLI setup on my windows machine to spot test this

-b @test.json instead

Running the cli from the same folder as test.json is located

1 Like

Holy moly, this is the solution. I would have never suspected this having something to do with being on windows.

I have googled the hell out of this and other problems in the past few days and everytime I land on the twitch dev forums it’s YOU under almost every topic. Absolute madman. Cannot believe this high-quality-response only took you a few minutes, I almost didn’t realize someone responded already.

Greatly appreciated, thank you!!!

Glad to here it was a simple one.

Windows can be hella weird with things

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