@scryme/chat 2.91.28 → 2.91.43

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.
Files changed (2) hide show
  1. package/README.md +66 -27
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,16 +1,17 @@
1
1
  # Scryme Chat TypeScript SDK (`@scryme/chat`)
2
2
 
3
- A high-performance, developer-friendly, fully typed TypeScript/JavaScript SDK for interacting with the Skyrme Chat V2 and V3 Enterprise APIs.
3
+ A high-performance, developer-friendly, fully typed TypeScript/JavaScript SDK for interacting with the Scryme Chat V2 and V3 Enterprise APIs.
4
4
 
5
- Designed primarily for backend integrations, servers, and automated Machine-to-Machine (M2M) environments, this SDK provides unmatched DX with automatic OAuth2 token management, dynamic API proxying, and fluent nested helper chains.
5
+ Designed primarily for backend integrations, servers, and automated Machine-to-Machine (M2M) environments, this SDK provides unmatched DX with automatic OAuth2 token management, dynamic API proxying, custom message builders, and fluent nested helper chains.
6
6
 
7
7
  ---
8
8
 
9
9
  ## Features
10
10
 
11
11
  - **OAuth2 Client Credentials Grant**: Built-in, fully automated caching and renewal of M2M access tokens with timing-safe, proactive expiration buffers.
12
- - **Dynamic Method Proxying (`sdk.raw`)**: Automatic injection of Bearer token and Base URL headers into any of the 100+ generated V3 API endpoints with complete TypeScript autocompletion.
13
- - **Fluent Nested Namespaces**: High-level, developer-friendly helper routes (`sdk.workspace`, `sdk.channel`, `sdk.message`, etc.) for seamless workspace, department, team, and member administration.
12
+ - **Dynamic Method Proxying (`sdk.raw`)**: Automatic injection of Bearer token and Base URL headers into any of the generated V3 API endpoints with complete TypeScript autocompletion.
13
+ - **Fluent Nested Namespaces**: High-level, developer-friendly helper routes (`sdk.workspace`, `sdk.channel`, `sdk.message`, `sdk.webhooks`, `sdk.bot`) for seamless workspace, department, team, and member administration.
14
+ - **Custom Message Builders**: Type-safe helpers (`createCustomMessageSchema`, `createFormCustomMessageSchema`) for generating node-based interactive in-chat forms, surveys, and approval cards.
14
15
  - **Isomorphic Support**: Works out-of-the-box in Node.js, Next.js (server/client), Vite, and React Native.
15
16
 
16
17
  ---
@@ -114,35 +115,73 @@ const channel = await sdk.workspace.channels.create('acme-corp', {
114
115
  metadata: { department: 'eng' },
115
116
  });
116
117
 
117
- // Update channel settings, visibility, and metadata
118
- await sdk.channel.update('acme-corp', 'channel_id_123', {
119
- name: 'eng-tech',
120
- description: 'Updated description',
121
- icon: 'terminal',
122
- metadata: { priority: 'high' },
118
+ // Send a message to a channel with interactive buttons
119
+ await sdk.channel.message.create('channel_id_123', {
120
+ content: 'Please approve the deployment request',
121
+ messageType: 'approval',
122
+ metadata: {
123
+ callbackUrl: 'https://my-app.example.com/api/actions/callback',
124
+ },
125
+ actions: [
126
+ { actionId: 'approve', label: 'Approve', style: 'primary' },
127
+ { actionId: 'reject', label: 'Reject', style: 'danger' }
128
+ ]
123
129
  });
124
130
 
125
- // Manage channel member access and permissions
126
- await sdk.channel.members.add('acme-corp', 'channel_id_123', {
127
- userIds: ['user_456'],
128
- role: 'moderator',
129
- permissions: '2048',
130
- });
131
+ // Fetch channel messages
132
+ const messages = await sdk.channel.message.list('channel_id_123', { limit: 10 });
133
+ ```
131
134
 
132
- await sdk.channel.members.update('acme-corp', 'channel_id_123', 'user_456', {
133
- role: 'admin',
134
- permissions: '4096',
135
+ #### Webhooks Management
136
+ ```typescript
137
+ // List workspace webhooks
138
+ const webhooks = await sdk.webhooks.list('acme-corp');
139
+
140
+ // Create outgoing workspace webhook
141
+ const newWebhook = await sdk.webhooks.create('acme-corp', {
142
+ name: 'CI Notifier',
143
+ url: 'https://my-app.example.com/api/webhooks',
144
+ events: ['message.sent', 'message.action_response'],
135
145
  });
146
+ ```
147
+
148
+ ---
136
149
 
137
- await sdk.channel.members.remove('acme-corp', 'channel_id_123', 'user_456');
150
+ ### Custom Message Builders
138
151
 
139
- // Send a message to a channel
140
- await sdk.channel.message.create('channel_id_123', {
141
- content: 'Hello Team! This is automated via our new TS SDK 🚀',
152
+ Use `@scryme/chat` custom message builders to construct rich, interactive forms and surveys to attach to messages:
153
+
154
+ ```typescript
155
+ import { createFormCustomMessageSchema } from '@scryme/chat';
156
+
157
+ const feedbackSchema = createFormCustomMessageSchema({
158
+ title: 'Quarterly Team Feedback',
159
+ description: 'Please submit your thoughts on team performance',
160
+ icon: 'HelpCircle',
161
+ inputs: [
162
+ {
163
+ id: 'rating',
164
+ label: 'Performance Rating (1-5)',
165
+ placeholder: 'Enter 1 to 5',
166
+ required: true,
167
+ },
168
+ {
169
+ id: 'comments',
170
+ label: 'Additional Comments',
171
+ placeholder: 'Optional feedback...',
172
+ multiline: true,
173
+ }
174
+ ],
175
+ submitLabel: 'Send Feedback',
176
+ callbackId: 'team-feedback-submit',
142
177
  });
143
178
 
144
- // Fetch channel messages
145
- const messages = await sdk.channel.message.list('channel_id_123', { limit: 10 });
179
+ // Send the custom form message to a channel
180
+ await sdk.channel.message.create('channel_id_123', {
181
+ content: 'New feedback survey',
182
+ messageType: 'custom',
183
+ metadata: feedbackSchema,
184
+ });
146
185
  ```
147
186
 
148
187
  ---
@@ -165,7 +204,7 @@ const users = await sdk.raw.usersControllerSearchUsers({ q: 'alice' });
165
204
 
166
205
  // Fully typed update workspace webhook call
167
206
  const webhook = await sdk.raw.v3WebhooksControllerCreateWebhook('acme-corp', {
168
- name: 'Slack Sync Sync',
207
+ name: 'Slack Sync',
169
208
  url: 'https://hooks.slack.com/services/...',
170
209
  events: ['message.created'],
171
210
  });
@@ -189,4 +228,4 @@ pnpm test
189
228
 
190
229
  ## License
191
230
 
192
- MIT © Skyrme Chat Enterprise
231
+ MIT © Scryme Chat Enterprise
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scryme/chat",
3
- "version": "2.91.28",
3
+ "version": "2.91.43",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"