ChannelsService

A list of all methods in the ChannelsService service. Click on the method name to view detailed information about that method.

Methods Description
getMobilePushApnsTokens Lists all mobile_push tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.
saveMobilePushApnsToken Saves a mobile_push token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.
getMobilePushApnsToken Retrieves details of a specific mobile_push token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.
discardMobilePushApnsToken Revokes one of the authenticated user's mobile_push tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.
getMobilePushExpoTokens Lists all mobile_push tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.
saveMobilePushExpoToken Saves a mobile_push token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.
getMobilePushExpoToken Retrieves details of a specific mobile_push token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.
discardMobilePushExpoToken Revokes one of the authenticated user's mobile_push tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.
getMobilePushFcmTokens Lists all mobile_push tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.
saveMobilePushFcmToken Saves a mobile_push token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.
getMobilePushFcmToken Retrieves details of a specific mobile_push token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.
discardMobilePushFcmToken Revokes one of the authenticated user's mobile_push tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.
getSlackTokens Lists all slack tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.
saveSlackToken Saves a slack token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.
getSlackToken Retrieves details of a specific slack token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.
discardSlackToken Revokes one of the authenticated user's slack tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.
getTeamsTokens Lists all teams tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.
saveTeamsToken Saves a teams token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.
getTeamsToken Retrieves details of a specific teams token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.
discardTeamsToken Revokes one of the authenticated user's teams tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.
getWebPushTokens Lists all web_push tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.
saveWebPushToken Saves a web_push token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.
getWebPushToken Retrieves details of a specific web_push token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.
discardWebPushToken Revokes one of the authenticated user's web_push tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.

getMobilePushApnsTokens

Lists all mobile_push tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.

  • HTTP Method: GET
  • Endpoint: /channels/mobile_push/apns/tokens

Parameters

Name Type Required Description
pageSize number
pageAfter string
pageBefore string

Return Type

ArrayOfMetadataApnsTokens

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.getMobilePushApnsTokens({
    pageSize: 6,
    pageAfter: 'page[after]',
    pageBefore: 'page[before]',
  });

  console.log(data);
})();

saveMobilePushApnsToken

Saves a mobile_push token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.

  • HTTP Method: POST
  • Endpoint: /channels/mobile_push/apns/tokens

Parameters

Name Type Required Description
body ApnsToken The request body.

Return Type

ApnsToken

Example Usage Code Snippet

import { ApnsToken, Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const apnsTokenInstallationId = ApnsTokenInstallationId.DEVELOPMENT;

  const apnsToken: ApnsToken = {
    appId: 'app_id',
    deviceToken: 'voluptate paria',
    installationId: apnsTokenInstallationId,
  };

  const { data } = await client.channels.saveMobilePushApnsToken(apnsToken);

  console.log(data);
})();

getMobilePushApnsToken

Retrieves details of a specific mobile_push token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.

  • HTTP Method: GET
  • Endpoint: /channels/mobile_push/apns/tokens/{token_id}

Parameters

Name Type Required Description
tokenId string

Return Type

MetadataApnsToken

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.getMobilePushApnsToken('token_id');

  console.log(data);
})();

discardMobilePushApnsToken

Revokes one of the authenticated user's mobile_push tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.

  • HTTP Method: DELETE
  • Endpoint: /channels/mobile_push/apns/tokens/{token_id}

Parameters

Name Type Required Description
tokenId string

Return Type

DiscardResult

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.discardMobilePushApnsToken('token_id');

  console.log(data);
})();

getMobilePushExpoTokens

Lists all mobile_push tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.

  • HTTP Method: GET
  • Endpoint: /channels/mobile_push/expo/tokens

Parameters

Name Type Required Description
pageSize number
pageAfter string
pageBefore string

Return Type

ArrayOfMetadataExpoTokens

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.getMobilePushExpoTokens({
    pageSize: 6,
    pageAfter: 'page[after]',
    pageBefore: 'page[before]',
  });

  console.log(data);
})();

saveMobilePushExpoToken

Saves a mobile_push token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.

  • HTTP Method: POST
  • Endpoint: /channels/mobile_push/expo/tokens

Parameters

Name Type Required Description
body ExpoToken The request body.

