Skip to main content

Plugin API

Register a plugin

This guide describes the Plugin API.

import {registerPlugin} from '@pexip/plugin-api';

const plugin = await registerPlugin({id: 'your-plugin-name', version: 0});

API Overview

Note: All methods below is based on the Plugin object which is returned from the registerPlugin method:

export interface Plugin {
ui: {
addButton: (payload: RPCCallPayload<'ui:button:add'>) => Promise<Button>;
addForm: (payload: RPCCallPayload<'ui:form:open'>) => Promise<Form>;
showForm: (
payload: RPCCallPayload<'ui:form:open'>,
) => Promise<EventPayload<'ui:form:input'>['input']>;
addPrompt: (payload: RPCCallPayload<'ui:prompt:open'>) => Promise<Prompt>;
showPrompt: (
payload: RPCCallPayload<'ui:prompt:open'>,
) => Promise<EventPayload<'ui:prompt:input'>['input']>;
showToast: (payload: RPCCallPayload<'ui:toast:show'>) => Promise<void>;
};
conference: {
/**
* @throws Error
*/
dialOut: (
payload: RPCCallPayload<'conference:dialOut'>,
) => Promise<Participant>;
sendMessage: (
payload: RPCCallPayload<'conference:sendMessage'>,
) => Promise<RPCCallReply<'conference:sendApplicationMessage'>>;
sendApplicationMessage: (
payload: RPCCallPayload<'conference:sendApplicationMessage'>,
) => Promise<RPCCallReply<'conference:sendApplicationMessage'>>;
lock: (
payload: RPCCallPayload<'conference:lock'>,
) => Promise<RPCCallReply<'conference:lock'>>;
muteAllGuests: (
payload: RPCCallPayload<'conference:muteAllGuests'>,
) => Promise<RPCCallReply<'conference:muteAllGuests'>>;
setBandwidth: (
payload: RPCCallPayload<'conference:setBandwidth'>,
) => Promise<RPCCallReply<'conference:setBandwidth'>>;
setLayout: (
payload: RPCCallPayload<'conference:setLayout'>,
) => Promise<RPCCallReply<'conference:setLayout'>>;
disconnectAll: (
payload: RPCCallPayload<'conference:disconnectAll'>,
) => Promise<RPCCallReply<'conference:disconnectAll'>>;
transfer: (
payload: RPCCallPayload<'participant:transfer'>,
) => Promise<RPCCallReply<'participant:transfer'>>;
mute: (
payload: RPCCallPayload<'participant:mute'>,
) => Promise<RPCCallReply<'participant:mute'>>;
muteVideo: (
payload: RPCCallPayload<'participant:muteVideo'>,
) => Promise<RPCCallReply<'participant:muteVideo'>>;
spotlight: (
payload: RPCCallPayload<'participant:spotlight'>,
) => Promise<RPCCallReply<'participant:spotlight'>>;
admit: (
payload: RPCCallPayload<'participant:admit'>,
) => Promise<RPCCallReply<'participant:admit'>>;
raiseHand: (
payload: RPCCallPayload<'participant:raiseHand'>,
) => Promise<RPCCallReply<'participant:raiseHand'>>;
setRole: (
payload: RPCCallPayload<'participant:setRole'>,
) => Promise<RPCCallReply<'participant:setRole'>>;
setTextOverlay: (
payload: RPCCallPayload<'participant:setTextOverlay'>,
) => Promise<RPCCallReply<'participant:setTextOverlay'>>;
disconnect: (
payload: RPCCallPayload<'participant:disconnect'>,
) => Promise<RPCCallReply<'participant:disconnect'>>;
};
events: {
conferenceStatus: Signal<Event<'event:conferenceStatus'>['payload']>;
connected: Signal<Event<'event:connected'>['payload']>;
disconnected: Signal<Event<'event:disconnected'>['payload']>;
me: Signal<Event<'event:me'>['payload']>;
applicationMessage: Signal<Event<'event:applicationMessage'>['payload']>;
myselfMuted: Signal<Event<'event:myselfMuted'>['payload']>;
transfer: Signal<Event<'event:transfer'>['payload']>;
stage: Signal<Event<'event:stage'>['payload']>;
participants: Signal<Event<'event:participants'>['payload']>;
participantJoined: Signal<Event<'event:participantJoined'>['payload']>;
participantLeft: Signal<Event<'event:participantLeft'>['payload']>;
raiseHand: Signal<Event<'event:raiseHand'>['payload']>;
};
}