Skip to content

SteamCommunity

Alex Corn edited this page Dec 3, 2023 · 74 revisions

node-steamcommunity is split into multiple "classes" for simplicity's sake. This page lists all methods and properties available from the root of the module.

You must first instantiate an instance of node-steamcommunity. Example:

const SteamCommunity = require('steamcommunity');
let community = new SteamCommunity();

Properties

request

v2.1.0 or later is required to use this property

The instance of request used by node-steamcommunity. This will contain your login cookies if you've logged in or set cookies. The version of request that node-steamcommunity uses is defined in package.json and may change at any time.

steamID

Contains our SteamID (as a SteamID object) if we're logged in.

Methods

Constructor([options])

  • options - Optional. An object containing zero or more of the following properties:
    • request - An instance of request v2.x.x which will be used by SteamCommunity for its HTTP requests. SteamCommunity will create its own if omitted.
    • timeout - The time in milliseconds that SteamCommunity will wait for HTTP requests to complete. Defaults to 50000 (50 seconds). Overrides any timeout option that was set on the passed-in request object.
    • userAgent - The user-agent value that SteamCommunity will use for its HTTP requests. Defaults to Chrome v47's user-agent. Overrides any headers['User-Agent'] option that was set on the passed-in request object.
    • localAddress - The local IP address that SteamCommunity will use for its HTTP requests. Overrides an localAddress option that was set on the passed-in request object.

v3.17.0 or later is required to use the options argument.

Constructs a new instance of SteamCommunity.

Between v3.5.0 and v3.17.0, the constructor took a single localAddress argument. This is still supported, but is deprecated.

login(details, callback)

  • details - An object containing our login details (see below)
  • callback - A function which will be called once we're logged in
    • err - If an error occurred, this is an Error object. Some common failures:
      • SteamGuard - If your login failed due to Steam Guard, the message property will be SteamGuard and there will be an emaildomain property. Login again and provide the email code as authCode to the details object.
      • SteamGuardMobile - If your login failed due to Steam Guard and the user has app-based authentication enabled, the message property will be SteamGuardMobile. Login again and provide the app code as twoFactorCode to the details object.
    • sessionID - Your session ID value. If you're using an external library, it'll know what to do with this. Otherwise, you can ignore it.
    • cookies - An array containing your cookies. If you're using an external library, you'll need these. Otherwise, you can ignore them.
    • steamguard - (Does not work anymore, see below) If your account is protected by Steam Guard, this is a string which can be passed to login as the steamguard property of details. You should treat it as an opaque string, but currently it's YourSteamID||YourCookieValue. You can pull YourCookieValue from the value of the steamMachineAuthYourSteamID cookie on an authorized browser if you wish.
    • oAuthToken - Always null. Steam no longer issues these tokens.

The structure of details is as follows:

{
    accountName: 'your Steam account name',
    password: 'your Steam password',
    steamguard: 'your Steam Guard value', // only required if logging in with a Steam Guard authorization (does not work anymore, see below)
    authCode: 'your Steam Guard email code', // only required if logging in with a new email auth code
    twoFactorCode: 'your Steam Guard app code', // only required if logging in with a Steam Guard app code
    disableMobile: true // see below
}

Note: During Tuesday maintenance on 2023-10-17, Valve seemingly removed the old login mechanism used by node-steamcommunity. The steam-session module exists to interact with the new login mechanism. As a consequence of this removal, the login() method still reports success but you don't actually get a session cookie.

v3.47.1 updates node-steamcommunity to use steam-session internally for the login() method, but there are a few considerations:

  • steam-session requires Node.js v12.22.0 or later. node-steamcommunity still officially supports Node.js v4.0.0 and later, but you cannot use login() if using Node.js <12.22.0.
  • The architecture of steam-session is incompatible with the request module. Consequently, if you pass a custom request instance to SteamCommunity, you cannot use login().
  • The architecture of steam-session is incompatible with node-steamcommunity's previous Steam Guard handling scheme. Consequently, you will no longer get a steamguard value when using login().

disableMobile

As of v3.44.4, the value of disableMobile is true by default. Previously, it was false by default.

If disableMobile is false, then steamcommunity will log on to Steam as if it were the Steam mobile app, rather than as if it were a web browser. The only significant implication is that logging on as a Steam mobile app will automatically obtain a mobile app access token, which is required to enable or disable 2FA.

You can also use setMobileAppAccessToken() (added in v3.45.0) if you need to enable or disable 2FA.

Read more about how cookies work and interact with other modules.

