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.SDK Methods
ready()
Resolves when your app has successfully connected to the Discord client.Supported Platforms
Required Scopes
No scopes requiredSignature
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 requiredSignature
TheEventPayloadData 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 requiredSignature
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 requiredSignature
Usage
authorize()
Authorize a new client with your app.Supported Platforms
Required Scopes
No scopes requiredSignature
Usage
captureLog()
Forward logs to your own logger.Supported Platforms
Required Scopes
No scopes requiredSignature
Usage
encourageHardwareAcceleration()
Presents a modal dialog to allow enabling of hardware acceleration.Supported Platforms
Required Scopes
No scopes requiredSignature
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 requiredSignature
Usage
getInstanceConnectedParticipants()
Returns all participants connected to the instance.Supported Platforms
Required Scopes
No scopes requiredSignature
Usage
getPlatformBehaviors()
Returns information about supported platform behaviors.Supported Platforms
Required Scopes
No scopes requiredSignature
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 requiredSignature
Usage
initiateImageUpload()
Presents the file upload flow in the Discord client.Supported Platforms
Required Scopes
No scopes requiredSignature
Usage
openExternalLink()
Allows for opening an external link from within the Discord client.Supported Platforms
Required Scopes
No scopes requiredSignature
Usage
openInviteDialog()
Presents a modal dialog with Channel Invite UI without requiring additional OAuth scopes.Supported Platforms
Required Scopes
No scopes requiredSignature
Usage
openShareMomentDialog()
Presents a modal dialog to share media to a channel or direct message.Supported Platforms
Required Scopes
No scopes requiredSignature
Usage
setActivity()
Modifies how your Activity’s Rich Presence data is displayed in the Discord client. The inneractivity 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 requiredSignature
Usage
setOrientationLockState()
Locks the application to specific orientations in each of the supported layout modes.Supported Platforms
Required Scopes
No scopes requiredSignature
Usage
shareLink()
Presents the user with a modal to share a linkSupported Platforms
Required Scopes
No scopes requiredSignature
Usage
startPurchase()
Launches the purchase flow for a specific SKU ID.Supported Platforms
Required Scopes
No scopes requiredSignature
Usage
userSettingsGetLocale()
Returns the current user’s locale.Supported Platforms
Required Scopes
- identify
Signature
Usage
SDK Events
Developers may use the following events alongside thesubscribe() 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 requiredSample Event Payload
ERROR
Non-subscription event sent when there is an error, including command responses.Required Scopes
No scopes requiredSample 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 requiredSample Event Payload
ORIENTATION_UPDATE
Received when screen orientation changes.Required Scopes
No scopes requiredSample 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 requiredSample Event Payload
ACTIVITY_INSTANCE_PARTICIPANTS_UPDATE
Received when the number of instance participants changes.Required Scopes
No scopes requiredSample 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