Can nightbot post to an express api?

I have a simple node js express route that will fetch osrs high scores.
The expectation is that users will type in “!stats zezima” and it will post zezima to my api route, then return the stats for zezima. When I curl my API I get the expected response.

curl -X POST -H “Content-Type: application/json” -d ‘{“rsUsername”: “zezima”}’ http://myapi:8088/fetch-rs-stats

Stats for zezima: overall: 1,465 ~ attack: 76 ~ defence: 76 ~ strength: 75 ~ hitpoints: 75 ~ prayer: 52 ~ cooking: 80 ~ woodcutting: 78 ~ fletching: 74 ~ fishing: 77 ~ firemaking: 99 ~ crafting: 55 ~ smithing: 55 ~ mining: 63 ~ herblore: 52 ~ agility: 70 ~ thieving: 53 ~ slayer: 71 ~ farming: 45 ~ runecraft: 44 ~ hunter: 45 ~ construction: 45

Nightbot command:

$(urlfetch http://myapi.com:8088/fetch-rs-stats?rsUsername=$(1))

Nightbot keeps chatting Remote Server Returned Code 404

My API isnt blocking any traffic. All source IP and port are allowed.

Hey @testingthewaters!

Nightbot has the $(urlfetch) variable to call external API, but it only sends GET requests.

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