Spotify
Search tracks, manage playlists, and browse your Spotify library.
On this page
Connect
Auth type: OAuth (oauth2). Click Connect and approve access on the provider's page. Appbricx runs the OAuth flow (signed single-use state, PKCE where the provider supports it), stores the tokens encrypted and refreshes them before they expire.
OAuth needs an OAuth app: the platform's when the operator configured one, or your own (admin panel, Integrations, Configure). You can also bring your own credentials.
- In the editor: Backend panel, Integrations tab, then Connect. This connects it for the project.
- For every project in a workspace: Workspace settings, Integrations.
- Owners and admins choose which integrations members may connect in the admin panel (Integrations tab), and can attach their own OAuth app there.
Call it from a workflow
Pass the action name and its input. The call resolves with { success, output, error? }; a missing connection resolves with success false and the reason. See ctx.integrations.invoke and ctx.integrations.call.
// .workflow.js (native ctx)
export async function run(ctx) {
const res = await ctx.integrations.invoke("spotify", "add_playlist_items", {
"playlist_id": "<playlist_id>",
"items": []
});
if (!res.success) throw new Error(res.error);
ctx.log.info("Spotify answered", { output: res.output });
}// defineWorkflow module (@app/sdk ctx)
import { defineWorkflow } from "@app/sdk";
export default defineWorkflow({
id: "spotify-add-playlist-items",
name: "Spotify: Add items to playlist",
description: "Calls Spotify when a row is created.",
trigger: { type: "entity_event", entity: "tickets", event: "created" },
async run(ctx, event) {
const res = await ctx.integrations.call("spotify", {
"action": "add_playlist_items",
"playlist_id": "<playlist_id>",
"items": []
}) as { success: boolean; error?: string };
if (!res.success) throw new Error(res.error);
},
});curl -X POST "$APP_ORIGIN/__appbricx/connector-proxy/spotify/add_playlist_items" \
-H "Authorization: Bearer $APP_KEY" \
-H "content-type: application/json" \
-d '{"props":{"playlist_id":"<playlist_id>","items":[]}}'Actions
add_playlist_itemsin catalog
Add items to playlist. Adds tracks or episodes to the playlist
| Input | Type | Description |
|---|---|---|
playlist_idrequired | id (picked from your account) | Playlist |
itemsrequired | array | URI's of the items to add |
positionoptional | number | Position |
create_playlistin catalog
Create Playlist. Creates a new playlist for the current user
| Input | Type | Description |
|---|---|---|
namerequired | text | Name |
descriptionoptional | text | Description |
publicoptional | boolean | Public |
collaborativeoptional | boolean | Collaborative |
get_playback_statein catalog
Get Playback State. Retrieves the current playback state of the player
No input.
get_playlist_infoin catalog
Get Playlist Info. Retrieves details of a playlist
| Input | Type | Description |
|---|---|---|
playlist_idrequired | id (picked from your account) | Playlist |
get_playlist_itemsin catalog
Get Playlist Items. Retrieves the list of items in the playlist
| Input | Type | Description |
|---|---|---|
playlist_idrequired | id (picked from your account) | Playlist |
offsetoptional | number | Offset |
limitoptional | number | Limit |
alloptional | boolean | Fetches all items in a single request |
get_playlistsin catalog
Get Playlists. Retrieves the list of playlists that you created or followed
| Input | Type | Description |
|---|---|---|
offsetoptional | number | Offset |
limitoptional | number | Limit |
alloptional | boolean | Fetches all playlists in a single request |
custom_api_call
Custom API Call. Make a custom API call to a specific endpoint
| Input | Type | Description |
|---|---|---|
urlrequired | object (depends on other props) | url |
methodrequired | one of "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | "HEAD" | Method |
headersrequired | object | Authorization headers are injected automatically from your connection. |
queryParamsrequired | object | Query Parameters |
body_typeoptional | one of "none" | "json" | "form_data" | "raw" | Body Type |
bodyoptional | object (depends on other props) | Body |
response_is_binaryoptional | boolean | Enable for files like PDFs, images, etc. |
failsafeoptional | boolean | No Error on Failure |
timeoutoptional | number | Timeout (in seconds) |
followRedirectsoptional | boolean | Follow redirects |
get_saved_tracks
Get Saved Tracks. Retrieves the list of saved tracks for the current user
| Input | Type | Description |
|---|---|---|
offsetoptional | number | Offset |
limitoptional | number | Limit |
alloptional | boolean | Fetches all items in a single request |
pause
Pause. Pauses the playback
| Input | Type | Description |
|---|---|---|
device_idoptional | id (picked from your account) | Device |
play
Play / Resume. Resumes or starts playback
| Input | Type | Description |
|---|---|---|
device_idoptional | id (picked from your account) | Device |
context_urioptional | text | Spotify URI of the context to play (album, artist, playlist) |
tracksoptional | array | List of spotify track uris to play |
position_msoptional | number | Position in milliseconds |
remove_playlist_items
Remove items from playlist. Removes tracks or episodes from the playlist
| Input | Type | Description |
|---|---|---|
playlist_idrequired | id (picked from your account) | Playlist |
itemsrequired | array | URI's of the items to remove |
reorder_playlist
Reorder playlist. Reorders items in the playlist
| Input | Type | Description |
|---|---|---|
playlist_idrequired | id (picked from your account) | Playlist |
from_positionrequired | number | From Position |
to_positionrequired | number | To Position |
amountoptional | number | Amount of Items |
search
Search. Searches for tracks, artists, albums, etc.
| Input | Type | Description |
|---|---|---|
search_textrequired | text | The word or phrase you are searching for |
typesrequired | list of | Object Types |
limitoptional | number | Limit |
offsetoptional | number | Offset |
set_volume
Set Volume. Sets the volume of the player
| Input | Type | Description |
|---|---|---|
volumerequired | number | Volume from 0 to 100 |
device_idoptional | id (picked from your account) | Device |
update_playlist
Update Playlist. Updates details of the playlist
| Input | Type | Description |
|---|---|---|
playlist_idrequired | id (picked from your account) | Playlist |
nameoptional | text | Name |
descriptionoptional | text | Description |
publicoptional | boolean | Public |
collaborativeoptional | boolean | Collaborative |
Details
- Id
spotify- Category
- Social media
- Tags
- music, audio, playlists, streaming
- Package
@activepieces/piece-spotify@0.4.4- Tier
- Community