Skip to main content

Class: Emby

Constructors​

Constructor​

new Emby(config?): Emby

Parameters​

config?​

EmbyConfig = {}

Returns​

Emby

Properties​

api​

readonly api: object

Auto-generated, Zod-validated API methods — one per operationId in openapi.yml. Regenerated via npm run generate. Complements the hand-written high-level methods below.

chatAddParticipants​

chatAddParticipants: <T>(input) => Promise<T>

Add participants to chat

Type Parameters​
T​

T = ChatAddParticipantsResponse

Parameters​
input​

ChatAddParticipantsInput

Returns​

Promise<T>

chatCreate​

chatCreate: <T>(input) => Promise<T>

Create a new chat

Type Parameters​
T​

T = ChatCreateResponse

Parameters​
input​

ChatCreateInput

Returns​

Promise<T>

chatDelete​

chatDelete: <T>(input) => Promise<T>

Delete chat

Type Parameters​
T​

T = ChatDeleteResponse

Parameters​
input​

ChatDeleteInput

Returns​

Promise<T>

chatDeleteParticipantRights​

chatDeleteParticipantRights: <T>(input) => Promise<T>

Clear all participant rights for this chat

Type Parameters​
T​

T = ChatDeleteParticipantRightsResponse

Parameters​
input​

ChatDeleteParticipantRightsInput

Returns​

Promise<T>

chatDeleteParticipants​

chatDeleteParticipants: <T>(input) => Promise<T>

Remove participant from chat

Type Parameters​
T​

T = ChatDeleteParticipantsResponse

Parameters​
input​

ChatDeleteParticipantsInput

Returns​

Promise<T>

chatGetParticipantRights​

chatGetParticipantRights: <T>(input) => Promise<T>

Get participant's per-chat rights

Type Parameters​
T​

T = ChatGetParticipantRightsResponse

Parameters​
input​

ChatGetParticipantRightsInput

Returns​

Promise<T>

chatList​

chatList: <T>(input?) => Promise<T>

List chats

Type Parameters​
T​

T = ChatListResponse

Parameters​
input?​

object & RequestControlOptions

Returns​

Promise<T>

chatMessages​

chatMessages: <T>(input) => Promise<T>

List messages in chat

Type Parameters​
T​

T = ChatMessagesResponse

Parameters​
input​

ChatMessagesInput

Returns​

Promise<T>

chatParticipants​

chatParticipants: <T>(input) => Promise<T>

List chat participants

Type Parameters​
T​

T = ChatParticipantsResponse

Parameters​
input​

ChatParticipantsInput

Returns​

Promise<T>

chatSendMessage​

chatSendMessage: <T>(input) => Promise<T>

Send messages to chat

Type Parameters​
T​

T = ChatSendMessageResponse

Parameters​
input​

ChatSendMessageInput

Returns​

Promise<T>

chatSendTyping​

chatSendTyping: <T>(input) => Promise<T>

Send typing indicator

Type Parameters​
T​

T = ChatSendTypingResponse

Parameters​
input​

ChatSendTypingInput

Returns​

Promise<T>

chatSetS3Credentials​

chatSetS3Credentials: <T>(input) => Promise<T>

Set S3 credentials for chat

Type Parameters​
T​

T = ChatSetS3CredentialsResponse

Parameters​
input​

ChatSetS3CredentialsInput

Returns​

Promise<T>

chatSetWebhook​

chatSetWebhook: <T>(input) => Promise<T>

Set chat webhook settings

Type Parameters​
T​

T = ChatSetWebhookResponse

Parameters​
input​

ChatSetWebhookInput

Returns​

Promise<T>

chatShow​

chatShow: <T>(input) => Promise<T>

Get chat details

Type Parameters​
T​

T = ChatShowResponse

Parameters​
input​

ChatShowInput

Returns​

Promise<T>

chatUpdate​

chatUpdate: <T>(input) => Promise<T>

Update chat

Type Parameters​
T​

T = ChatUpdateResponse

Parameters​
input​

ChatUpdateInput

Returns​

Promise<T>

chatUpdateMessage​

chatUpdateMessage: <T>(input) => Promise<T>

Update message

Type Parameters​
T​

T = ChatUpdateMessageResponse

Parameters​
input​

ChatUpdateMessageInput

