Creating A Cryptocurrency Price Command for Nightbot

Hello, I am trying to get Nightbot to display our cryptocurrency MN Coin’s price and I keep getting an unexpected identifier message.

This is the api for our crypto price: https://open-api.dextools.io/free/v2/token/bsc/0xe34B5DF7EabacAdf00cFB005dd707CC64cD01856/price

it displays on the fourth line.

Hope you can help

1 Like

Can you post the command message you’re using?

I’m not a programmer so I copied this one from another forum post I saw.

$(eval 1/$(urlfetch json )).display.4

with the api link in the middle. I can’t post links

Hey @MNcoin!

Can you share the response you get from the API? I get a forbidden response.

This isn’t the proper way to reach the data, you need to stay inside the $(eval) and when you have an array containing the data, this isn’t how you reach the 4th item, an array starts at 0.
This would be closer to what you’re looking for:

$(eval $(urlfetch json API_LINK).display[3])

Unexpected identifier ‘Connecting’ [:1:9].display.4

This is what it displays for the code snippet you provided: Unexpected identifier ‘Server’ [:1:8]

I also get a forbiden response if I call it outside of dextools api creator: go to dextool api creator

Use: bsc

token address: 0xe34B5DF7EabacAdf00cFB005dd707CC64cD01856

i’m guessing here, but based on the language, it sounds like maybe that api isn’t a finished product, like it’s still in some sort of testing phase or something (since it can only be reached within “dextool api creator”)… my best guess is to look for some kinda option to make the api “go live” or whatever terminology they use

This still doesn’t help, we can’t get the output of the API when we open the link in the browser or fetch it with Postman, please provide with an example of what the API’s output look like, either a screenshot, or preferably text (copy/paste), it can even be mock-up data, as long as the keys are representative of the response.
Btw, if we can’t get the data now, I doubt Nightbot can as well, therefore I don’t think the command can work, at least until the API responds with data.

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