oAuthLogin(steamguard, oAuthToken, callback)

  • steamguard - The steamguard value from the callback of login
  • oAuthToken - The oAuthToken value from the callback of login
  • callback - Called when the login request completes
    • err - An Error object on failure, or null on success
    • sessionID - Your sessionid value. If an external library prompts for it, you'll need this. Otherwise, you can safely ignore it.
    • cookies - An array containing your cookies. If you're using an external library, you'll need these. Otherwise, you can ignore them.

v3.16.0 or later is required to use this method

Facilitates passwordless login using details received from a previous login request.

THIS METHOD IS DEPRECATED AND NO LONGER FUNCTIONAL, SINCE STEAM NO LONGER ISSUES OAUTH TOKENS.

Read more about how cookies work and interact with other modules.

loggedIn(callback)

  • callback - Called when the result is available. Has three arguments:
    • err - If an error occurred, this is an Error object. Otherwise, null.
    • loggedIn - true if you're currently logged in, false otherwise
    • familyView - true if you're currently in family view, false otherwise. If true, you'll need to call parentalUnlock with the correct PIN before you can do anything.

v2.6.0 or later is required to use this method.

Use this method to check whether or not you're currently logged into Steam and what your Family View status is.

setCookies(cookies)

  • cookies - An array of cookies (as name=value pair strings)

Use this to resume a previous session or to use a session that was negotiated elsewhere (using node-steam-user, for instance).

Read more about how cookies work and interact with other modules.

getSessionID()

Returns the session ID of your current session, or generates a new one if you don't have a session yet. You probably won't need to use this.

In reality, a "session ID" is just a CSRF token. The session ID can be anything, as long as when it's required the session ID you submit in your form matches the session ID in your cookies.

getWebApiKey(callback)

  • callback - A function to be called once the key is obtained
    • err - If an error occurred, this is an Error object. The message property will be Access Denied if you attempt to retrieve an API key on a limited account.
    • key - Your API key on success

v1.0.3 or later required to use this method

Retrieves your account's Web API key, provided that you already have one created. If you haven't created an API key yet, use createWebApiKey().