Returns​

Promise<T>

chatUpdateParticipantRights​

chatUpdateParticipantRights: <T>(input) => Promise<T>

Override participant rights for this chat

Type Parameters​
T​

T = ChatUpdateParticipantRightsResponse

Parameters​
input​

ChatUpdateParticipantRightsInput

Returns​

Promise<T>

resourceShow​

resourceShow: <T>(input) => Promise<T>

Resource status

Type Parameters​
T​

T = { resource?: { attachment_id?: string | null; error?: string | null; expires_at?: string | null; id?: string; status?: "pending" | "verifying" | "processing" | "ready" | "failed"; type?: "voice"; }; status?: boolean; }

Parameters​
input​

ResourceShowInput

Returns​

Promise<T>

resourceUploadUrl​

resourceUploadUrl: <T>(input) => Promise<T>

Get an upload URL for a file

Type Parameters​
T​

T = ResourceUploadUrlResponse

Parameters​
input​

ResourceUploadUrlInput

Returns​

Promise<T>

resourceVerify​

resourceVerify: <T>(input) => Promise<T>

Verify an uploaded file

Type Parameters​
T​

T = { resource?: { attachment_id?: string | null; error?: string | null; expires_at?: string | null; id?: string; status?: "pending" | "verifying" | "processing" | "ready" | "failed"; type?: "voice"; }; status?: boolean; }

Parameters​
input​

ResourceVerifyInput

Returns​

Promise<T>

tenantClearData​

tenantClearData: <T>(input?) => Promise<T>

Clear tenant data

Type Parameters​
T​

T = TenantClearDataResponse

Parameters​
input?​

object & RequestControlOptions

Returns​

Promise<T>

tenantSetFirebaseConfigForJs​

tenantSetFirebaseConfigForJs: <T>(input) => Promise<T>

Set Firebase config for JS

Type Parameters​
T​

T = unknown

Parameters​
input​

TenantSetFirebaseConfigForJsInput

Returns​

Promise<T>

tenantSetFirebaseFcmVapid​

tenantSetFirebaseFcmVapid: <T>(input) => Promise<T>

Set Firebase FCM VAPID

Type Parameters​
T​

T = unknown

Parameters​
input​

TenantSetFirebaseFcmVapidInput

Returns​

Promise<T>

tenantSetFirebaseServiceAccount​

tenantSetFirebaseServiceAccount: <T>(input) => Promise<T>

Set Firebase service account

Type Parameters​
T​

T = unknown

Parameters​
input​

TenantSetFirebaseServiceAccountInput

Returns​

Promise<T>

tenantSetParticipantsListingSettings​

tenantSetParticipantsListingSettings: <T>(input) => Promise<T>

Set participant-listing settings

Type Parameters​
T​

T = TenantSetParticipantsListingSettingsResponse

Parameters​
input​

TenantSetParticipantsListingSettingsInput

Returns​

Promise<T>

tenantSetPushNotificationsSettings​

tenantSetPushNotificationsSettings: <T>(input) => Promise<T>

Set push notification settings

Type Parameters​
T​

T = unknown

Parameters​
input​

TenantSetPushNotificationsSettingsInput

Returns​

Promise<T>

tenantSetS3Credentials​

tenantSetS3Credentials: <T>(input) => Promise<T>

Set tenant S3 credentials

Type Parameters​
T​

T = TenantSetS3CredentialsResponse

Parameters​
input​

TenantSetS3CredentialsInput

Returns​

Promise<T>

tenantSetWebhookSettings​

tenantSetWebhookSettings: <T>(input) => Promise<T>

Set tenant webhook settings

Type Parameters​
T​

T = unknown

Parameters​
input​

TenantSetWebhookSettingsInput

Returns​

Promise<T>

userAddFcmToken​

userAddFcmToken: <T>(input) => Promise<T>

Add FCM token

Type Parameters​
T​

T = unknown

Parameters​
input​

UserAddFcmTokenInput

Returns​

Promise<T>

userChats​

userChats: <T>(input) => Promise<T>

Get user chats

Type Parameters​
T​

T = UserChatsResponse

Parameters​
input​

UserChatsInput

Returns​

Promise<T>

userCreate​

userCreate: <T>(input) => Promise<T>

Create user

Type Parameters​
T​

