API query via script

I would like to use a chat command to let the chatbot query the Valorant API to output my current rank.

Unfortunately I don’t know how to write the script to do this. :frowning:

Here are the instructions how to query the API:

How to get Valorant API’s output
This is the Valorant API link: https://api.kyroskoh.xyz/valorant/v1/mmr/REGION/NAME/TAG

Replace REGION, NAME, and TAG with your information

REGION - EU, AP, NA, KR

NAME/TAG = Your ingame name, e.g. Blue#Strim will be Blue/Strim

With your modified link, there are a few outputs you can have. Some common ones would be;

Rank only (“Diamond 1.”) $(urlfetch https://api.kyroskoh.xyz/valorant/v1/mmr/region/name/tag?show=rankonly&display=0)

Rank and RR (“Diamond 1 - 78 RR.”) $(urlfetch https://api.kyroskoh.xyz/valorant/v1/mmr/region/name/tag?show=combo&display=0)

Name and Rank + RR (“Name#Tag (EU Region): Diamond 1 - 78 RR.”) $(urlfetch https://api.kyroskoh.xyz/valorant/v1/mmr/region/name/tag?show=combo&display=1)

Copy and paste the code into the Response box. Much more explained in this link (credit goes to u/Passage-Special) [Custom API] Valorant MMR Rank API v1 - Custom APIs - NightDev Community Forums

You can use this plugin as basic template for your command

You need to set your correct region and user in settings. Then on !valorank command it should return something like My current Valorant rank is Platinum 1 - 17RR

eyJkcmF3ZmxvdyI6eyJIb21lIjp7ImRhdGEiOnsiMSI6eyJpZCI6MSwibmFtZSI6Imxpc3RlbmVyIiwiZGF0YSI6eyJ2YWx1ZSI6InR3aXRjaENvbW1hbmQiLCJkYXRhIjoie1wiY29tbWFuZFwiOlwie3NldHRpbmdzLmNvbW1hbmR9XCIsXCJwYXJhbWV0ZXJzXCI6W119In0sImNsYXNzIjoibGlzdGVuZXIiLCJodG1sIjoibGlzdGVuZXIiLCJ0eXBlbm9kZSI6InZ1ZSIsImlucHV0cyI6e30sIm91dHB1dHMiOnsib3V0cHV0XzEiOnsiY29ubmVjdGlvbnMiOlt7Im5vZGUiOiI2Iiwib3V0cHV0IjoiaW5wdXRfMSJ9XX19LCJwb3NfeCI6NDY4LCJwb3NfeSI6NjR9LCI2Ijp7Imlk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zY3JpcHRpb24iOiIiLCJ0eXBlIjoic3RyaW5nIn1d
1 Like

Thank you very much, the solution with the plugins is really cool.
Now I know how to build it to query an API and I can rewrite it to other APIs :smiley:

I extended it with axios support, so you should be able to use it like this

eyJkcmF3ZmxvdyI6eyJIb21lIjp7ImRhdGEiOnsiMSI6eyJpZCI6MSwibmFtZSI6Imxpc3RlbmVyIiwiZGF0YSI6eyJ2YWx1ZSI6InR3aXRjaENvbW1hbmQiLCJkYXRhIjoie1wiY29tbWFuZFwiOlwie3NldHRpbmdzLmNvbW1hbmR9XCIsXCJwYXJhbWV0ZXJzXCI6W119In0sImNsYXNzIjoibGlzdGVuZXIiLCJodG1sIjoibGlzdGVuZXIiLCJ0eXBlbm9kZSI6InZ1ZSIsImlucHV0cyI6e30sIm91dHB1dHMiOnsib3V0cHV0XzEiOnsiY29ubmVjdGlvbnMiOlt7Im5vZGUiOiI2Iiwib3V0cHV0IjoiaW5wdXRfMSJ9XX19LCJwb3NfeCI6NDY4LCJwb3NfeSI6NjR9LCI2Ijp7ImlkIjo2LCJuYW1lIjoicnVuU2NyaXB0IiwiZGF0YSI6eyJ2YWx1ZSI6ImNvbnN0IFsgdXNlcm5hbWUsIHRhZyBdID0gc2V0dGluZ3MudXNlci5zcGxpdCgnIycpO1xuXG5jb25zdCByZXNwb25zZSA9IGF3YWl0IGF4aW9zKGBodHRwczovL2FwaS5reXJvc2tvaC54eXovdmFsb3JhbnQvdjEvbW1yLyR7c2V0dGluZ3MucmVnaW9ufS8ke3VzZXJuYW1lfS8ke3RhZ31gKTtcbnR3aXRjaC5zZW5kTWVzc2FnZShgJHNlbmRlciwgbcWvaiBzb3XEjWFzbsO9IFZhbG9yYW50IHJhbmsgamUgJHtyZXNwb25zZS5kYXRhfSFgKSIsImRhdGEiOiJ7fSJ9LCJjbGFzcyI6InJ1blNjcmlwdCIsImh0bWwiOiJydW5TY3JpcHQiLCJ0eXBlbm9kZSI6InZ1ZSIsImlucHV0cyI6eyJpbnB1dF8xIjp7ImNvbm5lY3Rpb25zIjpbeyJub2RlIjoiMSIsImlucHV0Ijoib3V0cHV0XzEifV19fSwib3V0cHV0cyI6eyJvdXRwdXRfMSI6eyJjb25uZWN0aW9ucyI6W119LCJvdXRwdXRfMiI6eyJjb25uZWN0aW9ucyI6W119fSwicG9zX3giOjkwNCwicG9zX3kiOjU1fX19fX0=%W3sibmFtZSI6ImNvbW1hbmQiLCJjdXJyZW50VmFsdWUiOiIhdmFsb3JhbmsiLCJkZWZhdWx0VmFsdWUiOiIhdmFsb3JhbmsiLCJkZXNjcmlwdGlvbiI6IkNvbW1hbmQgdG8gdHJpZ2dlciBwbHVnaW4iLCJ0eXBlIjoic3RyaW5nIn0seyJuYW1lIjoicmVnaW9uIiwiY3VycmVudFZhbHVlIjoiRVUiLCJkZWZhdWx0VmFsdWUiOiJFVSIsImRlc2NyaXB0aW9uIjoiRVUsIEFQLCBOQSBvciBLUiIsInR5cGUiOiJzdHJpbmcifSx7Im5hbWUiOiJ1c2VyIiwiY3VycmVudFZhbHVlIjoic29nZSM2MjA2IiwiZGVmYXVsdFZhbHVlIjoidXNlcm5hbWUjdGFnIiwiZGVzY3JpcHRpb24iOiIiLCJ0eXBlIjoic3RyaW5nIn1d

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