This package includes many functions to use along with the Steam API. It is a work in progress and will be updated over time. Currently it includes some basic and advanced functions to fetch data about users.
Install from npm using the following command:
npm install steam-api-sdk
or if you are using yarn:
yarn add steam-api-sdk
First add an environment variable to your .env file with the name STEAM_API_KEY
and the value of your Steam API key.
You can get your Steam API key from here.
.env
example:
STEAM_API_KEY = 'web-api-key';
Import config from the package and pass your Steam API key as a parameter to the config function.
import { config } from 'steam-api-sdk' // or const steam = require -> steam.config
config.apiKey = 'web-api-key'
Then import the package into your project:
const steam = require('steam-api-sdk')
Or if you are using ES6:
import steam from 'steam-api-sdk'
import { From32To64 } from 'steam-api-sdk'
const steam64 = From32To64([U:1:XXX]) // 7656119XXX
import { From64To32 } from 'steam-api-sdk'
const steam32 = From64To32('7656119XXX') // [U:1:XXX]
import { From64ToSteamID } from 'steam-api-sdk'
const steamIds = From64ToSteamID('7656119XXX')
// Array of: [STEAM_0:0:XXX, STEAM_0:1:XXX]
import { From64ToUser } from 'steam-api-sdk'
const user = From64ToUser('7656119XXX')
// User Object
const user = From64ToUser(['7656119XXX', '7656119XXX', '7656119XXX'])
// User Object Array
Please note that you can use string OR array of strings that contains the user's Steam64 id.
you should use that if you want to get multiple users at once without getting rate limited by Steam and also reduce the response time!
(instead of sending 50 requests for 50 users, it will send 1 request for 50 users = 50x faster)
import { GetSteamUser } from 'steam-api-sdk'
const user = GetSteamUser('https://steamcommunity.com/id/NXTShiNxz/')
// profile url -> User Object
const user = GetSteamUser('http://steamcommunity.com/profiles/76561198998419941')
// profile url (2) -> User Object
const user = GetSteamUser('STEAM_0:0:454468949')
// profile url (2) -> User Object
const user = GetSteamUser('76561198869203626')
// profile url (2) -> User Object
import { SteamIDToSteam64 } from 'steam-api-sdk'
const steam64 = SteamIDToSteam64('STEAM_0:0:454468949')
// 76561198869203626
Convert Steam Profile URL to steam64 ID (https://steamcommunity.com/id/XXX/ ➜ 76561198869203626)
import { VanityUrlTo64 } from 'steam-api-sdk'
const steam64 = VanityUrlTo64('https://steamcommunity.com/id/XXX/')
// 76561198869203626
If you want to contribute to this package, please feel free to do so by opening a pull request with your changes.
Currently this package is in development and will be updated over time.
We are looking for contributors to help us improve this package by adding new functions and improving the existing ones.
If you have any questions or suggestions, please open an issue and I will get back to you as soon as possible.