T = UserCreateResponse

Parameters​
input​

UserCreateInput

Returns​

Promise<T>

userDelete​

userDelete: <T>(input) => Promise<T>

Delete user

Type Parameters​
T​

T = unknown

Parameters​
input​

UserDeleteInput

Returns​

Promise<T>

userShow​

userShow: <T>(input) => Promise<T>

Get user details

Type Parameters​
T​

T = UserShowResponse

Parameters​
input​

UserShowInput

Returns​

Promise<T>

userUpdate​

userUpdate: <T>(input) => Promise<T>

Update user

Type Parameters​
T​

T = UserUpdateResponse

Parameters​
input​

UserUpdateInput

Returns​

Promise<T>


apiToken?​

optional apiToken?: string


apiUrl?​

optional apiUrl?: string


baseUrl?​

optional baseUrl?: string


clientId?​

optional clientId?: string


clientSecret?​

optional clientSecret?: string


requestOptions​

readonly requestOptions: object

Validated request-reliability options (timeout, …), resolved at construction.

retries​

retries: number

retryDelay​

retryDelay: number

timeout​

timeout: number

Methods​

addParticipantsToChat()​

addParticipantsToChat<T>(chatId, participants?): Promise<T>

Type Parameters​

T​

T = ChatAddParticipantsResponse

Parameters​

chatId​

string

participants?​

Participant[] = []

Returns​

Promise<T>


createChat()​

createChat<T>(chat, participants?): Promise<T>

Create a chat. Backend requires participants for type: 'private'.

Type Parameters​

T​

T = ChatCreateResponse

Parameters​

chat​

ChatCreate

Chat fields: { id, title, type, metadata?, owner? }.

participants?​

Participant[]

Optional participants array (required for private chats).

Returns​

Promise<T>


createUser()​

createUser<T>(user): Promise<T>

Create a user.

Type Parameters​

T​

T = UserCreateResponse

Parameters​

user​

User

Returns​

Promise<T>


deleteChat()​

deleteChat<T>(chatId): Promise<T>

Delete a chat permanently.

Type Parameters​

T​

T = ChatDeleteResponse

Parameters​

chatId​

string

Returns​

Promise<T>


deleteMessage()​

deleteMessage<T>(chatId, messageId): Promise<T>

Soft-delete a message. Wire format aligned with the openapi spec (is_deleted: true boolean). Backend is lenient — accepts both true and '1' — but spec is authoritative going forward.

Type Parameters​

T​

T = ChatUpdateMessageResponse

Parameters​

chatId​

string

messageId​

string

Returns​

Promise<T>


deleteParticipantRights()​

deleteParticipantRights<T>(chatId, userId): Promise<T>

Clear all of a participant's per-chat right overrides (DELETE chats/{chatId}/participants/{userId}/rights). The participant falls back entirely to their signed-link rights. Propagates live over the socket.

Type Parameters​

T​

T = ChatDeleteParticipantRightsResponse

Parameters​

chatId​

string

Chat id.

userId​

string

Participant's user id.

Returns​

Promise<T>


deleteUser()​

deleteUser<T>(userId): Promise<T>

Delete a user permanently.

Type Parameters​

T​

T = unknown

Parameters​

userId​

string

Returns​

Promise<T>


getChatInfo()​

getChatInfo<T>(id): Promise<T>

Type Parameters​

T​

T = ChatShowResponse

Parameters​

id​

string

Returns​

Promise<T>


getChatParticipants()​

getChatParticipants<T>(chatId, query?): Promise<T>

List participants of a chat (paginated).

Type Parameters​

T​

T = ChatParticipantsResponse

Parameters​

chatId​

string

query?​

PaginationQuery = {}

Returns​

Promise<T>


getChats()​

getChats<T>(queryParams?): Promise<T>

Type Parameters​

T​

T = ChatListResponse

Parameters​

queryParams?​

GetChatsQuery = {}

Returns​

Promise<T>


getMessagesFromChat()​

getMessagesFromChat<T>(chatId, queryParams?, page?, limit?): Promise<T>

Bug-fix in 1.13: legacy code sent withUsers=1 (camelCase) — backend silently ignored it. Now coerces to spec with_users=1 (snake_case + integer wire). Public-API field name remains with_users (matches GetChatMessagesQuery); legacy withUsers callers also accepted.

