stream-chat 9.31.0 → 9.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ import { WSConnectionFallback } from './connection_fallback';
8
8
  import { Campaign } from './campaign';
9
9
  import { ChannelBatchUpdater } from './channel_batch_updater';
10
10
  import { Segment } from './segment';
11
- import type { ActiveLiveLocationsAPIResponse, APIErrorResponse, APIResponse, AppSettings, AppSettingsAPIResponse, BannedUsersFilters, BannedUsersPaginationOptions, BannedUsersResponse, BannedUsersSort, BanUserOptions, BaseDeviceFields, BlockList, BlockListResponse, BlockUserAPIResponse, CampaignData, CampaignFilters, CampaignQueryOptions, CampaignResponse, CampaignSort, CastVoteAPIResponse, ChannelAPIResponse, ChannelData, ChannelFilters, ChannelMute, ChannelOptions, ChannelResponse, ChannelSort, ChannelStateOptions, CheckPushResponse, CheckSNSResponse, CheckSQSResponse, Configs, ConnectAPIResponse, CreateChannelOptions, CreateChannelResponse, CreateCommandOptions, CreateCommandResponse, CreateImportOptions, CreateImportResponse, CreateImportURLResponse, CreatePollAPIResponse, CreatePollData, CreatePollOptionAPIResponse, CreatePredefinedFilterOptions, CreateReminderOptions, CustomPermissionOptions, DeactivateUsersOptions, DeleteCommandResponse, DeleteMessageOptions, DeleteUserOptions, Device, DeviceIdentifier, DraftFilters, DraftSort, EndpointName, Event, EventAPIResponse, EventHandler, ExportChannelOptions, ExportChannelRequest, ExportChannelResponse, ExportChannelStatusResponse, ExportUsersRequest, ExportUsersResponse, FlagMessageResponse, FlagReportsFilters, FlagReportsPaginationOptions, FlagReportsResponse, FlagsFilters, FlagsPaginationOptions, FlagsResponse, FlagUserResponse, FutureChannelBansResponse, GetBlockedUsersAPIResponse, GetCampaignOptions, GetChannelTypeResponse, GetCommandResponse, GetHookEventsResponse, GetImportResponse, GetMessageOptions, GetPollAPIResponse, GetRateLimitsResponse, GetThreadAPIResponse, GetThreadOptions, GetUnreadCountAPIResponse, GetUnreadCountBatchAPIResponse, ListChannelResponse, ListCommandsResponse, ListImportsPaginationOptions, ListImportsResponse, ListPredefinedFiltersOptions, ListPredefinedFiltersResponse, LocalMessage, Logger, MarkChannelsReadOptions, MarkDeliveredOptions, MessageFilters, MessageFlagsFilters, MessageFlagsPaginationOptions, MessageFlagsResponse, MessageResponse, Mute, MuteUserOptions, MuteUserResponse, OGAttachment, OwnUserResponse, Pager, PartialMessageUpdate, PartialPollUpdate, PartialThreadUpdate, PartialUserUpdate, PermissionAPIResponse, PermissionsAPIResponse, PollAnswersAPIResponse, PollData, PollOptionData, PollSort, PollVote, PollVoteData, PollVotesAPIResponse, PredefinedFilterResponse, Product, PushPreference, PushProvider, PushProviderConfig, PushProviderID, PushProviderListResponse, PushProviderUpsertResponse, QueryDraftsResponse, QueryFutureChannelBansOptions, QueryMessageHistoryFilters, QueryMessageHistoryOptions, QueryMessageHistoryResponse, QueryMessageHistorySort, QueryPollsFilters, QueryPollsOptions, QueryPollsResponse, QueryReactionsAPIResponse, QueryReactionsOptions, QueryRemindersOptions, QueryRemindersResponse, QuerySegmentsOptions, QuerySegmentTargetsFilter, QueryThreadsOptions, QueryVotesFilters, QueryVotesOptions, ReactionFilters, ReactionResponse, ReactionSort, ReactivateUserOptions, ReactivateUsersOptions, ReminderAPIResponse, ReviewFlagReportOptions, ReviewFlagReportResponse, SdkIdentifier, SearchAPIResponse, SearchOptions, SegmentData, SegmentResponse, SegmentTargetsResponse, SegmentType, SendFileAPIResponse, SharedLocationResponse, SortParam, StreamChatOptions, SyncOptions, SyncResponse, TaskResponse, TaskStatus, TestPushDataInput, TestSNSDataInput, TestSQSDataInput, TokenOrProvider, TranslateResponse, UnBanUserOptions, UpdateChannelsBatchOptions, UpdateChannelTypeRequest, UpdateChannelTypeResponse, UpdateCommandOptions, UpdateCommandResponse, UpdateLocationPayload, UpdateMessageAPIResponse, UpdateMessageOptions, UpdatePollAPIResponse, UpdatePredefinedFilterOptions, UpdateReminderOptions, UpdateSegmentData, UpdateUsersAPIResponse, UpsertPushPreferencesResponse, UserCustomEvent, UserFilters, UserOptions, UserResponse, UserSort, VoteSort } from './types';
11
+ import type { ActiveLiveLocationsAPIResponse, APIErrorResponse, APIResponse, AppSettings, AppSettingsAPIResponse, BannedUsersFilters, BannedUsersPaginationOptions, BannedUsersResponse, BannedUsersSort, BanUserOptions, BaseDeviceFields, BlockList, BlockListResponse, BlockUserAPIResponse, CampaignData, CampaignFilters, CampaignQueryOptions, CampaignResponse, CampaignSort, CastVoteAPIResponse, ChannelAPIResponse, ChannelData, ChannelFilters, ChannelMute, ChannelOptions, ChannelResponse, ChannelSort, ChannelStateOptions, CheckPushResponse, CheckSNSResponse, CheckSQSResponse, Configs, ConnectAPIResponse, CreateChannelOptions, CreateChannelResponse, CreateCommandOptions, CreateCommandResponse, CreateImportOptions, CreateImportResponse, CreateImportURLResponse, CreatePollAPIResponse, CreatePollData, CreatePollOptionAPIResponse, CreatePredefinedFilterOptions, CreateReminderOptions, CustomPermissionOptions, DeactivateUsersOptions, DeleteCommandResponse, DeleteMessageOptions, DeleteUserOptions, Device, DeviceIdentifier, DraftFilters, DraftSort, EndpointName, Event, EventAPIResponse, EventHandler, ExportChannelOptions, ExportChannelRequest, ExportChannelResponse, ExportChannelStatusResponse, ExportUsersRequest, ExportUsersResponse, FlagMessageResponse, FlagReportsFilters, FlagReportsPaginationOptions, FlagReportsResponse, FlagsFilters, FlagsPaginationOptions, FlagsResponse, FlagUserResponse, FutureChannelBansResponse, GetBlockedUsersAPIResponse, GetCampaignOptions, GetChannelTypeResponse, GetCommandResponse, GetHookEventsResponse, GetImportResponse, GetMessageOptions, GetPollAPIResponse, GetRateLimitsResponse, GetThreadAPIResponse, GetThreadOptions, GetUnreadCountAPIResponse, GetUnreadCountBatchAPIResponse, ListChannelResponse, ListCommandsResponse, ListImportsPaginationOptions, ListImportsResponse, ListPredefinedFiltersOptions, ListPredefinedFiltersResponse, LocalMessage, Logger, MarkChannelsReadOptions, MarkDeliveredOptions, MessageFilters, MessageFlagsFilters, MessageFlagsPaginationOptions, MessageFlagsResponse, MessageResponse, Mute, MuteUserOptions, MuteUserResponse, OGAttachment, OwnUserResponse, Pager, PartialMessageUpdate, PartialPollUpdate, PartialThreadUpdate, PartialUserUpdate, PermissionAPIResponse, PermissionsAPIResponse, PollAnswersAPIResponse, PollData, PollOptionData, PollSort, PollVote, PollVoteData, PollVotesAPIResponse, PredefinedFilterResponse, Product, PushPreference, PushProvider, PushProviderConfig, PushProviderID, PushProviderListResponse, PushProviderUpsertResponse, QueryDraftsResponse, QueryFutureChannelBansOptions, QueryMessageHistoryFilters, QueryMessageHistoryOptions, QueryMessageHistoryResponse, QueryMessageHistorySort, QueryPollsFilters, QueryPollsOptions, QueryPollsResponse, QueryReactionsAPIResponse, QueryReactionsOptions, QueryRemindersOptions, QueryRemindersResponse, QuerySegmentsOptions, QuerySegmentTargetsFilter, QueryTeamUsageStatsOptions, QueryTeamUsageStatsResponse, QueryThreadsOptions, QueryVotesFilters, QueryVotesOptions, ReactionFilters, ReactionResponse, ReactionSort, ReactivateUserOptions, ReactivateUsersOptions, ReminderAPIResponse, ReviewFlagReportOptions, ReviewFlagReportResponse, SdkIdentifier, SearchAPIResponse, SearchOptions, SegmentData, SegmentResponse, SegmentTargetsResponse, SegmentType, SendFileAPIResponse, SharedLocationResponse, SortParam, StreamChatOptions, SyncOptions, SyncResponse, TaskResponse, TaskStatus, TestPushDataInput, TestSNSDataInput, TestSQSDataInput, TokenOrProvider, TranslateResponse, UnBanUserOptions, UpdateChannelsBatchOptions, UpdateChannelTypeRequest, UpdateChannelTypeResponse, UpdateCommandOptions, UpdateCommandResponse, UpdateLocationPayload, UpdateMessageAPIResponse, UpdateMessageOptions, UpdatePollAPIResponse, UpdatePredefinedFilterOptions, UpdateReminderOptions, UpdateSegmentData, UpdateUsersAPIResponse, UpsertPushPreferencesResponse, UserCustomEvent, UserFilters, UserOptions, UserResponse, UserSort, VoteSort } from './types';
12
12
  import { ErrorFromResponse } from './types';
