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
requestParameters GetMobilePushApnsTokensParameters Request Parameters Object

Return Type

ArrayOfMetadataApnsTokens

Example Usage Code Snippet

import com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.ArrayOfMetadataApnsTokens;
import com.magicbell.magicbelluserclient.models.GetMobilePushApnsTokensParameters;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val requestParameters: GetMobilePushApnsTokensParameters = GetMobilePushApnsTokensParameters.builder()
			.pageSize(8L)
			.pageAfter("page[after]")
			.pageBefore("page[before]")
			.build();

    val response: ArrayOfMetadataApnsTokens = magicbellUserClient.channels.getMobilePushApnsTokens(requestParameters);

    println(response);
}

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
apnsToken ApnsToken Request Body

Return Type

ApnsToken

Example Usage Code Snippet

import com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.ApnsToken;
import com.magicbell.magicbelluserclient.models.ApnsTokenInstallationId;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val apnsToken: ApnsToken = ApnsToken.builder()
			.appId("app_id")
			.deviceToken("fugiat ullamco ")
			.installationId(ApnsTokenInstallationId.DEVELOPMENT)
			.build();

    val response: ApnsToken = magicbellUserClient.channels.saveMobilePushApnsToken(apnsToken);

    println(response);
}

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 com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.MetadataApnsToken;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val response: MetadataApnsToken = magicbellUserClient.channels.getMobilePushApnsToken("token_id");

    println(response);
}

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 com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.DiscardResult;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val response: DiscardResult = magicbellUserClient.channels.discardMobilePushApnsToken("token_id");

    println(response);
}

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
requestParameters GetMobilePushExpoTokensParameters Request Parameters Object

Return Type

ArrayOfMetadataExpoTokens

Example Usage Code Snippet

import com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.ArrayOfMetadataExpoTokens;
import com.magicbell.magicbelluserclient.models.GetMobilePushExpoTokensParameters;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val requestParameters: GetMobilePushExpoTokensParameters = GetMobilePushExpoTokensParameters.builder()
			.pageSize(8L)
			.pageAfter("page[after]")
			.pageBefore("page[before]")
			.build();

    val response: ArrayOfMetadataExpoTokens = magicbellUserClient.channels.getMobilePushExpoTokens(requestParameters);

    println(response);
}

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
expoToken ExpoToken Request Body

Return Type

ExpoToken

Example Usage Code Snippet

import com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.ExpoToken;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val expoToken: ExpoToken = ExpoToken.builder()
			.deviceToken("device_token")
			.build();

    val response: ExpoToken = magicbellUserClient.channels.saveMobilePushExpoToken(expoToken);

    println(response);
}

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 com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.MetadataExpoToken;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val response: MetadataExpoToken = magicbellUserClient.channels.getMobilePushExpoToken("token_id");

    println(response);
}

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 com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.DiscardResult;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val response: DiscardResult = magicbellUserClient.channels.discardMobilePushExpoToken("token_id");

    println(response);
}

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
requestParameters GetMobilePushFcmTokensParameters Request Parameters Object

Return Type

ArrayOfMetadataFcmTokens

Example Usage Code Snippet

import com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.ArrayOfMetadataFcmTokens;
import com.magicbell.magicbelluserclient.models.GetMobilePushFcmTokensParameters;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val requestParameters: GetMobilePushFcmTokensParameters = GetMobilePushFcmTokensParameters.builder()
			.pageSize(7L)
			.pageAfter("page[after]")
			.pageBefore("page[before]")
			.build();

    val response: ArrayOfMetadataFcmTokens = magicbellUserClient.channels.getMobilePushFcmTokens(requestParameters);

    println(response);
}

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
fcmToken FcmToken Request Body

Return Type

FcmToken

Example Usage Code Snippet

import com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.FcmToken;
import com.magicbell.magicbelluserclient.models.FcmTokenInstallationId;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val fcmToken: FcmToken = FcmToken.builder()
			.deviceToken("velit dolor adi")
			.installationId(FcmTokenInstallationId.DEVELOPMENT)
			.build();

    val response: FcmToken = magicbellUserClient.channels.saveMobilePushFcmToken(fcmToken);

    println(response);
}

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 com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.MetadataFcmToken;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val response: MetadataFcmToken = magicbellUserClient.channels.getMobilePushFcmToken("token_id");

    println(response);
}

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 com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.DiscardResult;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val response: DiscardResult = magicbellUserClient.channels.discardMobilePushFcmToken("token_id");

    println(response);
}

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
requestParameters GetSlackTokensParameters Request Parameters Object

Return Type

ArrayOfMetadataSlackTokens

Example Usage Code Snippet

