@base44-preview/sdk 0.8.23-pr.153.716511b → 0.8.23-pr.154.5b2229d

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.
@@ -65,6 +65,16 @@ export function createAgentsModule({ axios, getSocket, appId, serverUrl, token,
65
65
  return baseUrl;
66
66
  }
67
67
  };
68
+ const getTelegramConnectURL = (agentName) => {
69
+ const baseUrl = `${serverUrl}/api/apps/${appId}/agents/${encodeURIComponent(agentName)}/telegram`;
70
+ const accessToken = token !== null && token !== void 0 ? token : getAccessToken();
71
+ if (accessToken) {
72
+ return `${baseUrl}?token=${accessToken}`;
73
+ }
74
+ else {
75
+ return baseUrl;
76
+ }
77
+ };
68
78
  return {
69
79
  getConversations,
70
80
  getConversation,
@@ -73,5 +83,6 @@ export function createAgentsModule({ axios, getSocket, appId, serverUrl, token,
73
83
  addMessage,
74
84
  subscribeToConversation,
75
85
  getWhatsAppConnectURL,
86
+ getTelegramConnectURL,
76
87
  };
77
88
  }
@@ -374,4 +374,24 @@ export interface AgentsModule {
374
374
  * ```
375
375
  */
376
376
  getWhatsAppConnectURL(agentName: AgentName): string;
377
+ /**
378
+ * Gets Telegram connection URL for an agent.
379
+ *
380
+ * Generates a URL that users can use to connect with the agent through Telegram.
381
+ * The URL includes authentication if a token is available. When the user opens
382
+ * this URL, they are redirected to the agent's Telegram bot with an activation
383
+ * code that securely links their account.
384
+ *
385
+ * @param agentName - The name of the agent.
386
+ * @returns Telegram connection URL.
387
+ *
388
+ * @example
389
+ * ```typescript
390
+ * // Get Telegram connection URL
391
+ * const telegramUrl = base44.agents.getTelegramConnectURL('support-agent');
392
+ * console.log(`Connect through Telegram: ${telegramUrl}`);
393
+ * // User can open this URL to start a Telegram conversation
394
+ * ```
395
+ */
396
+ getTelegramConnectURL(agentName: AgentName): string;
377
397
  }
@@ -65,7 +65,7 @@ function createEntityHandler(axios, appId, entityName, getSocket) {
65
65
  params.skip = skip;
66
66
  if (fields)
67
67
  params.fields = Array.isArray(fields) ? fields.join(",") : fields;
68
- return axios.get(baseURL, { params, headers: { 'Accept-Encoding': 'identity' } });
68
+ return axios.get(baseURL, { params });
69
69
  },
70
70
  // Filter entities based on query
71
71
  async filter(query, sort, limit, skip, fields) {
@@ -80,7 +80,7 @@ function createEntityHandler(axios, appId, entityName, getSocket) {
80
80
  params.skip = skip;
81
81
  if (fields)
82
82
  params.fields = Array.isArray(fields) ? fields.join(",") : fields;
83
- return axios.get(baseURL, { params, headers: { 'Accept-Encoding': 'identity' } });
83
+ return axios.get(baseURL, { params });
84
84
  },
85
85
  // Get entity by ID
86
86
  async get(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.23-pr.153.716511b",
3
+ "version": "0.8.23-pr.154.5b2229d",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",