Return Type

ExpoToken

Example Usage Code Snippet

import { Client, ExpoToken } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const expoToken: ExpoToken = {
    deviceToken: 'device_token',
  };

  const { data } = await client.channels.saveMobilePushExpoToken(expoToken);

  console.log(data);
})();

getMobilePushExpoToken

Retrieves details of a specific mobile_push token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.

  • HTTP Method: GET
  • Endpoint: /channels/mobile_push/expo/tokens/{token_id}

Parameters

Name Type Required Description
tokenId string

Return Type

MetadataExpoToken

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.getMobilePushExpoToken('token_id');

  console.log(data);
})();

discardMobilePushExpoToken

Revokes one of the authenticated user's mobile_push tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.

  • HTTP Method: DELETE
  • Endpoint: /channels/mobile_push/expo/tokens/{token_id}

Parameters

Name Type Required Description
tokenId string

Return Type

DiscardResult

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.discardMobilePushExpoToken('token_id');

  console.log(data);
})();

getMobilePushFcmTokens

Lists all mobile_push tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.

  • HTTP Method: GET
  • Endpoint: /channels/mobile_push/fcm/tokens

Parameters

Name Type Required Description
pageSize number
pageAfter string
pageBefore string

Return Type

ArrayOfMetadataFcmTokens

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.getMobilePushFcmTokens({
    pageSize: 10,
    pageAfter: 'page[after]',
    pageBefore: 'page[before]',
  });

  console.log(data);
})();

saveMobilePushFcmToken

Saves a mobile_push token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.

  • HTTP Method: POST
  • Endpoint: /channels/mobile_push/fcm/tokens

Parameters

Name Type Required Description
body FcmToken The request body.

Return Type

FcmToken

Example Usage Code Snippet

import { Client, FcmToken } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const fcmTokenInstallationId = FcmTokenInstallationId.DEVELOPMENT;

  const fcmToken: FcmToken = {
    deviceToken: 'eiusmod esse ni',
    installationId: fcmTokenInstallationId,
  };

  const { data } = await client.channels.saveMobilePushFcmToken(fcmToken);

  console.log(data);
})();

getMobilePushFcmToken

Retrieves details of a specific mobile_push token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.

  • HTTP Method: GET
  • Endpoint: /channels/mobile_push/fcm/tokens/{token_id}

Parameters

Name Type Required Description
tokenId string

Return Type

MetadataFcmToken

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.getMobilePushFcmToken('token_id');

  console.log(data);
})();

discardMobilePushFcmToken

Revokes one of the authenticated user's mobile_push tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.

  • HTTP Method: DELETE
  • Endpoint: /channels/mobile_push/fcm/tokens/{token_id}

Parameters

Name Type Required Description
tokenId string

Return Type

DiscardResult

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.discardMobilePushFcmToken('token_id');

  console.log(data);
})();

getSlackTokens

Lists all slack tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.

  • HTTP Method: GET
  • Endpoint: /channels/slack/tokens

Parameters

Name Type Required Description
pageSize number
pageAfter string
pageBefore string

Return Type

ArrayOfMetadataSlackTokens

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.getSlackTokens({
    pageSize: 2,
    pageAfter: 'page[after]',
    pageBefore: 'page[before]',
  });

  console.log(data);
})();

saveSlackToken

Saves a slack token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.

  • HTTP Method: POST
  • Endpoint: /channels/slack/tokens

Parameters

Name Type Required Description
body SlackToken The request body.

Return Type

SlackToken

Example Usage Code Snippet

import { Client, SlackToken } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const oauth: Oauth = {
    channelId: 'channel_id',
    installationId: 'installation_id',
    scope: 'scope',
  };

  const slackTokenWebhook: SlackTokenWebhook = {
    url: 'url',
  };

  const slackToken: SlackToken = {
    oauth: oauth,
    webhook: slackTokenWebhook,
  };

  const { data } = await client.channels.saveSlackToken(slackToken);

  console.log(data);
})();

getSlackToken

Retrieves details of a specific slack token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.

  • HTTP Method: GET
  • Endpoint: /channels/slack/tokens/{token_id}

Parameters

Name Type Required Description
tokenId string

Return Type