Type Parameters​

T​

T = ChatMessagesResponse

Parameters​

chatId​

string

queryParams?​

GetChatMessagesQuery

page?​

number = 1

limit?​

number = 1

Returns​

Promise<T>


getParticipantRights()​

getParticipantRights<T>(chatId, userId): Promise<T>

Read a participant's per-chat right overrides (GET chats/{chatId}/participants/{userId}/rights) — the values set via updateParticipantRights. Rights not overridden here fall back to the participant's signed-link values.

Type Parameters​

T​

T = ChatGetParticipantRightsResponse

Parameters​

chatId​

string

Chat id.

userId​

string

Participant's user id.

Returns​

Promise<T>


getUser()​

getUser<T>(userId): Promise<T>

Get a user by id.

Type Parameters​

T​

T = UserShowResponse

Parameters​

userId​

string

Returns​

Promise<T>


getUserChats()​

getUserChats<T>(userId, query?): Promise<T>

List chats associated with a user (paginated, filterable by metadata / read state / order).

Type Parameters​

T​

T = UserChatsResponse

Parameters​

userId​

string

query?​

GetUserChatsQuery = {}

Returns​

Promise<T>


iterateChatParticipants()​

iterateChatParticipants(chatId, query?): PageIterator<{ created_at: string; email?: string; id: string; is_bot: boolean; link?: string; name: string; picture?: string | { color?: string; initials?: string; kind: string; }; updated_at: string; }>

Walk everyone in a chat, not just one page — see PageIterator.

Parameters​

chatId​

string

query?​

PaginationQuery & RequestControlOptions = {}

Returns​

PageIterator<{ created_at: string; email?: string; id: string; is_bot: boolean; link?: string; name: string; picture?: string | { color?: string; initials?: string; kind: string; }; updated_at: string; }>


iterateChats()​

iterateChats(query?): PageIterator<{ created_at: string; id: string; last_message?: { attachments?: object[]; buttons?: object[]; created_at: number; extra: Record<string, string | number | boolean>; id: string; is_deleted: boolean; is_edited: boolean; recipient_id?: string; seq: number; text: string | null; updated_at: number | null; user_id: string; versions: number; }; last_message_at?: string; metadata?: Record<string, string | number | boolean>; owner?: { created_at: string; email?: string; id: string; is_bot: boolean; link?: string; metadata?: Record<string, string>; name: string; picture?: string | { color?: string; initials?: string; kind: string; }; updated_at: string; }; owner_id?: string; participants?: object[]; participants_omitted?: { hint?: string; members_count: number; reason: "large_group" | "unsupported_type"; }; title: string | null; type: "private" | "group" | "supergroup" | "channel" | null; updated_at: string; }>

Walk the whole chat list, not just one page — see PageIterator for the three ways to read one.

Takes the same query as getChats, so filters and per-call options (signal, timeout, …) go out with every page. limit sets the page size, kept inside what the endpoint serves (MAX_PAGE_SIZE); without it the walker's own default applies rather than the single chat getChats asks for.

Parameters​

query?​

GetChatsQuery & RequestControlOptions = {}

Returns​

PageIterator<{ created_at: string; id: string; last_message?: { attachments?: object[]; buttons?: object[]; created_at: number; extra: Record<string, string | number | boolean>; id: string; is_deleted: boolean; is_edited: boolean; recipient_id?: string; seq: number; text: string | null; updated_at: number | null; user_id: string; versions: number; }; last_message_at?: string; metadata?: Record<string, string | number | boolean>; owner?: { created_at: string; email?: string; id: string; is_bot: boolean; link?: string; metadata?: Record<string, string>; name: string; picture?: string | { color?: string; initials?: string; kind: string; }; updated_at: string; }; owner_id?: string; participants?: object[]; participants_omitted?: { hint?: string; members_count: number; reason: "large_group" | "unsupported_type"; }; title: string | null; type: "private" | "group" | "supergroup" | "channel" | null; updated_at: string; }>


iterateMessagesFromChat()​

iterateMessagesFromChat(chatId, query?): PageIterator<{ attachments?: object[]; buttons?: object[]; created_at: number; extra: Record<string, string | number | boolean>; id: string; is_deleted: boolean; is_edited: boolean; recipient_id?: string; seq: number; text: string | null; updated_at: number | null; user_id: string; versions: number; }>