13
13
  import { InsightMetrics } from './insights';
14
14
  import { Thread } from './thread';
@@ -1018,6 +1018,7 @@ export declare class StreamChat {
1018
1018
  latest_reactions?: ReactionResponse[];
1019
1019
  member?: import("./types").ChannelMemberResponse;
1020
1020
  mentioned_users?: UserResponse[];
1021
+ mentioned_channel?: boolean;
1021
1022
  message_text_updated_at?: string;
1022
1023
  moderation?: import("./types").ModerationResponse;
1023
1024
  moderation_details?: import("./types").ModerationDetailsResponse;
@@ -1711,6 +1712,7 @@ export declare class StreamChat {
1711
1712
  latest_reactions?: ReactionResponse[];
1712
1713
  member?: import("./types").ChannelMemberResponse;
1713
1714
  mentioned_users?: UserResponse[];
1715
+ mentioned_channel?: boolean;
1714
1716
  message_text_updated_at?: string;
1715
1717
  moderation?: import("./types").ModerationResponse;
1716
1718
  moderation_details?: import("./types").ModerationDetailsResponse;
@@ -1930,6 +1932,22 @@ export declare class StreamChat {
1930
1932
  * @returns {Promise<QueryRemindersResponse>}
1931
1933
  */
1932
1934
  queryReminders({ filter, sort, ...rest }?: QueryRemindersOptions): Promise<QueryRemindersResponse>;
1935
+ /**
1936
+ * queryTeamUsageStats - Queries team-level usage statistics from the warehouse database
1937
+ *
1938
+ * Returns all 16 metrics grouped by team with cursor-based pagination.
1939
+ *
1940
+ * Date Range Options (mutually exclusive):
1941
+ * - Use 'month' parameter (YYYY-MM format) for monthly aggregated values
1942
+ * - Use 'start_date'/'end_date' parameters (YYYY-MM-DD format) for daily breakdown
1943
+ * - If neither provided, defaults to current month (monthly mode)
1944
+ *
1945
+ * This endpoint is server-side only.
1946
+ *
1947
+ * @param {QueryTeamUsageStatsOptions} options The options for querying team usage stats
1948
+ * @returns {Promise<QueryTeamUsageStatsResponse>}
1949
+ */
1950
+ queryTeamUsageStats(options?: QueryTeamUsageStatsOptions): Promise<QueryTeamUsageStatsResponse>;
1933
1951
  /**
1934
1952
  * updateLocation - Updates a location
1935
1953
  *
@@ -1,5 +1,5 @@
1
1
  import type { Attachment, SharedLocationResponse } from '../types';
2
- import type { AudioAttachment, FileAttachment, ImageAttachment, LocalAttachment, LocalAudioAttachment, LocalFileAttachment, LocalImageAttachment, LocalUploadAttachment, LocalVideoAttachment, LocalVoiceRecordingAttachment, UploadedAttachment, VideoAttachment, VoiceRecordingAttachment } from './types';
2
+ import type { AudioAttachment, FileAttachment, GiphyAttachment, ImageAttachment, LocalAttachment, LocalAudioAttachment, LocalFileAttachment, LocalImageAttachment, LocalUploadAttachment, LocalVideoAttachment, LocalVoiceRecordingAttachment, UploadedAttachment, VideoAttachment, VoiceRecordingAttachment } from './types';
3
3
  export declare const isScrapedContent: (attachment: Attachment) => boolean;
4
4
  export declare const isLocalAttachment: (attachment: unknown) => attachment is LocalAttachment;
5
5
  export declare const isLocalUploadAttachment: (attachment: unknown) => attachment is LocalUploadAttachment;
@@ -15,3 +15,4 @@ export declare const isVideoAttachment: (attachment: Attachment | LocalAttachmen
15
15
  export declare const isLocalVideoAttachment: (attachment: Attachment | LocalAttachment) => attachment is LocalVideoAttachment;
16
16
  export declare const isUploadedAttachment: (attachment: Attachment) => attachment is UploadedAttachment;
17
17
  export declare const isSharedLocationResponse: (location: unknown) => location is SharedLocationResponse;
18
+ export declare const isGiphyAttachment: (attachment: Attachment) => attachment is GiphyAttachment;
@@ -21,12 +21,12 @@ export declare class CommandSearchSource extends BaseSearchSourceSync<CommandSug
21
21
  };
22
22
  query(searchQuery: string): {
23
23
  items: {
24
- id: "all" | "mute" | "unmute" | "giphy" | "ban" | "fun_set" | "moderation_set" | "unban";
24
+ id: "all" | "giphy" | "mute" | "unmute" | "ban" | "fun_set" | "moderation_set" | "unban";
25
25
  created_at?: string | undefined;
26
26
  updated_at?: string | undefined;
27
27
  args?: string;
28
28
  description?: string;
29
- name: "all" | "mute" | "unmute" | "giphy" | "ban" | "fun_set" | "moderation_set" | "unban";
29
+ name: "all" | "giphy" | "mute" | "unmute" | "ban" | "fun_set" | "moderation_set" | "unban";
30
30
  set?: import("../../..").CommandVariants;
31
31
  }[];
32
32
  next: null;
@@ -1,4 +1,4 @@
1
- import type { Attachment, FileUploadConfig } from '../types';
1
+ import type { Attachment, FileUploadConfig, GiphyData } from '../types';
2
2
  export type LocalAttachment = AnyLocalAttachment | LocalUploadAttachment;
3
3
  export type LocalUploadAttachment = LocalFileAttachment | LocalImageAttachment | LocalAudioAttachment | LocalVideoAttachment | LocalVoiceRecordingAttachment;
4
4
  export type LocalVoiceRecordingAttachment<CustomLocalMetadata = Record<string, unknown>> = LocalAttachmentCast<VoiceRecordingAttachment, LocalAttachmentUploadMetadata & CustomLocalMetadata>;
@@ -50,6 +50,13 @@ export type ImageAttachment = Attachment & {
50
50
  original_height?: number;
51
51
  original_width?: number;
52
52
  };
53
+ export type GiphyAttachment = Attachment & {
54
+ type: 'giphy';
55
+ giphy?: GiphyData;
56
+ title?: string;
57
+ title_link?: string;
58
+ thumbnail_url?: string;
59
+ };
53
60
  export type BaseLocalAttachmentMetadata = {
54
61
  id: string;
55
62
  };
@@ -626,6 +626,7 @@ export type MessageResponseBase = MessageBase & {
626
626
  latest_reactions?: ReactionResponse[];
627
627
  member?: ChannelMemberResponse;
628
628
  mentioned_users?: UserResponse[];
629
+ mentioned_channel?: boolean;
629
630
  message_text_updated_at?: string;
630
631
  moderation?: ModerationResponse;
631
632
  moderation_details?: ModerationDetailsResponse;
@@ -955,6 +956,7 @@ export type CreateChannelOptions = {
955
956
  url_enrichment?: boolean;
956
957
  user_message_reminders?: boolean;
957
958
  count_messages?: boolean;
959
+ push_level?: 'all' | 'all_mentions' | 'direct_mentions' | 'mentions' | 'none';
958
960
  };
959
961
  export type CreateCommandOptions = {
960
962
  description: string;
@@ -1051,6 +1053,7 @@ export type UpdateChannelTypeRequest = Partial<{
1051
1053
  uploads?: boolean;
1052
1054
  url_enrichment?: boolean;
1053
1055
  count_messages?: boolean;
1056
+ push_level?: 'all' | 'all_mentions' | 'direct_mentions' | 'mentions' | 'none';
1054
1057
  };
1055
1058
  export type UpdateChannelTypeResponse = {
1056
1059
  automod: Automod;
@@ -1091,6 +1094,7 @@ export type UpdateChannelTypeResponse = {
1091
1094
  partition_ttl?: string;
1092
1095
  count_messages?: boolean;
1093
1096
  user_message_reminders?: boolean;
1097
+ push_level?: string;
1094
1098
  };
1095
1099
  export type GetChannelTypeResponse = {
1096
1100
  automod: Automod;
@@ -1131,6 +1135,7 @@ export type GetChannelTypeResponse = {
1131
1135
  partition_ttl?: string;
1132
1136
  count_messages?: boolean;
1133
1137
  user_message_reminders?: boolean;
1138
+ push_level?: string;
1134
1139
  };
1135
1140
  export type UpdateChannelOptions = Partial<{
1136
1141
  accept_invite: boolean;
@@ -2109,8 +2114,8 @@ type GiphyVersionInfo = {
2109
2114
  frames?: string;
2110
2115
  size?: string;
2111
2116
  };
2112
- type GiphyVersions = 'original' | 'fixed_height' | 'fixed_height_still' | 'fixed_height_downsampled' | 'fixed_width' | 'fixed_width_still' | 'fixed_width_downsampled';
2113
- type GiphyData = {
2117
+ export type GiphyVersions = 'original' | 'fixed_height' | 'fixed_height_still' | 'fixed_height_downsampled' | 'fixed_width' | 'fixed_width_still' | 'fixed_width_downsampled';
2118
+ export type GiphyData = {
2114
2119
  [key in GiphyVersions]: GiphyVersionInfo;
2115
2120
  };
2116
2121
  export type HuaweiConfig = {
@@ -2129,6 +2134,7 @@ export type Logger = (logLevel: LogLevel, message: string, extraData?: Record<st
2129
2134
  export type Message = Partial<MessageBase & {
2130
2135
  mentioned_users: string[];
2131
2136
  shared_location?: StaticLocationPayload | LiveLocationPayload;
2137
+ mentioned_channel?: boolean;
2132
2138
  }>;
2133
2139
  export type MessageBase = CustomMessageData & {
2134
2140
  id: string;
@@ -3462,4 +3468,100 @@ export type PredefinedFilterSort = SortParam[];
3462
3468
  export type ListPredefinedFiltersOptions = Pager & {
3463
3469
  sort?: PredefinedFilterSort;
3464
3470
  };
3471
+ /**
3472
+ * Team Usage Stats Types
3473
+ */
3474
+ /**
3475
+ * Represents a metric value for a specific date
3476
+ */
3477
+ export type DailyValue = {
3478
+ /** Date in YYYY-MM-DD format */
3479
+ date: string;
3480
+ /** Metric value for this date */
3481
+ value: number;
3482
+ };
3483
+ /**
3484
+ * Statistics for a single metric with optional daily breakdown
3485
+ */
3486
+ export type MetricStats = {
3487
+ /** Per-day values (only present in daily mode) */
3488
+ daily?: DailyValue[];
3489
+ /** Aggregated total value */
3490
+ total: number;
3491
+ };
3492
+ /**
3493
+ * Usage statistics for a single team containing all 16 metrics
3494
+ */
3495
+ export type TeamUsageStats = {
3496
+ /** Team identifier (empty string for users not assigned to any team) */
3497
+ team: string;
3498
+ /** Daily active users */
3499
+ users_daily: MetricStats;
3500
+ /** Daily messages sent */
3501
+ messages_daily: MetricStats;
3502
+ /** Daily translations */
3503
+ translations_daily: MetricStats;
3504
+ /** Daily image moderations */
3505
+ image_moderations_daily: MetricStats;
3506
+ /** Peak concurrent users */
3507
+ concurrent_users: MetricStats;
3508
+ /** Peak concurrent connections */
3509
+ concurrent_connections: MetricStats;
3510
+ /** Total users */
3511
+ users_total: MetricStats;
3512
+ /** Users active in last 24 hours */
3513
+ users_last_24_hours: MetricStats;
3514
+ /** MAU - users active in last 30 days */
3515
+ users_last_30_days: MetricStats;
3516
+ /** Users active this month */
3517
+ users_month_to_date: MetricStats;
3518
+ /** Engaged MAU */
3519
+ users_engaged_last_30_days: MetricStats;
3520
+ /** Engaged users this month */
3521
+ users_engaged_month_to_date: MetricStats;
3522
+ /** Total messages */
3523
+ messages_total: MetricStats;
3524
+ /** Messages in last 24 hours */
3525
+ messages_last_24_hours: MetricStats;
3526
+ /** Messages in last 30 days */
3527
+ messages_last_30_days: MetricStats;
3528
+ /** Messages this month */
3529
+ messages_month_to_date: MetricStats;
3530
+ };
3531
+ /**
3532
+ * Options for querying team-level usage statistics
3533
+ */
3534
+ export type QueryTeamUsageStatsOptions = {
3535
+ /**
3536
+ * Month in YYYY-MM format (e.g., '2026-01').
3537
+ * Mutually exclusive with start_date/end_date.
3538
+ * Returns aggregated monthly values.
3539
+ */
3540
+ month?: string;
3541
+ /**
3542
+ * Start date in YYYY-MM-DD format.
3543
+ * Used with end_date for custom date range.
3544
+ * Returns daily breakdown.
3545
+ */
3546
+ start_date?: string;
3547
+ /**
3548
+ * End date in YYYY-MM-DD format.
3549
+ * Used with start_date for custom date range.
3550
+ * Returns daily breakdown.
3551
+ */
3552
+ end_date?: string;
3553
+ /** Maximum number of teams to return per page (default: 30, max: 30) */
3554
+ limit?: number;
3555
+ /** Cursor for pagination to fetch next page of teams */
3556
+ next?: string;
3557
+ };
3558
+ /**
3559
+ * Response containing team-level usage statistics
3560
+ */
3561
+ export type QueryTeamUsageStatsResponse = APIResponse & {
3562
+ /** Array of team usage statistics */
3563
+ teams: TeamUsageStats[];
3564
+ /** Cursor for pagination to fetch next page */
3565
+ next?: string;
3566
+ };
3465
3567
  export {};
@@ -121,6 +121,7 @@ export declare const toDeletedMessage: ({ message, deletedAt, hardDelete, }: {
121
121
  } | undefined;
122
122
  deleted_reply_count?: number | undefined;
123
123
  member?: import("./types").ChannelMemberResponse | undefined;
124
+ mentioned_channel?: boolean | undefined;
124
125
  message_text_updated_at?: string | undefined;
125
126
  moderation?: import("./types").ModerationResponse | undefined;
126
127
  moderation_details?: import("./types").ModerationDetailsResponse | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat",
3
- "version": "9.31.0",
3
+ "version": "9.32.0",
4
4
  "description": "JS SDK for the Stream Chat API",
5
5
  "homepage": "https://getstream.io/chat/",
6
6
  "author": {
package/src/client.ts CHANGED
@@ -181,6 +181,8 @@ import type {
181
181
  QueryRemindersResponse,
182
182
  QuerySegmentsOptions,
183
183
  QuerySegmentTargetsFilter,
184
+ QueryTeamUsageStatsOptions,
185
+ QueryTeamUsageStatsResponse,
184
186
  QueryThreadsAPIResponse,
185
187
  QueryThreadsOptions,
186
188
  QueryVotesFilters,
@@ -4748,6 +4750,28 @@ export class StreamChat {
4748
4750
  });
4749
4751
  }
4750
4752
 
4753
+ /**
4754
+ * queryTeamUsageStats - Queries team-level usage statistics from the warehouse database
4755
+ *
4756
+ * Returns all 16 metrics grouped by team with cursor-based pagination.
4757
+ *
4758
+ * Date Range Options (mutually exclusive):
4759
+ * - Use 'month' parameter (YYYY-MM format) for monthly aggregated values
4760
+ * - Use 'start_date'/'end_date' parameters (YYYY-MM-DD format) for daily breakdown
4761
+ * - If neither provided, defaults to current month (monthly mode)
4762
+ *
4763
+ * This endpoint is server-side only.
4764
+ *
4765
+ * @param {QueryTeamUsageStatsOptions} options The options for querying team usage stats
4766
+ * @returns {Promise<QueryTeamUsageStatsResponse>}
4767
+ */
4768
+ async queryTeamUsageStats(options: QueryTeamUsageStatsOptions = {}) {
4769
+ return await this.post<QueryTeamUsageStatsResponse>(
4770
+ `${this.baseURL}/stats/team_usage`,
4771
+ options,
4772
+ );
4773
+ }
4774
+
4751
4775
  /**
4752
4776
  * updateLocation - Updates a location
4753
4777
  *
@@ -2,6 +2,7 @@ import type { Attachment, SharedLocationResponse } from '../types';
2
2
  import type {
3
3
  AudioAttachment,
4
4
  FileAttachment,
5
+ GiphyAttachment,
5
6
  ImageAttachment,
6
7
  LocalAttachment,
7
8
  LocalAudioAttachment,
@@ -97,3 +98,7 @@ export const isSharedLocationResponse = (
97
98
  !!(location as SharedLocationResponse).latitude &&
98
99
  !!(location as SharedLocationResponse).longitude &&
99
100
  !!(location as SharedLocationResponse).channel_cid;
101
+
102
+ export const isGiphyAttachment = (
103
+ attachment: Attachment,
104
+ ): attachment is GiphyAttachment => attachment.type === 'giphy';
@@ -1,4 +1,4 @@
1
- import type { Attachment, FileUploadConfig } from '../types';
1
+ import type { Attachment, FileUploadConfig, GiphyData } from '../types';
2
2
 
3
3
  export type LocalAttachment = AnyLocalAttachment | LocalUploadAttachment;
4
4
 
@@ -99,6 +99,14 @@ export type ImageAttachment = Attachment & {
99
99
  original_width?: number;
100
100
  };
101
101
 
102
+ export type GiphyAttachment = Attachment & {
103
+ type: 'giphy';
104
+ giphy?: GiphyData;
105
+ title?: string;
106
+ title_link?: string;
107
+ thumbnail_url?: string;
108
+ };
109
+
102
110
  export type BaseLocalAttachmentMetadata = {
103
111
  id: string;
104
112
  };
package/src/types.ts CHANGED
@@ -743,6 +743,7 @@ export type MessageResponseBase = MessageBase & {
743
743
  latest_reactions?: ReactionResponse[];
744
744
  member?: ChannelMemberResponse;
745
745
  mentioned_users?: UserResponse[];
746
+ mentioned_channel?: boolean;
746
747
  message_text_updated_at?: string;
747
748
  moderation?: ModerationResponse; // present only with Moderation v2
748
749
  moderation_details?: ModerationDetailsResponse; // present only with Moderation v1
@@ -1110,6 +1111,7 @@ export type CreateChannelOptions = {
1110
1111
  url_enrichment?: boolean;
1111
1112
  user_message_reminders?: boolean;
1112
1113
  count_messages?: boolean;
1114
+ push_level?: 'all' | 'all_mentions' | 'direct_mentions' | 'mentions' | 'none';
1113
1115
  };
1114
1116
 
1115
1117
  export type CreateCommandOptions = {
@@ -1217,6 +1219,7 @@ export type UpdateChannelTypeRequest =
1217
1219
  uploads?: boolean;
1218
1220
  url_enrichment?: boolean;
1219
1221
  count_messages?: boolean;
1222
+ push_level?: 'all' | 'all_mentions' | 'direct_mentions' | 'mentions' | 'none';
1220
1223
  };
1221
1224
 
1222
1225
  export type UpdateChannelTypeResponse = {
@@ -1258,6 +1261,7 @@ export type UpdateChannelTypeResponse = {
1258
1261
  partition_ttl?: string;
1259
1262
  count_messages?: boolean;
1260
1263
  user_message_reminders?: boolean;
1264
+ push_level?: string;
1261
1265
  };
1262
1266
 
1263
1267
  export type GetChannelTypeResponse = {
@@ -1299,6 +1303,7 @@ export type GetChannelTypeResponse = {
1299
1303
  partition_ttl?: string;
1300
1304
  count_messages?: boolean;
1301
1305
  user_message_reminders?: boolean;
1306
+ push_level?: string;
1302
1307
  };
1303
1308
 
1304
1309
  export type UpdateChannelOptions = Partial<{
@@ -2809,7 +2814,7 @@ type GiphyVersionInfo = {
2809
2814
  size?: string;
2810
2815
  };
2811
2816
 
2812
- type GiphyVersions =
2817
+ export type GiphyVersions =
2813
2818
  | 'original'
2814
2819
  | 'fixed_height'
2815
2820
  | 'fixed_height_still'
@@ -2818,7 +2823,7 @@ type GiphyVersions =
2818
2823
  | 'fixed_width_still'
2819
2824
  | 'fixed_width_downsampled';
2820
2825
 
2821
- type GiphyData = {
2826
+ export type GiphyData = {
2822
2827
  [key in GiphyVersions]: GiphyVersionInfo;
2823
2828
  };
2824
2829
 
@@ -2848,6 +2853,7 @@ export type Message = Partial<
2848
2853
  MessageBase & {
2849
2854
  mentioned_users: string[];
2850
2855
  shared_location?: StaticLocationPayload | LiveLocationPayload;
2856
+ mentioned_channel?: boolean;
2851
2857
  }
2852
2858
  >;
2853
2859
 
@@ -4708,3 +4714,111 @@ export type PredefinedFilterSort = SortParam[];
4708
4714
  export type ListPredefinedFiltersOptions = Pager & {
4709
4715
  sort?: PredefinedFilterSort;
4710
4716
  };
4717
+
4718
+ /**
4719
+ * Team Usage Stats Types
4720
+ */
4721
+
4722
+ /**
4723
+ * Represents a metric value for a specific date
4724
+ */
4725
+ export type DailyValue = {
4726
+ /** Date in YYYY-MM-DD format */
4727
+ date: string;
4728
+ /** Metric value for this date */
4729
+ value: number;
4730
+ };
4731
+
4732
+ /**
4733
+ * Statistics for a single metric with optional daily breakdown
4734
+ */
4735
+ export type MetricStats = {
4736
+ /** Per-day values (only present in daily mode) */
4737
+ daily?: DailyValue[];
4738
+ /** Aggregated total value */
4739
+ total: number;
4740
+ };
4741
+
4742
+ /**
4743
+ * Usage statistics for a single team containing all 16 metrics
4744
+ */
4745
+ export type TeamUsageStats = {
4746
+ /** Team identifier (empty string for users not assigned to any team) */
4747
+ team: string;
4748
+
4749
+ // Daily activity metrics (total = SUM of daily values)
4750
+ /** Daily active users */
4751
+ users_daily: MetricStats;
4752
+ /** Daily messages sent */
4753
+ messages_daily: MetricStats;
4754
+ /** Daily translations */
4755
+ translations_daily: MetricStats;
4756
+ /** Daily image moderations */
4757
+ image_moderations_daily: MetricStats;
4758
+
4759
+ // Peak metrics (total = MAX of daily values)
4760
+ /** Peak concurrent users */
4761
+ concurrent_users: MetricStats;
4762
+ /** Peak concurrent connections */
4763
+ concurrent_connections: MetricStats;
4764
+
4765
+ // Rolling/cumulative metrics (total = LATEST daily value)
4766
+ /** Total users */
4767
+ users_total: MetricStats;
4768
+ /** Users active in last 24 hours */
4769
+ users_last_24_hours: MetricStats;
4770
+ /** MAU - users active in last 30 days */
4771
+ users_last_30_days: MetricStats;
4772
+ /** Users active this month */
4773
+ users_month_to_date: MetricStats;
4774
+ /** Engaged MAU */
4775
+ users_engaged_last_30_days: MetricStats;
4776
+ /** Engaged users this month */
4777
+ users_engaged_month_to_date: MetricStats;
4778
+ /** Total messages */
4779
+ messages_total: MetricStats;
4780
+ /** Messages in last 24 hours */
4781
+ messages_last_24_hours: MetricStats;
4782
+ /** Messages in last 30 days */
4783
+ messages_last_30_days: MetricStats;
4784
+ /** Messages this month */
4785
+ messages_month_to_date: MetricStats;
4786
+ };
4787
+
4788
+ /**
4789
+ * Options for querying team-level usage statistics
4790
+ */
4791
+ export type QueryTeamUsageStatsOptions = {
4792
+ /**
4793
+ * Month in YYYY-MM format (e.g., '2026-01').
4794
+ * Mutually exclusive with start_date/end_date.
4795
+ * Returns aggregated monthly values.
4796
+ */
4797
+ month?: string;
4798
+ /**
4799
+ * Start date in YYYY-MM-DD format.
4800
+ * Used with end_date for custom date range.
4801
+ * Returns daily breakdown.
4802
+ */
4803
+ start_date?: string;
4804
+ /**
4805
+ * End date in YYYY-MM-DD format.
4806
+ * Used with start_date for custom date range.
4807
+ * Returns daily breakdown.
4808
+ */
4809
+ end_date?: string;
4810
+ /** Maximum number of teams to return per page (default: 30, max: 30) */
4811
+ limit?: number;
4812
+ /** Cursor for pagination to fetch next page of teams */
4813
+ next?: string;
4814
+ };
4815
+
4816
+ /**
4817
+ * Response containing team-level usage statistics
4818
+ */
4819
+ export type QueryTeamUsageStatsResponse = APIResponse & {
4820
+ /** Array of team usage statistics */
4821
+ teams: TeamUsageStats[];
4822
+ /** Cursor for pagination to fetch next page */
4823
+ next?: string;
4824
+ };