import com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.ArrayOfMetadataSlackTokens;
import com.magicbell.magicbelluserclient.models.GetSlackTokensParameters;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val requestParameters: GetSlackTokensParameters = GetSlackTokensParameters.builder()
			.pageSize(5L)
			.pageAfter("page[after]")
			.pageBefore("page[before]")
			.build();

    val response: ArrayOfMetadataSlackTokens = magicbellUserClient.channels.getSlackTokens(requestParameters);

    println(response);
}

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
slackToken SlackToken Request Body

Return Type

SlackToken

Example Usage Code Snippet

import com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.Oauth;
import com.magicbell.magicbelluserclient.models.SlackToken;
import com.magicbell.magicbelluserclient.models.SlackTokenWebhook;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val oauth: Oauth = Oauth.builder()
			.channelId("channel_id")
			.installationId("installation_id")
			.scope("scope")
			.build();

		val slackTokenWebhook: SlackTokenWebhook = SlackTokenWebhook.builder()
			.url("url")
			.build();

		val slackToken: SlackToken = SlackToken.builder()
			.oauth(oauth)
			.webhook(slackTokenWebhook)
			.build();

    val response: SlackToken = magicbellUserClient.channels.saveSlackToken(slackToken);

    println(response);
}

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 com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.MetadataSlackToken;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val response: MetadataSlackToken = magicbellUserClient.channels.getSlackToken("token_id");

    println(response);
}

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 com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.DiscardResult;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val response: DiscardResult = magicbellUserClient.channels.discardSlackToken("token_id");

    println(response);
}

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
requestParameters GetTeamsTokensParameters Request Parameters Object

Return Type

ArrayOfMetadataTeamsTokens

Example Usage Code Snippet

import com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.ArrayOfMetadataTeamsTokens;
import com.magicbell.magicbelluserclient.models.GetTeamsTokensParameters;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val requestParameters: GetTeamsTokensParameters = GetTeamsTokensParameters.builder()
			.pageSize(6L)
			.pageAfter("page[after]")
			.pageBefore("page[before]")
			.build();

    val response: ArrayOfMetadataTeamsTokens = magicbellUserClient.channels.getTeamsTokens(requestParameters);

    println(response);
}

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
teamsToken TeamsToken Request Body

Return Type

TeamsToken

Example Usage Code Snippet

import com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.TeamsToken;
import com.magicbell.magicbelluserclient.models.TeamsTokenWebhook;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val teamsTokenWebhook: TeamsTokenWebhook = TeamsTokenWebhook.builder()
			.url("url")
			.build();

		val teamsToken: TeamsToken = TeamsToken.builder()
			.webhook(teamsTokenWebhook)
			.build();

    val response: TeamsToken = magicbellUserClient.channels.saveTeamsToken(teamsToken);

    println(response);
}

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 com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.MetadataTeamsToken;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val response: MetadataTeamsToken = magicbellUserClient.channels.getTeamsToken("token_id");

    println(response);
}

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 com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.DiscardResult;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val response: DiscardResult = magicbellUserClient.channels.discardTeamsToken("token_id");

    println(response);
}

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
requestParameters GetWebPushTokensParameters Request Parameters Object

Return Type

ArrayOfMetadataWebPushTokens

Example Usage Code Snippet

import com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.ArrayOfMetadataWebPushTokens;
import com.magicbell.magicbelluserclient.models.GetWebPushTokensParameters;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val requestParameters: GetWebPushTokensParameters = GetWebPushTokensParameters.builder()
			.pageSize(6L)
			.pageAfter("page[after]")
			.pageBefore("page[before]")
			.build();

    val response: ArrayOfMetadataWebPushTokens = magicbellUserClient.channels.getWebPushTokens(requestParameters);

    println(response);
}

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
webPushToken WebPushToken Request Body

Return Type

WebPushToken

Example Usage Code Snippet

import com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.Keys;
import com.magicbell.magicbelluserclient.models.WebPushToken;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val keys: Keys = Keys.builder()
			.auth("auth")
			.p256dh("p256dh")
			.build();

		val webPushToken: WebPushToken = WebPushToken.builder()
			.endpoint("endpoint")
			.keys(keys)
			.build();

    val response: WebPushToken = magicbellUserClient.channels.saveWebPushToken(webPushToken);

    println(response);
}

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 com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.MetadataWebPushToken;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val response: MetadataWebPushToken = magicbellUserClient.channels.getWebPushToken("token_id");

    println(response);
}

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 com.magicbell.magicbelluserclient.MagicbellUserClient;
import com.magicbell.magicbelluserclient.config.MagicbellUserClientConfig;
import com.magicbell.magicbelluserclient.models.DiscardResult;

fun main() {
	val config: MagicbellUserClientConfig = MagicbellUserClientConfig.builder()
			.accessToken("YOUR_ACCESS_TOKEN")
			.build();

    val magicbellUserClient: MagicbellUserClient = MagicbellUserClient(config);

    val response: DiscardResult = magicbellUserClient.channels.discardWebPushToken("token_id");

    println(response);
}