Skip to main content
The Embedded App SDK handles making RPC calls between your application and Discord. It is designed to assist developers in developing interactive Activities like games. To learn more about building Activities, check out our Building an Activity tutorial or explore our Sample Projects.

Install the SDK

The Embedded App SDK is available via npm and GitHub. In your frontend JavaScript project directory, install using your package manager of choice.
After installing, you can import and instantiate the SDK in your project.

SDK Methods

ready()

Resolves when your app has successfully connected to the Discord client.

Supported Platforms

Required Scopes

No scopes required

Signature

SDK Usage


subscribe()

Used to subscribe to a specific event from the list of SDK Events.

Supported Platforms

Required Scopes

Depends on the event. Refer to the Required Scopes for the specific event you are subscribing to.

Signature

Usage


unsubscribe()

Used to unsubscribe to SDK Events that your app has already subscribed to.

Supported Platforms

Required Scopes

No scopes required

Signature

The EventPayloadData will vary based on the event you are unsubscribing from. See the specific event for details.

Usage


close()

Used to close your app with a specified code and reason.

Supported Platforms

Required Scopes

No scopes required

Signature

SDK Usage


SDK Commands

Developers can use these commands to interact with the Discord client. The following SDK commands are prefixed with .commands, such as, discordSDK.commands.authenticate.

authenticate()

Authenticate an existing client with your app.

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


authorize()

Authorize a new client with your app.

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


captureLog()

Forward logs to your own logger.

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


encourageHardwareAcceleration()

Presents a modal dialog to allow enabling of hardware acceleration.

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


getChannel()

Returns information about the channel for a provided channel ID.

Supported Platforms

Required Scopes

  • [guilds] for guild channels
  • [guilds, dm_channels.read] for GDM channels. dm_channels.read requires approval from Discord.

Signature

Usage


getChannelPermissions()

Returns permissions for the current user in the currently connected channel.

Supported Platforms

Required Scopes

  • guilds.members.read

Signature

Usage


getEntitlements()

Returns a list of entitlements for the current user.

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


getInstanceConnectedParticipants()

Returns all participants connected to the instance.

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


getPlatformBehaviors()

Returns information about supported platform behaviors.

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


getRelationships()

Returns the current user’s relationships.

Supported Platforms

Required Scopes

  • relationships.read
This scope is part of our Social SDK - submit for access here. Social SDK Terms apply, including Section 5(a)(ii) to the data you obtain

Signature

Usage


getSkus()

Returns a list of SKU objects. SKUs without prices are automatically filtered out.

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


initiateImageUpload()

Presents the file upload flow in the Discord client.

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


Allows for opening an external link from within the Discord client.

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


openInviteDialog()

Presents a modal dialog with Channel Invite UI without requiring additional OAuth scopes.

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


openShareMomentDialog()

Presents a modal dialog to share media to a channel or direct message.

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


setActivity()

Modifies how your Activity’s Rich Presence data is displayed in the Discord client. The inner activity field is a partial Activity object. Read the guide on Using Rich Presence with the Embedded App SDK for more usage details.

Supported Platforms

Required Scopes

  • rpc.activities.write

Signature

Usage


setConfig()

Set whether or not the PIP (picture-in-picture) is interactive.

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


setOrientationLockState()

Locks the application to specific orientations in each of the supported layout modes.

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


Presents the user with a modal to share a link

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


startPurchase()

Launches the purchase flow for a specific SKU ID.

Supported Platforms

Required Scopes

No scopes required

Signature

Usage


userSettingsGetLocale()

Returns the current user’s locale.

Supported Platforms

Required Scopes

  • identify

Signature

Usage


SDK Events

Developers may use the following events alongside the subscribe() SDK method to subscribe to events from Discord and supported devices.

READY

Non-subscription event sent immediately after connecting, contains server information.

Required Scopes

No scopes required

Sample Event Payload

ERROR

Non-subscription event sent when there is an error, including command responses.

Required Scopes

No scopes required

Sample Event Payload


VOICE_STATE_UPDATE

Received when a user’s voice state changes in a subscribed voice channel (mute, volume, etc).

Required Scopes

  • rpc.voice.read

Sample Event Payload


SPEAKING_START

Received when a user in a subscribed voice channel speaks.

Required Scopes

  • rpc.voice.read

Sample Event Payload


SPEAKING_STOP

Received when a user in a subscribed voice channel stops speaking.

Required Scopes

  • rpc.voice.read

Sample Event Payload


ACTIVITY_LAYOUT_MODE_UPDATE

Received when a user changes the layout mode in the Discord client.

Required Scopes

No scopes required

Sample Event Payload


ORIENTATION_UPDATE

Received when screen orientation changes.

Required Scopes

No scopes required

Sample Event Payload


CURRENT_USER_UPDATE

Received when the current user object changes.

Required Scopes

  • identify

Sample Event Payload


CURRENT_GUILD_MEMBER_UPDATE

Received when the current guild member object changes.

Required Scopes

  • identify
  • guilds.members.read

Sample Event Payload


THERMAL_STATE_UPDATE

Received when Android or iOS thermal states are surfaced to the Discord mobile app.

Required Scopes

No scopes required

Sample Event Payload


ACTIVITY_INSTANCE_PARTICIPANTS_UPDATE

Received when the number of instance participants changes.

Required Scopes

No scopes required

Sample Event Payload


RELATIONSHIP_UPDATE

Received when a relationship of the current user is updated.

Required Scopes

  • relationships.read
This scope is part of our Social SDK - submit for access here. Social SDK Terms apply, including Section 5(a)(ii) to the data you obtain

Sample Event Payload


ENTITLEMENT_CREATE

Coming soon! Not available during Developer Preview

SDK Interfaces

Activity

Assets

Application

Attachment

AuthenticateRequest

AuthenticateResponse

AuthorizeRequest

AuthorizeResponse

AvatarDecorationData

CaptureLogRequest

ChannelMention

Embed

EmbedAuthor

EmbedField

EmbedFooter

EmbedProvider

Emoji

EncourageHardwareAccelerationResponse

Entitlement

GetChannelPermissionsResponse

GetChannelRequest

GetChannelResponse

GetEntitlementsResponse

GetInstanceConnectedParticipantsResponse

GetPlatformBehaviorsResponse

GetRelationshipsResponse

GetSkusResponse

GuildMember

GuildMemberRPC

Image

InitiateImageUploadResponse

Message

MessageActivity

MessageApplication

MessageReference

OpenExternalLinkRequest

OpenExternalLinkResponse

{ opened: null } is returned on Discord clients before December 2024 that do not report the open link result.

OpenShareMomentDialogRequest

Party

Reaction

Relationship

Secrets

SetActivityRequest

SetConfigRequest

SetConfigResponse

SetOrientationLockStateRequest

ShareLinkRequest

ShareLinkResponse

Sku

SkuPrice

StartPurchaseRequest

StartPurchaseResponse

Timestamp

User

UserSettingsGetLocaleResponse

UserVoiceState

Video

VoiceState

SDK Enums

ChannelTypesObject

ConsoleLevel

OrientationLockStateTypeObject

ThermalStateTypeObject

OrientationTypeObject

LayoutModeTypeObject

OAuthScopes

RPCCloseCodes

SkuTypeObject

Relationship Types