Walk all of a chat's messages — see PageIterator.

Unlike getMessagesFromChat, paging belongs in the query object here: the positional page / limit of that method would have nothing to mean across a walk.

Messages posted while you walk shift the pages under you; ask for a fixed window (isDeleted, extra, …) if that matters.

Parameters​

chatId​

string

query?​

GetChatMessagesQuery & RequestControlOptions = {}

Returns​

PageIterator<{ attachments?: object[]; buttons?: object[]; created_at: number; extra: Record<string, string | number | boolean>; id: string; is_deleted: boolean; is_edited: boolean; recipient_id?: string; seq: number; text: string | null; updated_at: number | null; user_id: string; versions: number; }>


iterateUserChats()​

iterateUserChats(userId, query?): PageIterator<{ created_at: string; id: string; last_message?: { attachments?: object[]; buttons?: object[]; created_at: number; extra: Record<string, string | number | boolean>; id: string; is_deleted: boolean; is_edited: boolean; recipient_id?: string; seq: number; text: string | null; updated_at: number | null; user_id: string; versions: number; }; last_message_at?: string; metadata?: Record<string, string | number | boolean>; owner?: { created_at: string; email?: string; id: string; is_bot: boolean; link?: string; metadata?: Record<string, string>; name: string; picture?: string | { color?: string; initials?: string; kind: string; }; updated_at: string; }; owner_id?: string; participants?: object[]; participants_omitted?: { hint?: string; members_count: number; reason: "large_group" | "unsupported_type"; }; title: string | null; type: "private" | "group" | "supergroup" | "channel" | null; updated_at: string; }>

Walk every chat a user belongs to — see PageIterator. limit is kept inside what this endpoint serves (MAX_USER_CHATS_PAGE_SIZE), which is lower than the ceiling the other three lists share.

Parameters​

userId​

string

query?​

GetUserChatsQuery & RequestControlOptions = {}

Returns​

PageIterator<{ created_at: string; id: string; last_message?: { attachments?: object[]; buttons?: object[]; created_at: number; extra: Record<string, string | number | boolean>; id: string; is_deleted: boolean; is_edited: boolean; recipient_id?: string; seq: number; text: string | null; updated_at: number | null; user_id: string; versions: number; }; last_message_at?: string; metadata?: Record<string, string | number | boolean>; owner?: { created_at: string; email?: string; id: string; is_bot: boolean; link?: string; metadata?: Record<string, string>; name: string; picture?: string | { color?: string; initials?: string; kind: string; }; updated_at: string; }; owner_id?: string; participants?: object[]; participants_omitted?: { hint?: string; members_count: number; reason: "large_group" | "unsupported_type"; }; title: string | null; type: "private" | "group" | "supergroup" | "channel" | null; updated_at: string; }>


removeParticipantFromChat()​

removeParticipantFromChat<T>(chatId, userId): Promise<T>

Remove a single participant from a chat by user id.

Type Parameters​

T​

T = ChatDeleteParticipantsResponse

Parameters​

chatId​

string

userId​

string

Returns​

Promise<T>


requestApi()​

requestApi<T>(method, params?, type?, version?, query?, headers?, control?): Promise<T>

Type Parameters​

T​

T = unknown

Parameters​

method​

string

params?​

Record<string, unknown> = {}

type?​

HttpMethod = 'get'

version?​

string = 'v1'

query?​

Record<string, unknown>

headers?​

Record<string, unknown>

control?​

RequestControlOptions

Returns​

Promise<T>


sendMessage()​

sendMessage<T>(chat, user, participants, message, extra?, buttons?, __namedParameters?): Promise<T>

Post a message. The seventh argument carries what isn't about the message itself — today that is force, see SendMessageOptions.

A voice message goes here too. Pass { attachment_id } for a file that went through the resource pipeline: Emby.api resourceUploadUrl, PUT the bytes to the URL it returns, resourceVerify, then poll resourceShow until status is ready — that answer carries the id. The same id can be sent again, to other chats too, as long as they keep files in the same bucket. { voice_url } still works but is deprecated: the backend fetches the link and posts the message before converting it, so a format browsers can't play arrives unplayable. The text is optional next to either and becomes the caption.