Note: Prior to v3.48.0, this method also attempted to register an API key. A backend change in Steam broke the route used by this method to register a key (see issue #328). It is also now required to accept a mobile confirmation to create an API key. Use createWebApiKey() to create an API key now. This method still works to retrieve your already-existing API key.

If you use this method without having first created an API key, an error will be returned instead.

createWebApiKey(options, callback)

  • options - An object containing options for this request
    • domain - Required. A string containing a domain name to link with this API key. You can use 'localhost' if you don't have a domain.
    • identitySecret - Optional. If you include your account's identity_secret, then node-steamcommunity will internally take care of accepting the confirmation, and you won't need to make a second call to createWebApiKey().
    • requestID - Optional. A string containing the ID of an outstanding API key creation request. This should be omitted the first time you call createWebApiKey() to create a new session. You probably don't need to worry about this value at all because the full options object is provided for you to send in your finalize request (see below).
  • callback - A function to be called when the request completes
    • err - An Error object on failure, or null on success
    • result - An object containing these properties:
      • confirmationRequired - true if you need to accept a mobile confirmation, or false if not
      • apiKey - If creating your API key has succeeded, this is a string containing your new API key
      • finalizeOptions - If confirmationRequired is true, then this is an object containing the options you should pass to createWebApiKey() after you have accepted your mobile confirmation.

v3.48.0 or later is required to use this method

Creates a new Web API key for your account. Your account must be eligible for an API key, and must have a Steam Guard Mobile Authenticator. If you call this without having a Mobile Authenticator, you will get back error NoMobileDevice.

Usage of this method constitutes agreement to the Steam Web API Terms of Use.

If you call this while already having an API key, then a new API key will be generated, both keys be associated with your account, and both keys will continue working. Revoking the first key on the API key page will invalidate the first, and the second key will then appear on that page. Valve may fix this at any time, so this behavior should not be relied upon.

Creating a Web API key requires accepting a mobile confirmation. The first time you call createWebApiKey(), the result object will look like this:

{
    "confirmationRequired": true,
    "finalizeOptions": {
        "domain": "localhost",
        "requestID": "12345678901234567890"
    }
}

After you get this response, you should accept the mobile confirmation using getConfirmations() and respondToConfirmation(). You can also accept with acceptConfirmationForObject(), using the requestID in finalizeOptions as the object ID. Once you've accepted the confirmation, call createWebApiKey() again, using the returned finalizeOptions for the options parameter. The returned result will then look like this:

{
    "confirmationRequired": false,
    "apiKey": "FF52510D0C788E397D0F87BA5E6B5F39"
}

Alternatively, you can pass your account's identity_secret in options, and node-steamcommunity will accept the confirmation internally. In this case, the returned result will directly include your API key, as above.

getWebApiOauthToken(callback)

  • callback - A function to be called once the token is obtained
    • err - If an error occurred, this is an Error object
    • token - Your oauth token on success

v3.10.0 or later is required to use this method

THIS METHOD IS DEPRECATED AND NO LONGER FUNCTIONAL, SINCE STEAM NO LONGER ISSUES OAUTH TOKENS.

Gets an oauth access token for those WebAPI methods that need one. This only works if you logged in via node-steamcommunity and you didn't disable mobile login. Thus, you should just use the token returned in the callback to login.**

setMobileAppAccessToken(accessToken)

  • accessToken - A string containing your access token

v3.45.0 or later is required to use this method

Use this method to provide a mobile app access token generated with steam-session using EAuthTokenPlatformType.MobileApp. This is only necessary if you intend to use WebAPI methods that require a mobile app access token (presently, only enableTwoFactor(), finalizeTwoFactor(), and disableTwoFactor()).

getClientLogonToken(callback)

  • callback - A function to be called once the token is obtained
    • err - If an error occurred, this is an Error object
    • details - An object containing these properties:
      • steamID - Your account's SteamID, as a SteamID object
      • accountName - Your account's logon name
      • webLogonToken - Your logon token

v3.39.0 or later is required to use this method

Retrieves a token that can be used to log on via node-steam-user. node-steam-user v4.3.0 or later is required to use a web logon token. The details object contains all the properties needed to log onto node-steam-user, so you could just do something like this:

let user = new SteamUser();
community.getClientLogonToken((err, details) => {
    if (err) {
        handleErrorSomehow(err);
    } else {
        user.logOn(details);
    }
});

parentalUnlock(pin[, callback])

  • pin - Your 4-digit Family View PIN
  • callback - An optional callback to be invoked on completion
    • err - If an error occurred, an Error object. null otherwise. If your PIN was wrong, the message property will be Incorrect PIN.

v1.0.4 or later required to use this method

If your account has Family View enabled, calling this will disable it for your current session.

getNotifications(callback)

  • callback - Fired when the requested data is available
    • err - null on success, or an Error object on failure
    • notifications - An object containing properties for each notification type, see below

v1.0.7 or later required to use this method

Gets your account's notifications (the things under the green envelope button on the top-right).

The object's properties are comments, items, invites, gifts, chat, trades, gameTurns, moderatorMessages, helpRequestReplies, accountAlerts. The values of each property are the number of your notifications of that type.

resetItemNotifications([callback])

  • callback - An optional callback to be invoked on completion
    • err - An Error object on failure, null on success

v1.0.7 or later required to use this method

Loads your inventory page, which resets your new items notification to 0.

getTradeURL(callback)

v3.33.0 or later is required to use this method

Gets your account's trade URL, which can be used by people who aren't your friends on Steam to send you trade offers.

changeTradeURL([callback])

v3.34.0 or later is required to use this method

Invalidates your account's existing trade URL and generates a new token, which is returned in the callback.

clearPersonaNameHistory([callback])

  • callback - An optional callback to be invoked on completion
    • err - An Error object on failure, or null on success

v3.40.0 or later is required to use this method

Clears your Steam profile name history (aliases).

getSteamUser(id, callback)

  • id - Either a SteamID object or a user's URL (the part after /id/)
  • callback - Called when the user's data is loaded and ready
    • err - If an error occurred, this is an Error object. null otherwise.
    • user - A CSteamUser instance

Creates and returns a CSteamUser object for a particular user.

getSteamGroup(id, callback)

  • id - Either a SteamID object or a group's URL (the part after /groups/)
  • callback - Called when the group's data is loaded and ready
    • err - If an error occurred, this is an Error object
    • group - A CSteamGroup instance

Creates and returns a CSteamGroup object for a particular group.

getMarketApps(callback)

  • callback - Called when the requested data is available
    • err - null on success, or an Error object on failure
    • apps - An object whose keys are AppIDs and whose values are the names of the apps

v3.4.0 or later is required to use this method

Requests a list of all apps which support the Steam Community Market (this list is scraped from the app buttons on the right side of the market home page).

getMarketItem(appid, hashName, callback)

  • appid - The ID of the app to which this item belongs
  • hashName - The item's market_hash_name
  • callback - Called when the item data is loaded and ready
    • err - If an error occurred, this is an Error object. If the item is not on the market or doesn't exist, the message property will be There are no listings for this item..
    • item - A CMarketItem instance

v2.3.0 or later is required to use this method

Creates and returns a CMarketItem object for a particular item.

marketSearch(options, callback)

  • options - Provide a string to just search for that string, otherwise an object with one or more of the following properties:
    • query - The query string to search for
    • appid - The AppID of the game you're searching for
    • searchDescriptions - true to also search in the descriptions of items (takes longer to search), false or omitted otherwise
  • callback - Called when results are available
    • err - If an error occurred, this will be an Error object. If the item is not on the market or doesn't exist, the message property will be There were no items matching your search. Try again with different keywords.
    • items - An array of CMarketSearchResult instances

v2.5.0 or later is required to use this method

Searches the market for a particular query. If you provide an appid to options, you can also search for tags. Simply add your search tags with the tag's name being the key and the tag's internal value being the value. For example, to search for TF2 decorated weapons, you'd do this:

{
    "appid": 440,
    "Quality": "paintkitweapon"
}

setupProfile([callback])

  • callback - Called when the action is complete
    • err - null on success, or an Error object on failure

v3.3.0 or later is required to use this method.

If your Steam account is new and your profile isn't set up yet, you can call this to create it.

editProfile(settings[, callback])

  • settings - An object containing one or more of the following properties
    • name - Your new profile name
    • realName - Your new profile "real name", or empty string to remove it
    • summary - Your new profile summary
    • country - A country code, like US, or empty string to remove it
    • state - A state code, like FL, or empty string to remove it
    • city - A numeric city code, or empty string to remove it
    • customURL - Your new profile custom URL
    • background - The assetid of an owned profile background which you want to equip, or empty string to remove it
    • featuredBadge - The ID of your new featured badge, or empty string to remove it. Currently game badges aren't supported, only badges whose pages end in /badge/<id>
    • primaryGroup - A SteamID object for your new primary Steam group, or a string which can parse into a SteamID
  • callback - Optional. Called when the request completes.
    • err - An Error object on failure, or null on success

v3.2.0 or later is required to use this method.

Updates one or more parts of your profile.

background, featuredBadge, and primaryGroup don't work at the moment.

profileSettings(settings[, callback])

  • settings - An object containing one or more of the following properties
    • profile - A value from SteamCommunity.PrivacyState for your desired profile privacy state
    • comments - A value from SteamCommunity.PrivacyState for your desired profile comments privacy state
    • inventory - A value from SteamCommunity.PrivacyState for your desired inventory privacy state
    • inventoryGifts - true to keep your Steam gift inventory private, false otherwise
    • gameDetails - A value from SteamCommunity.PrivacyState for your desired privacy level required to view games you own and what game you're currently playing
    • playtime - true to keep your game playtime private, false otherwise
    • friendsList - A value from SteamCommunity.PrivacyState for your desired privacy level required to view your friends list
  • callback - Optional. Called when the request completes.
    • err - An Error object on failure, or null on success

v3.36.0 or later is required to use this method.

Updates one or more parts of your profile settings.

uploadAvatar(image[, format][, callback])

  • image - A Buffer containing the image, a string containing a URL to the image, or a string containing the path to the image on the local disk
  • format - Optional. The format of the image. See below.
  • callback - Optional. Called when the upload is complete or fails.
    • err - An Error object on failure or null on success
    • url - The URL to the new image on Steam's CDN

v3.6.0 or later is required to use this method.

Replaces your current avatar image with a new one. format is required if image is a Buffer, else it will be detected from the Content-Type header (if image is a URL) or the file extension (if image is a local path). If provided, format should be one of jpg (or jpeg), gif, or png. These are the only supported image formats.

The only supported protocols for URLs are http:// and https://. Any other string will be treated as a local path.

postProfileStatus(statusText[, options], callback)

  • statusText - A string containing your new status update's content (can contain BBCode and emoticons)
  • options - Optional. Can be omitted if no options are desired. An object containing zero or more of the following properties:
    • appID - An integer appID if you want this status update to be tagged with a specific game
  • callback - Required. Called when request completes.
    • err - null on success, an Error object on failure
    • postID - The ID of this new post

v3.37.0 or later is required to use this method.

Posts a status update to your profile feed.

deleteProfileStatus(postID[, callback])

  • postID - The ID of the post you want to delete
  • callback - Optional. Called when request completes.
    • err - null on success, an Error object on failure

v3.37.0 or later is required to use this method.

Removes a status update from your profile feed.

getInventoryHistory([options, ]callback)

  • options - Optional. An object containing any or all of the following properties:
    • direction - Either the string past to get trades that occurred further in the past than startTime, or future to get trades that occurred closer to the present than startTime. Has no effect if startTime is not set. Defaults to past.
    • startTime - Either a Unix timestamp or a Date object where you want Steam to start displaying trades (see direction)
    • startTrade - If startTime is set, then start at the trade following the one with this trade ID if it's the first entry (for direction past) or last entry (for direction future)
    • resolveVanityURLs - The inventory history page doesn't give Steam IDs for users who have configured a custom profile URL. If this is specified, then node-steam-inventoryhistory will request the XML profile of each unique trader to get their Steam IDs. Defaults to false.
  • callback - Called when the requested data is available.
    • err - An Error object on failure, or null if success
    • history - An object containing the data on the requested history page:
      • firstTradeTime - If the first entry in the trades array is not your most recently completed trade, then this is a Date object containing the first entry's (more precise) timestamp. Not defined otherwise.
      • firstTradeID - If the first entry in the trades array is not your most recently completed trade, then this is a string containing the trade ID of the first entry. Not defined otherwise.
      • lastTradeTime - If the last entry in the trades array is not your first-ever completed trade, then this is a Date object containing the last entry's (more precise) timestamp. Not defined otherwise.
      • lastTradeID - If the last entry in the trades array is not your first-ever completed trade, then this is a string containing the trade ID of the last entry. Not defined otherwise.
      • trades - An array containing the trades on this page. Regardless of inputs, this array is always sorted with the most-recently-completed trade first, and the completed-longest-ago trade last.
        • onHold - true if this trade is on hold (in escrow), false if not
        • date - A Date object for the date and time when this trade took place.
        • partnerName - The current profile name of the person you traded with.
        • partnerSteamID - A SteamID object for the person you traded with. This will be null if they have a custom URL and you didn't specify resolveVanityURLs.
        • partnerVanityURL - The custom profile URL of the person you traded with, if it exists. null if they don't have one.
        • itemsReceived - An array of CEconItem items you received.
        • itemsGiven - An array of CEconItem items you lost.

v3.24.0 or later is required to use this method. It was added in v3.9.0 but broken by a Steam backend change until v3.24.0.

Gets a page of trades from your inventory history. This was originally provided by node-steam-inventoryhistory (now deprecated and non-functional). There are 30 items per page.

This is deprecated and will be removed in the near future. Use the GetTradeHistory WebAPI method instead.

As of August 16, 2016, inventory history no longer uses page numbers and instead uses a "cursor" style of pagination. Here's a (high-level overview) how it works:

If you don't provide a startTime, then Steam will insert the cursor into the timeline at the present time and read backwards (into the past) for 30 entries.

If you provide a startTime, omit startTrade, and omit direction or provide past for direction, then Steam will insert the cursor into the timeline after (closer to the present) the most-recently-completed trade which completed at the provided timestamp, and read backwards (into the past) for 30 entries.

If you provide a startTime and a startTrade, and you omit direction or provide past for direction, then Steam will first (internally) pull a list of all your trades that completed at that timestamp. It will then read that list backwards (into the past) until it finds the trade with the provided ID, and then discard that list. If found, it will insert the cursor into the timeline before (further into the past) the matched trade and read backwards (into the past) for 30 entries. If the trade is not found in the small list, then behavior is identical to if startTrade was ommitted.

If you provide a startTime, omit startTrade, and provide future for direction, then Steam will insert the cursor into the timeline before (further into the past) the first-completed trade which completed at the provided timestamp, and read forwards (closer to the present) for 30 entries.

If you provide a startTime and a startTrade, and you provide future for direction, then Steam will first (internally) pull a list of all your trades that completed at that timestamp. It will then read that list forwards (toward the present) until it finds the trade with the provided ID, and then discard that list. If found, it will insert the cursor into the timeline after (closer to the present) the matched trade and read forwards (closer to the present) for 30 entries. If the trade is not found in the small list, then behavior is identical to if startTrade was omitted.

enableTwoFactor(callback)

  • callback - Called when the request completes
    • err - An Error object on failure, or null on success
    • response - The entire response from Steam

v3.11.0 or later is required to use this method

Starts the process to turn on TOTP for your account.

If you have a phone number linked with your account, then you'll be sent an SMS with an activation code. Otherwise, you'll receive the activation code by email. You'll need to provide the activation code to finalizeTwoFactor.

You should save the entire response object somewhere secure. You can use JSON.stringify on it safely.

Properties of note in the response object:

  • status - A value from EResult. If this is not OK (1), then the request failed.
  • shared_secret - This is your secret that's used for two-factor authentication.
  • identity_secret - This is your secret that's used for confirming trades.
  • revocation_code - You will need this in the future to disable two-factor authentication.

IMPORTANT NOTE: Before using this method, you need a valid mobile app access token set on your SteamCommunity object. You can do this by calling setMobileAppAccessToken(). If you're using SteamCommunity's login method without passing true for disableMobile, then you already have a mobile app access token available and set on your SteamCommunity object.

finalizeTwoFactor(sharedSecret, activationCode, callback)

  • sharedSecret - shared_secret that you received in enableTwoFactor response
  • activationCode - The activation code you received in your SMS
  • callback - Called when the request completes
    • err - An Error object on failure, or null on success

v3.11.0 or later is required to use this method

Finishes the process of enabling TOTP two-factor authentication for your account. You can use steam-totp in the future when logging on to get a code.

If TOTP two-factor authentication is enabled, a code will be required on every login.

IMPORTANT NOTE: Before using this method, you need a valid mobile app access token set on your SteamCommunity object. You can do this by calling setMobileAppAccessToken(). If you're using SteamCommunity's login method without passing true for disableMobile, then you already have a mobile app access token available and set on your SteamCommunity object.

disableTwoFactor(revocationCode, callback)

  • revocationCode - Your two-factor revocation code, which has the format Rxxxxx, where x is a number
  • callback - Called when the request completes
    • err - An Error object on failure, or null on success. In some failures, there may be an eresult property defined.

v3.10.0 or later is required to use this method

Disables two-factor authentication on your account given a revocation code. Unlike the revocation procedure on the support site, this will not invalidate all your account's outstanding Steam Guard authorizations.

IMPORTANT NOTE: Before using this method, you need a valid mobile app access token set on your SteamCommunity object. You can do this by calling setMobileAppAccessToken(). If you're using SteamCommunity's login method without passing true for disableMobile, then you already have a mobile app access token available and set on your SteamCommunity object.

getConfirmations(time, key, callback)

  • time - The Unix timestamp with which the following key was generated
  • key - The confirmation key that was generated using the preceeding time and the tag "conf" (this key can be reused). You can use steam-totp to generate this.
  • callback - Called when the request completes
    • err - An Error object on failure, or null on success
    • confirmations - An array of CConfirmation objects

v3.12.1 or later is required to use this method

Get your account's outstanding confirmations. Only works if you're using two-factor authentication.

getConfirmationOfferID(confID, time, key, callback)

  • confID - The confirmation's ID
  • time
  • key
  • callback

v3.12.1 or later is required to use this method

Procedural-style version of CConfirmation#getOfferID

respondToConfirmation(confID, confKey, time, key, accept, callback)

  • confID - The confirmation's ID
  • confKey - The confirmation's key
  • time
  • key
  • accept
  • callback

v3.12.1 or later is required to use this method

Procedural-style version of CConfirmation#respond

As of v3.23.0, you can supply arrays to confID and confKey to act on multiple confirmations at once. The arrays should be of the confirmation IDs and confirmation keys you want to act on, in order. For example, if you have two confirmations whose id/key pairs are 12345/55555555 and 12346/56565656, then your input would be:

community.respondToConfirmation([12345, 12346], ["55555555", "56565656"], time, key, accept, callback);

Note that multi-action works on all confirmation types, including trade sending and trade acceptance. However, because it can take a long time to confirm a trade offer acceptance, you may experience timeouts when multi-acting on many of those confirmations. It might be better for you to just confirm trade acceptances one by one. Multi-confirming offer sending shouldn't be an issue.

acceptConfirmationForObject(identitySecret, objectID, callback)

  • identitySecret - Your account's identity_secret, as base64, hex, or a Buffer
  • objectID - The ID of the thing you want to confirm (either a trade offer ID or a market listing ID)
  • callback - Called when the task completes
    • err - An Error object on failure, or null on success

v3.27.0 or later is required to use this method

This is a convenience method that simply accepts a confirmation for a given object. Under the hood, it grabs the list of confirmations, picks out the correct one, and then accepts it. It tries to avoid re-using the same timestamp for confirmation as a previous call to this method so it should be safe to call this method twice in the same second, assuming Steam doesn't rate-limit the requests to the confirmation list page.

It's recommended that you use this as needed over the automatic confirmation checker so you aren't sending unnecessary requests to Steam, and getting yourself rate-limited.

acceptAllConfirmations(time, confKey, allowKey, callback)

  • time - Should be a unix timestamp
  • confKey - Should be a base64-encoded key for the "conf" tag, generated using the supplied time
  • allowKey - Should be a base64-encoded key for the "allow" tag, generated using the supplied time
  • callback - Called when the request completes
    • err - An Error object on failure, or null on success
    • confs - An array of the confirmations that were just accepted. May be empty if there were no pending confirmations.

v2.23.0 or later is required to use this method

Accept all outstanding confirmations on your account all at once.

getGemValue(appid, assetid, callback)

  • appid - The AppID of the game to which the item in question belongs
  • assetid - The AssetID of the item in question
  • callback - A function to be called when the requested data is available
    • err - An Error object on failure, or null on success
    • res - An object containing these properties:
      • promptTitle - A string containing the title which goes in the prompt shown in the Steam UI, e.g. "Turn into gems?"
      • gemValue - How many gems you'd get if you gemified this item

v3.35.0 or later is required to use this method

Use this method to see how many gems you'd get if you gemified a Steam Community item. Note that the AppID you need to provide is the AppID of the game to which the item belongs, not 753 (which is the AppID to which Steam Community items actually belong).

turnItemIntoGems(appid, assetid, expectedGemsValue, callback)

  • appid - The AppID of the game to which the item in question belongs
  • assetid - The AssetID of the item in question
  • expectedGemsValue - How many gems you should get for this item (from getGemValue)
  • callback - A function to be called when the request completes
    • err - An Error object on failure, or null on success
    • res - An object containing these properties:
      • gemsReceived - How many gems you got for this item
      • totalGems - How many gems you have now

v3.35.0 or later is required to use this method

Gemify a Steam Community item.

packGemSacks(assetid, desiredSackCount, callback)

  • assetid - ID of gem stack you want to pack into sacks
  • desiredSackCount - How many sacks you want. You must have at least this amount * 1000 gems in the stack you're packing
  • callback - A function to be called when the request completes
    • err - An Error object on failure, or null on success

v3.42.0 or later is required to use this method

Packs some gems into sacks. If you have multiple gem stacks in your inventory, this can only be used to pack one stack at a time. If you have multiple sack stacks in your inventory, there is no way to specify which stack the newly-acquired stacks should be added to.

unpackGemSacks(assetid, sacksToUnpack, callback)

  • assetid - ID of sack stack you want to unpack (say that 5 times fast)
  • sacksToUnpack - How many sacks in the stack you want to unpack
  • callback - A function to be called when the request completes
    • err - An Error object on failure, or null on success

v3.42.0 or later is required to use this method

Unpacks some sacks of gems. You will receive 1000 gems for eaach sack you unpack. If you have multiple gem stacks in your inventory, there is no way to specify which stack newly-acquired gems should be added to.

openBoosterPack(appid, assetid, callback)

  • appid - The AppID of the game to which the booster pack in question belongs
  • assetid - The AssetID of the booster pack in question
  • callback - A function to be called when the request completes
    • err - An Error object on failure or null on success
    • items - An array containing information on the opened cardsAn array containing information on the opened cards

v3.41.5 or later is required to use this method

Unpacks a booster pack in your inventory. The format of the items array is documented in pull request #250.

getBoosterPackCatalog(callback)

  • callback - A function to be called when the requested data is available
    • err - An Error object on failure, or null on success
    • res - An object containing these properties:
      • totalGems - How many gems you have in total
      • tradableGems How many of your gems are tradable
      • untradableGems - How many of your gems are untradable
      • catalog - An object where keys are appids and values are objects with this structure:
        • appid
        • name - Name of the app
        • series - Card series (always 1)
        • price - Price of a booster pack in gems
        • unavailable - true if you cannot currently create this booster pack
        • availableAtTime - A Date property indicating when this pack becomes available to you, or null if not applicable

v3.44.0 or later is required to use this method

Retrieves the catalog of which booster packs are available to you to create using createBoosterPack. You can only create one booster pack for each app you own daily.

createBoosterPack(appid, useUntradableGems, callback)

  • appid - The app you want to create a booster pack for
  • useUntradableGems - Pass true if you want to use your untradable gems and create an untradable pack (default false)
  • callback - A function to be called when the request completes
    • err - An Error object on failure, or null on success
    • res - An object containing these properties:
      • totalGems - How many gems you have now after creating this pack
      • tradableGems - How many of your gems are tradable
      • untradableGems - How many of your gems are untradable
      • resultItem - An object with this structure:
        • communityitemid - The ID of the new item in your Steam Community inventory (appid 753 contextid 6)
        • appid - The appid of the game to which this booster pack belongs
        • item_type
        • purchaseid
        • success
        • rwgrsn

v3.44.0 or later is required to use this method

Creates a booster pack by spending gems from your inventory. You can only create one booster pack for each game you own per day. If you try to create a second booster pack for a game within a day, you will get back error 84 (RateLimitExceeded).

If you pass true for useUntradableGems, then Steam will preferentially spend your untradable gems. If you don't have enough untradable gems to create the desired pack, then Steam will take however many extra gems are needed from your tradable balance. If any untradable gems are used to create a pack, then the resulting pack will inherit the most restrictive trading restriction from the spent gems.

You can pass true to useUntradableGems even if you don't have any untradable gems. In this case, Steam will simply spend from your tradable gems and the resulting pack will be tradable. If you pass false or omit this parameter, then Steam will only spend from your tradable gems and will fail with error 78 (ValueOutOfRange) if you don't have enough tradable gems to pay for this pack.

getGiftDetails(giftID, callback)

  • giftID - A string containing the assetid of the gift in your inventory
  • callback - A function to be called when the requested data is available
    • err - An Error object on failure, or null on success
    • res - An object containing these properties:
      • giftName - The name of this gift
      • packageID - The ID of the Steam package that you'll be granted if you redeem this gift
      • owned - A bool indicating whether your account already owns this package (if true, you can't redeem it because you own it already)

v3.35.0 or later is required to use this method

Get details about a gift in your Steam Gifts inventory.

redeemGift(giftID, callback)

  • giftID - A string containing the assetid of the gift in your inventory
  • callback - A function to be called when the request completes
    • err - An Error object on failure, or null on success

v3.35.0 or later is required to use this method

Redeem a gift in your Steam Gifts inventory and add it to your library.

removePackage(packageID, callback)

  • packageID - The ID of the package you want to remove from your library
  • callback - Called when the request completes
    • err - An Error object on failure, or null on success

v3.43.0 or later is required to use this method

Removes a license from your account. The help site claims this is "permanent", but it can be undone via a call to restorePackage.

restorePackage(packageID, callback)

  • packageID - The ID of the package you want to restore to your library
  • callback - Called when the request completes
    • err - An Error object on failure, or null on success

v3.43.0 or later is required to use this method

Restores a previously removed license (via removePackage) to your account.

getFriendsList(callback)

  • callback - A function to be called when the request completes
    • err - An Error object on failure, or null on success
    • users - An object whose keys are 64-bit SteamIDs, and values are EFriendRelationship values

v3.43.0 or later is required to use this method

Retrieves a list of your friend relationships. Includes friends, invited friends, users who invited us to be friends, and blocked users.

You shouldn't compare values with numbers directly. You can access EFriendRelationship like so:

const SteamCommunity = require('steamcommunity');
const EFriendRelationship = SteamCommunity.EFriendRelationship;

getSteamSharedFile(sharedFileId, callback)

  • sharedFileId - The ID of a shared file you want to retrieve
  • callback - A function to be called when the request completes
    • err - An Error object on failure, or null on success
    • sharedFile - A CSteamSharedFile object on success

v3.46.0 or later is required to use this method

Retrieves details about a shared file (artwork/screenshot/guide), given the shared file's ID.

followCurator(curatorId[, callback])

  • curatorId - ID of the curator you want to follow (this is not a SteamID)
  • callback - Optional.
    • err - null on success, or an Error object on failure

v3.47.0 or later is required to use this method

Adds a Steam curator to your followed list.

unfollowCurator(curatorId[, callback])

  • curatorId - ID of the curator you want to unfollow (this is not a SteamID)
  • callback - Optional.
    • err - null on success, or an Error object on failure

v3.47.0 or later is required to use this method

Removes a Steam curator from your followed list.

Events

sessionExpired

  • err - An Error object

v3.19.0 or later is required to use this event

Emitted when an HTTP request is made which requires a login, and Steam redirects us to the login page (i.e. we aren't logged in). You should re-login when you get this event.

Note that this will be emitted continuously until you log back in. This event being emitted doesn't stop the module from attempting further requests (as a result of method calls, timers, etc) so you should ensure that you limit your logins.

Clone this wiki locally