MetadataSlackToken

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.getSlackToken('token_id');

  console.log(data);
})();

discardSlackToken

Revokes one of the authenticated user's slack tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.

  • HTTP Method: DELETE
  • Endpoint: /channels/slack/tokens/{token_id}

Parameters

Name Type Required Description
tokenId string

Return Type

DiscardResult

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.discardSlackToken('token_id');

  console.log(data);
})();

getTeamsTokens

Lists all teams tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.

  • HTTP Method: GET
  • Endpoint: /channels/teams/tokens

Parameters

Name Type Required Description
pageSize number
pageAfter string
pageBefore string

Return Type

ArrayOfMetadataTeamsTokens

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.getTeamsTokens({
    pageSize: 2,
    pageAfter: 'page[after]',
    pageBefore: 'page[before]',
  });

  console.log(data);
})();

saveTeamsToken

Saves a teams token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.

  • HTTP Method: POST
  • Endpoint: /channels/teams/tokens

Parameters

Name Type Required Description
body TeamsToken The request body.

Return Type

TeamsToken

Example Usage Code Snippet

import { Client, TeamsToken } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const teamsTokenWebhook: TeamsTokenWebhook = {
    url: 'url',
  };

  const teamsToken: TeamsToken = {
    webhook: teamsTokenWebhook,
  };

  const { data } = await client.channels.saveTeamsToken(teamsToken);

  console.log(data);
})();

getTeamsToken

Retrieves details of a specific teams token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.

  • HTTP Method: GET
  • Endpoint: /channels/teams/tokens/{token_id}

Parameters

Name Type Required Description
tokenId string

Return Type

MetadataTeamsToken

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.getTeamsToken('token_id');

  console.log(data);
})();

discardTeamsToken

Revokes one of the authenticated user's teams tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.

  • HTTP Method: DELETE
  • Endpoint: /channels/teams/tokens/{token_id}

Parameters

Name Type Required Description
tokenId string

Return Type

DiscardResult

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.discardTeamsToken('token_id');

  console.log(data);
})();

getWebPushTokens

Lists all web_push tokens belonging to the authenticated user. Returns a paginated list of tokens, including their status, creation dates, and associated metadata.

  • HTTP Method: GET
  • Endpoint: /channels/web_push/tokens

Parameters

Name Type Required Description
pageSize number
pageAfter string
pageBefore string

Return Type

ArrayOfMetadataWebPushTokens

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.getWebPushTokens({
    pageSize: 5,
    pageAfter: 'page[after]',
    pageBefore: 'page[before]',
  });

  console.log(data);
})();

saveWebPushToken

Saves a web_push token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.

  • HTTP Method: POST
  • Endpoint: /channels/web_push/tokens

Parameters

Name Type Required Description
body WebPushToken The request body.

Return Type

WebPushToken

Example Usage Code Snippet

import { Client, WebPushToken } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const keys: Keys = {
    auth: 'auth',
    p256dh: 'p256dh',
  };

  const webPushToken: WebPushToken = {
    endpoint: 'endpoint',
    keys: keys,
  };

  const { data } = await client.channels.saveWebPushToken(webPushToken);

  console.log(data);
})();

getWebPushToken

Retrieves details of a specific web_push token belonging to the authenticated user. Returns information about the token's status, creation date, and any associated metadata. Users can only access their own tokens.

  • HTTP Method: GET
  • Endpoint: /channels/web_push/tokens/{token_id}

Parameters

Name Type Required Description
tokenId string

Return Type

MetadataWebPushToken

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.getWebPushToken('token_id');

  console.log(data);
})();

discardWebPushToken

Revokes one of the authenticated user's web_push tokens. This permanently invalidates the specified token, preventing it from being used for future channel access. This action cannot be undone. Users can only revoke their own tokens.

  • HTTP Method: DELETE
  • Endpoint: /channels/web_push/tokens/{token_id}

Parameters

Name Type Required Description
tokenId string

Return Type

DiscardResult

Example Usage Code Snippet

import { Client } from '@magicbell/user-client';

(async () => {
  const client = new Client({
    token: 'YOUR_TOKEN',
  });

  const { data } = await client.channels.discardWebPushToken('token_id');

  console.log(data);
})();