Send one or the other. The spec states that rule in words only, so the SDK doesn't check it: the pair goes out and the backend answers 422.

Type Parameters​

T​

T = ChatSendMessageResponse

Parameters​

chat​

ChatArg

user​

User

participants​

Participant[] | undefined

message​

MessageTextInput

extra?​

ExtraMap = {}

buttons?​

MessageButton[] = []

__namedParameters?​

SendMessageOptions = {}

Returns​

Promise<T>


sendTyping()​

sendTyping<T>(chatId, userId, time?): Promise<T>

BREAKING (1.13): now sends PUT /chats/{chat_id}/typing/{user_id} (no body) per the OpenAPI spec, which is what the backend actually accepts. The previous shape (PUT /chats/{chat_id}/typing with { user: userId } body) is no longer used. Verified live; legacy URL silently failed.

Type Parameters​

T​

T = ChatSendTypingResponse

Parameters​

chatId​

string

userId​

string

time?​

number

Optional: how long (in seconds, 1–60) recipients keep showing the indicator before it auto-hides. Sent as a URL query param per the spec; omit to use the client default (5s).

Returns​

Promise<T>


updateChat()​

updateChat<T>(chatId, updates?): Promise<T>

Update mutable chat fields (title, metadata, id).

Type Parameters​

T​

T = ChatUpdateResponse

Parameters​

chatId​

string

updates?​

ChatUpdate = {}

Returns​

Promise<T>


updateMessage()​

updateMessage<T>(chatId, messageId, __namedParameters, __namedParameters?): Promise<T>

Wire-format aligned with spec: is_deleted is a boolean (was '1' string). returnMessage maps to the RFC 7240 Prefer: return=representation header (the legacy return_message body field and ?result=yes flag were dropped).

Type Parameters​

T​

T = ChatUpdateMessageResponse

Parameters​

chatId​

string

messageId​

string

__namedParameters​

UpdateMessageInput

__namedParameters?​

UpdateMessageOptions = {}

Returns​

Promise<T>


updateParticipantRights()​

updateParticipantRights<T>(chatId, userId, rights): Promise<T>

Override a participant's rights for a single chat (PUT chats/{chatId}/participants/{userId}/rights). Every right is optional but at least one must be given; each present value fully replaces the participant's signed-link value for this chat, and an explicit null clears the override (they fall back to the link value). Changes propagate live over the socket.

Type Parameters​

T​

T = ChatUpdateParticipantRightsResponse

Parameters​

chatId​

string

Chat id.

userId​

string

Participant's user id.

rights​

Per-chat right overrides — booleans accept true/false/null; edit_messages/delete_messages are none|my|any, pin_messages is none|for_me|for_everyone.

can_press_buttons?​

boolean | null = ...

create_pool?​

boolean | null = ...

delete_messages?​

"none" | "my" | "any" | null = ...

edit_messages?​

"none" | "my" | "any" | null = ...

kick_users?​

boolean | null = ...

leave_chats?​

boolean | null = ...

participate_pool?​

boolean | null = ...

pin_messages?​

"none" | "for_me" | "for_everyone" | null = ...

react_messages?​

boolean | null = ...

send_audio?​

boolean | null = ...

send_documents?​

boolean | null = ...

send_location?​

boolean | null = ...

send_messages?​

boolean | null = ...

send_photos?​

boolean | null = ...

send_read_state?​

boolean | null = ...

send_typing?​

boolean | null = ...

send_voices?​

boolean | null = ...

track_presence?​

boolean | null = ...

track_read_state?​

boolean | null = ...

Returns​

Promise<T>


updateUser()​

updateUser<T>(userId, updates?): Promise<T>

Update mutable user fields.

Type Parameters​

T​

T = UserUpdateResponse

Parameters​

userId​

string

updates?​

Partial<User> = {}

Returns​

Promise<T>


url()​

url(__namedParameters): string

Parameters​

__namedParameters​

UrlOptions

Returns​

string


urlByChatId()​

urlByChatId(chat?, user?, participants?, extra?): string

Parameters​

chat?​

string | ChatInput = {}

user?​

UrlUserOptions = {}

participants?​

UrlRecipient[] = []

extra?​

Record<string, unknown> = {}

Returns​

string