@naturali/sdk 0.234.0 → 0.236.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.
package/dist/index.cjs CHANGED
@@ -920,6 +920,7 @@ var Channels = class {
920
920
  *
921
921
  * Connect a channel. The required fields depend on `channel`; no credential is ever returned.
922
922
  * **Discord** (`channel: discord`) — supply `application_id` and `bot_token`, plus the `modes` selecting which Gateway flows to serve (direct messages, and/or @mention-opens-a-thread). The token is checked with Discord first: `400 invalid_bot_token` when Discord rejects it, `400 application_mismatch` when it belongs to another application, `502 discord_unavailable` when Discord cannot be read. Returns `501` when this deployment does not enable Discord channels.
923
+ * **X** (`channel: x`) — supply the bot's `bot_token` (X developer portal, Chat bots) and the `consumer_key` and `consumer_secret` of the app that issued it. naturali then registers its own webhook on that app, subscribes it to the bot's incoming direct messages and registers the bot's chat encryption key, keeping the private key sealed: replies are end-to-end encrypted, and the project never handles keys, webhooks or ciphertext. Pass `chat_private_keys` and `chat_key_version` instead to keep a key the bot already registered. `400 invalid_bot_token` or `400 invalid_consumer_credentials` when X rejects a credential, `409 bot_in_use` when another channel holds the bot, `502 x_provisioning_failed` when X refuses the webhook or the subscription (an app holds a limited number of webhooks), `429 x_key_registration_limited` when the bot used its few daily key registrations, `502 x_unavailable` when X cannot be reached. Returns `501` when this deployment does not enable X channels.
923
924
  * **WhatsApp** (default) — one of two credential paths, both filling the same write-only secret:
924
925
  * * **BYOT** (`credential_source: byot`, default) — supply
925
926
  * `phone_number_id` and `access_token` from your own Meta app. The
@@ -1027,7 +1028,7 @@ var Channels = class {
1027
1028
  * List the channel's conversations
1028
1029
  *
1029
1030
  * A cursor page of the channel's conversations, newest first. A conversation is one address's dialogue on the channel — the continuity anchor that resumes the same runtime session instead of starting fresh per message — so this is the read path for who has talked to the channel and which actor/session their dialogue resolved to.
1030
- * Conversations are created by the inbound path (the WhatsApp webhook, the Discord gateway worker) when a real message arrives; there is no way to create one directly.
1031
+ * Conversations are created by the inbound path (the WhatsApp and X webhooks, the Discord gateway worker) when a real message arrives; there is no way to create one directly.
1031
1032
  *
1032
1033
  */
1033
1034
  static listChannelConversations(options) {
package/dist/index.d.cts CHANGED
@@ -2603,7 +2603,7 @@ type ChannelKind = {
2603
2603
  /**
2604
2604
  * The channel kind.
2605
2605
  */
2606
- kind: 'whatsapp' | 'discord';
2606
+ kind: 'whatsapp' | 'discord' | 'x';
2607
2607
  /**
2608
2608
  * This kind's conversational shapes.
2609
2609
  */
@@ -2702,7 +2702,7 @@ type Channel = {
2702
2702
  /**
2703
2703
  * The channel kind.
2704
2704
  */
2705
- channel: 'whatsapp' | 'discord';
2705
+ channel: 'whatsapp' | 'discord' | 'x';
2706
2706
  status: 'active' | 'disabled';
2707
2707
  /**
2708
2708
  * How the credential was obtained.
@@ -2732,6 +2732,19 @@ type Channel = {
2732
2732
  */
2733
2733
  application_id: string | null;
2734
2734
  modes: DiscordModes;
2735
+ /**
2736
+ * X. The bot account's user id. Absent for other kinds.
2737
+ */
2738
+ bot_user_id?: string | null;
2739
+ /**
2740
+ * X. The bot account's handle, without `@`. Absent for other kinds.
2741
+ */
2742
+ username?: string | null;
2743
+ /**
2744
+ * X. The version of the bot's registered chat encryption key. Absent for other kinds.
2745
+ *
2746
+ */
2747
+ chat_key_version?: string | null;
2735
2748
  default: ChannelAction;
2736
2749
  /**
2737
2750
  * The most recent messages each conversation's session sends the model, taking precedence over the agent's own `max_context_messages`. Null defers to the agent.
@@ -2774,6 +2787,11 @@ type Channel = {
2774
2787
  * as a secret on the runtime; a deployment that does not enable Discord
2775
2788
  * channels returns `501`.
2776
2789
  *
2790
+ * * **x** — `bot_token`, `consumer_key` and `consumer_secret`
2791
+ * (write-only); naturali provisions the webhook, the subscription and
2792
+ * the bot's chat key. Optional `chat_private_keys` with
2793
+ * `chat_key_version` keep a key already registered.
2794
+ *
2777
2795
  * No credential value is ever returned. `default` is required — connecting a channel without saying what it does when nothing else matches is the misconfiguration, so it is caught here rather than discovered as silence in production.
2778
2796
  *
2779
2797
  */
@@ -2790,7 +2808,7 @@ type ChannelCreate = {
2790
2808
  *
2791
2809
  */
2792
2810
  max_context_messages?: number | null;
2793
- channel?: 'whatsapp' | 'discord';
2811
+ channel?: 'whatsapp' | 'discord' | 'x';
2794
2812
  /**
2795
2813
  * Required for `whatsapp`.
2796
2814
  */
@@ -2821,11 +2839,30 @@ type ChannelCreate = {
2821
2839
  */
2822
2840
  application_id?: string;
2823
2841
  /**
2824
- * Write-only. Required for `discord`. The bot token, sealed in naturali's encrypted store so the gateway worker can authenticate its WebSocket. Accepted on write, never returned.
2842
+ * Write-only. Required for `discord` and `x`. The bot token, sealed in naturali's encrypted store. Accepted on write, never returned.
2825
2843
  *
2826
2844
  */
2827
2845
  bot_token?: string;
2828
2846
  modes?: DiscordModes;
2847
+ /**
2848
+ * Write-only. Required for `x`. The consumer key (API key) of the X app that issued the bot. Accepted on write, never returned.
2849
+ *
2850
+ */
2851
+ consumer_key?: string;
2852
+ /**
2853
+ * Write-only. Required for `x`. The app's consumer secret; X signs webhook deliveries with it. Accepted on write, never returned.
2854
+ *
2855
+ */
2856
+ consumer_secret?: string;
2857
+ /**
2858
+ * Write-only. Optional for `x`, with `chat_key_version`: the bot's exported chat private keys (base64), to keep a key already registered instead of registering a new one.
2859
+ *
2860
+ */
2861
+ chat_private_keys?: string;
2862
+ /**
2863
+ * Optional for `x`, with `chat_private_keys`. The registered key's version.
2864
+ */
2865
+ chat_key_version?: string;
2829
2866
  };
2830
2867
  type WhatsAppSignupLink = {
2831
2868
  /**
@@ -2845,7 +2882,7 @@ type WhatsAppSignupComplete = {
2845
2882
  phone_number_id: string;
2846
2883
  };
2847
2884
  /**
2848
- * At least one field is required. For WhatsApp, `access_token` rotates the write-only credential; for Discord, `bot_token` rotates the sealed bot token (checked with Discord as on connect) and `modes` turns the gateway flows on or off. `default` replaces the channel's default action whole when present. The worker picks either change up on its next poll and reconnects.
2885
+ * At least one field is required. For WhatsApp, `access_token` rotates the write-only credential; for Discord, `bot_token` rotates the sealed bot token (checked with Discord as on connect) and `modes` turns the gateway flows on or off; for X, `bot_token` rotates the sealed token of the same bot. `default` replaces the channel's default action whole when present. The worker picks either change up on its next poll and reconnects.
2849
2886
  *
2850
2887
  */
2851
2888
  type ChannelUpdate = {
@@ -2862,7 +2899,7 @@ type ChannelUpdate = {
2862
2899
  waba_id?: string;
2863
2900
  credential_source?: 'byot' | 'embedded_signup';
2864
2901
  /**
2865
- * Discord. Write-only. Rotates the sealed bot token.
2902
+ * Discord or X. Write-only. Rotates the sealed bot token.
2866
2903
  */
2867
2904
  bot_token?: string;
2868
2905
  modes?: DiscordModes;
@@ -4956,7 +4993,7 @@ type OauthClientResourceProperties = {
4956
4993
  */
4957
4994
  token_endpoint_auth_method?: 'client_secret_basic' | 'client_secret_post';
4958
4995
  /**
4959
- * The callback registered with the provider. Omitted, the server's own `/v1/projects/{project_id}/oauth-connections/callback`.
4996
+ * The callback registered with the provider. Omitted or `null`, this API fills in its own `https://api.naturali.ai/v1/oauth/callback`, the URL to register with the provider.
4960
4997
  */
4961
4998
  redirect_uri?: string | null;
4962
4999
  /**
@@ -5660,6 +5697,7 @@ type ChannelResourceProperties = {
5660
5697
  credential_source?: string;
5661
5698
  pin?: string;
5662
5699
  application_id?: string;
5700
+ chat_key_version?: string;
5663
5701
  };
5664
5702
  /**
5665
5703
  * An MCP server serving a chosen set of the project's tools.
@@ -10641,6 +10679,10 @@ type ChannelResourcePropertiesWritable = {
10641
10679
  pin?: string;
10642
10680
  application_id?: string;
10643
10681
  bot_token?: string;
10682
+ consumer_key?: string;
10683
+ consumer_secret?: string;
10684
+ chat_private_keys?: string;
10685
+ chat_key_version?: string;
10644
10686
  };
10645
10687
  /**
10646
10688
  * An MCP server serving a chosen set of the project's tools.
@@ -10687,7 +10729,7 @@ type Cursor = string;
10687
10729
  */
10688
10730
  type TagsQuery = Array<string>;
10689
10731
  /**
10690
- * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`), URL-encoded.
10732
+ * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`, `x:dm:<user_id>`), URL-encoded.
10691
10733
  *
10692
10734
  */
10693
10735
  type Identifier = string;
@@ -11590,7 +11632,7 @@ type DeleteAddressData = {
11590
11632
  */
11591
11633
  project_id: string;
11592
11634
  /**
11593
- * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`), URL-encoded.
11635
+ * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`, `x:dm:<user_id>`), URL-encoded.
11594
11636
  *
11595
11637
  */
11596
11638
  identifier: string;
@@ -11628,7 +11670,7 @@ type GetAddressData = {
11628
11670
  */
11629
11671
  project_id: string;
11630
11672
  /**
11631
- * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`), URL-encoded.
11673
+ * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`, `x:dm:<user_id>`), URL-encoded.
11632
11674
  *
11633
11675
  */
11634
11676
  identifier: string;
@@ -11666,7 +11708,7 @@ type SetAddressData = {
11666
11708
  */
11667
11709
  project_id: string;
11668
11710
  /**
11669
- * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`), URL-encoded.
11711
+ * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`, `x:dm:<user_id>`), URL-encoded.
11670
11712
  *
11671
11713
  */
11672
11714
  identifier: string;
@@ -11717,7 +11759,7 @@ type ListAddressConversationsData = {
11717
11759
  */
11718
11760
  project_id: string;
11719
11761
  /**
11720
- * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`), URL-encoded.
11762
+ * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`, `x:dm:<user_id>`), URL-encoded.
11721
11763
  *
11722
11764
  */
11723
11765
  identifier: string;
@@ -15302,7 +15344,12 @@ type CreateChannelErrors = {
15302
15344
  */
15303
15345
  409: ErrorResponse;
15304
15346
  /**
15305
- * The requested path is not enabled on this deployment (e.g. embedded signup or a Discord channel where neither is enabled).
15347
+ * `x_key_registration_limited` — the X bot used its daily chat key registrations; `details.reset_at` says when it may register again.
15348
+ *
15349
+ */
15350
+ 429: ErrorResponse;
15351
+ /**
15352
+ * The requested path is not enabled on this deployment (e.g. embedded signup, or a Discord or X channel, where it is not enabled).
15306
15353
  *
15307
15354
  */
15308
15355
  501: ErrorResponse;
@@ -15349,7 +15396,7 @@ type CreateWhatsappSignupLinkErrors = {
15349
15396
  */
15350
15397
  404: ErrorResponse;
15351
15398
  /**
15352
- * The requested path is not enabled on this deployment (e.g. embedded signup or a Discord channel where neither is enabled).
15399
+ * The requested path is not enabled on this deployment (e.g. embedded signup, or a Discord or X channel, where it is not enabled).
15353
15400
  *
15354
15401
  */
15355
15402
  501: ErrorResponse;
@@ -15390,7 +15437,7 @@ type CompleteWhatsappSignupErrors = {
15390
15437
  */
15391
15438
  409: ErrorResponse;
15392
15439
  /**
15393
- * The requested path is not enabled on this deployment (e.g. embedded signup or a Discord channel where neither is enabled).
15440
+ * The requested path is not enabled on this deployment (e.g. embedded signup, or a Discord or X channel, where it is not enabled).
15394
15441
  *
15395
15442
  */
15396
15443
  501: ErrorResponse;
@@ -15555,7 +15602,7 @@ type ListChannelConversationsData = {
15555
15602
  */
15556
15603
  cursor?: string;
15557
15604
  /**
15558
- * Filter to one address by the identifier conversations carry (`discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`, `whatsapp:dm:<phone>`), in this channel's kind; any other form is `400`. At most one row matches.
15605
+ * Filter to one address by the identifier conversations carry (`discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`, `whatsapp:dm:<phone>`, `x:dm:<user_id>`), in this channel's kind; any other form is `400`. At most one row matches.
15559
15606
  *
15560
15607
  */
15561
15608
  identifier?: string;
@@ -15593,7 +15640,7 @@ type ListChannelConversationsResponse = ListChannelConversationsResponses[keyof
15593
15640
  type OpenChannelConversationData = {
15594
15641
  body: {
15595
15642
  /**
15596
- * The address identifier, in this channel's kind (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`); any other form is `400`.
15643
+ * The address identifier, in this channel's kind (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `x:dm:<user_id>`); any other form is `400`.
15597
15644
  */
15598
15645
  identifier: string;
15599
15646
  };
@@ -35665,6 +35712,7 @@ export declare class Channels {
35665
35712
  *
35666
35713
  * Connect a channel. The required fields depend on `channel`; no credential is ever returned.
35667
35714
  * **Discord** (`channel: discord`) — supply `application_id` and `bot_token`, plus the `modes` selecting which Gateway flows to serve (direct messages, and/or @mention-opens-a-thread). The token is checked with Discord first: `400 invalid_bot_token` when Discord rejects it, `400 application_mismatch` when it belongs to another application, `502 discord_unavailable` when Discord cannot be read. Returns `501` when this deployment does not enable Discord channels.
35715
+ * **X** (`channel: x`) — supply the bot's `bot_token` (X developer portal, Chat bots) and the `consumer_key` and `consumer_secret` of the app that issued it. naturali then registers its own webhook on that app, subscribes it to the bot's incoming direct messages and registers the bot's chat encryption key, keeping the private key sealed: replies are end-to-end encrypted, and the project never handles keys, webhooks or ciphertext. Pass `chat_private_keys` and `chat_key_version` instead to keep a key the bot already registered. `400 invalid_bot_token` or `400 invalid_consumer_credentials` when X rejects a credential, `409 bot_in_use` when another channel holds the bot, `502 x_provisioning_failed` when X refuses the webhook or the subscription (an app holds a limited number of webhooks), `429 x_key_registration_limited` when the bot used its few daily key registrations, `502 x_unavailable` when X cannot be reached. Returns `501` when this deployment does not enable X channels.
35668
35716
  * **WhatsApp** (default) — one of two credential paths, both filling the same write-only secret:
35669
35717
  * * **BYOT** (`credential_source: byot`, default) — supply
35670
35718
  * `phone_number_id` and `access_token` from your own Meta app. The
@@ -35730,7 +35778,7 @@ export declare class Channels {
35730
35778
  * List the channel's conversations
35731
35779
  *
35732
35780
  * A cursor page of the channel's conversations, newest first. A conversation is one address's dialogue on the channel — the continuity anchor that resumes the same runtime session instead of starting fresh per message — so this is the read path for who has talked to the channel and which actor/session their dialogue resolved to.
35733
- * Conversations are created by the inbound path (the WhatsApp webhook, the Discord gateway worker) when a real message arrives; there is no way to create one directly.
35781
+ * Conversations are created by the inbound path (the WhatsApp and X webhooks, the Discord gateway worker) when a real message arrives; there is no way to create one directly.
35734
35782
  *
35735
35783
  */
35736
35784
  static listChannelConversations<ThrowOnError extends boolean = false>(options: Options<ListChannelConversationsData, ThrowOnError>): RequestResult<ListChannelConversationsResponses, ListChannelConversationsErrors, ThrowOnError>;
package/dist/index.d.mts CHANGED
@@ -2603,7 +2603,7 @@ type ChannelKind = {
2603
2603
  /**
2604
2604
  * The channel kind.
2605
2605
  */
2606
- kind: 'whatsapp' | 'discord';
2606
+ kind: 'whatsapp' | 'discord' | 'x';
2607
2607
  /**
2608
2608
  * This kind's conversational shapes.
2609
2609
  */
@@ -2702,7 +2702,7 @@ type Channel = {
2702
2702
  /**
2703
2703
  * The channel kind.
2704
2704
  */
2705
- channel: 'whatsapp' | 'discord';
2705
+ channel: 'whatsapp' | 'discord' | 'x';
2706
2706
  status: 'active' | 'disabled';
2707
2707
  /**
2708
2708
  * How the credential was obtained.
@@ -2732,6 +2732,19 @@ type Channel = {
2732
2732
  */
2733
2733
  application_id: string | null;
2734
2734
  modes: DiscordModes;
2735
+ /**
2736
+ * X. The bot account's user id. Absent for other kinds.
2737
+ */
2738
+ bot_user_id?: string | null;
2739
+ /**
2740
+ * X. The bot account's handle, without `@`. Absent for other kinds.
2741
+ */
2742
+ username?: string | null;
2743
+ /**
2744
+ * X. The version of the bot's registered chat encryption key. Absent for other kinds.
2745
+ *
2746
+ */
2747
+ chat_key_version?: string | null;
2735
2748
  default: ChannelAction;
2736
2749
  /**
2737
2750
  * The most recent messages each conversation's session sends the model, taking precedence over the agent's own `max_context_messages`. Null defers to the agent.
@@ -2774,6 +2787,11 @@ type Channel = {
2774
2787
  * as a secret on the runtime; a deployment that does not enable Discord
2775
2788
  * channels returns `501`.
2776
2789
  *
2790
+ * * **x** — `bot_token`, `consumer_key` and `consumer_secret`
2791
+ * (write-only); naturali provisions the webhook, the subscription and
2792
+ * the bot's chat key. Optional `chat_private_keys` with
2793
+ * `chat_key_version` keep a key already registered.
2794
+ *
2777
2795
  * No credential value is ever returned. `default` is required — connecting a channel without saying what it does when nothing else matches is the misconfiguration, so it is caught here rather than discovered as silence in production.
2778
2796
  *
2779
2797
  */
@@ -2790,7 +2808,7 @@ type ChannelCreate = {
2790
2808
  *
2791
2809
  */
2792
2810
  max_context_messages?: number | null;
2793
- channel?: 'whatsapp' | 'discord';
2811
+ channel?: 'whatsapp' | 'discord' | 'x';
2794
2812
  /**
2795
2813
  * Required for `whatsapp`.
2796
2814
  */
@@ -2821,11 +2839,30 @@ type ChannelCreate = {
2821
2839
  */
2822
2840
  application_id?: string;
2823
2841
  /**
2824
- * Write-only. Required for `discord`. The bot token, sealed in naturali's encrypted store so the gateway worker can authenticate its WebSocket. Accepted on write, never returned.
2842
+ * Write-only. Required for `discord` and `x`. The bot token, sealed in naturali's encrypted store. Accepted on write, never returned.
2825
2843
  *
2826
2844
  */
2827
2845
  bot_token?: string;
2828
2846
  modes?: DiscordModes;
2847
+ /**
2848
+ * Write-only. Required for `x`. The consumer key (API key) of the X app that issued the bot. Accepted on write, never returned.
2849
+ *
2850
+ */
2851
+ consumer_key?: string;
2852
+ /**
2853
+ * Write-only. Required for `x`. The app's consumer secret; X signs webhook deliveries with it. Accepted on write, never returned.
2854
+ *
2855
+ */
2856
+ consumer_secret?: string;
2857
+ /**
2858
+ * Write-only. Optional for `x`, with `chat_key_version`: the bot's exported chat private keys (base64), to keep a key already registered instead of registering a new one.
2859
+ *
2860
+ */
2861
+ chat_private_keys?: string;
2862
+ /**
2863
+ * Optional for `x`, with `chat_private_keys`. The registered key's version.
2864
+ */
2865
+ chat_key_version?: string;
2829
2866
  };
2830
2867
  type WhatsAppSignupLink = {
2831
2868
  /**
@@ -2845,7 +2882,7 @@ type WhatsAppSignupComplete = {
2845
2882
  phone_number_id: string;
2846
2883
  };
2847
2884
  /**
2848
- * At least one field is required. For WhatsApp, `access_token` rotates the write-only credential; for Discord, `bot_token` rotates the sealed bot token (checked with Discord as on connect) and `modes` turns the gateway flows on or off. `default` replaces the channel's default action whole when present. The worker picks either change up on its next poll and reconnects.
2885
+ * At least one field is required. For WhatsApp, `access_token` rotates the write-only credential; for Discord, `bot_token` rotates the sealed bot token (checked with Discord as on connect) and `modes` turns the gateway flows on or off; for X, `bot_token` rotates the sealed token of the same bot. `default` replaces the channel's default action whole when present. The worker picks either change up on its next poll and reconnects.
2849
2886
  *
2850
2887
  */
2851
2888
  type ChannelUpdate = {
@@ -2862,7 +2899,7 @@ type ChannelUpdate = {
2862
2899
  waba_id?: string;
2863
2900
  credential_source?: 'byot' | 'embedded_signup';
2864
2901
  /**
2865
- * Discord. Write-only. Rotates the sealed bot token.
2902
+ * Discord or X. Write-only. Rotates the sealed bot token.
2866
2903
  */
2867
2904
  bot_token?: string;
2868
2905
  modes?: DiscordModes;
@@ -4956,7 +4993,7 @@ type OauthClientResourceProperties = {
4956
4993
  */
4957
4994
  token_endpoint_auth_method?: 'client_secret_basic' | 'client_secret_post';
4958
4995
  /**
4959
- * The callback registered with the provider. Omitted, the server's own `/v1/projects/{project_id}/oauth-connections/callback`.
4996
+ * The callback registered with the provider. Omitted or `null`, this API fills in its own `https://api.naturali.ai/v1/oauth/callback`, the URL to register with the provider.
4960
4997
  */
4961
4998
  redirect_uri?: string | null;
4962
4999
  /**
@@ -5660,6 +5697,7 @@ type ChannelResourceProperties = {
5660
5697
  credential_source?: string;
5661
5698
  pin?: string;
5662
5699
  application_id?: string;
5700
+ chat_key_version?: string;
5663
5701
  };
5664
5702
  /**
5665
5703
  * An MCP server serving a chosen set of the project's tools.
@@ -10641,6 +10679,10 @@ type ChannelResourcePropertiesWritable = {
10641
10679
  pin?: string;
10642
10680
  application_id?: string;
10643
10681
  bot_token?: string;
10682
+ consumer_key?: string;
10683
+ consumer_secret?: string;
10684
+ chat_private_keys?: string;
10685
+ chat_key_version?: string;
10644
10686
  };
10645
10687
  /**
10646
10688
  * An MCP server serving a chosen set of the project's tools.
@@ -10687,7 +10729,7 @@ type Cursor = string;
10687
10729
  */
10688
10730
  type TagsQuery = Array<string>;
10689
10731
  /**
10690
- * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`), URL-encoded.
10732
+ * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`, `x:dm:<user_id>`), URL-encoded.
10691
10733
  *
10692
10734
  */
10693
10735
  type Identifier = string;
@@ -11590,7 +11632,7 @@ type DeleteAddressData = {
11590
11632
  */
11591
11633
  project_id: string;
11592
11634
  /**
11593
- * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`), URL-encoded.
11635
+ * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`, `x:dm:<user_id>`), URL-encoded.
11594
11636
  *
11595
11637
  */
11596
11638
  identifier: string;
@@ -11628,7 +11670,7 @@ type GetAddressData = {
11628
11670
  */
11629
11671
  project_id: string;
11630
11672
  /**
11631
- * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`), URL-encoded.
11673
+ * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`, `x:dm:<user_id>`), URL-encoded.
11632
11674
  *
11633
11675
  */
11634
11676
  identifier: string;
@@ -11666,7 +11708,7 @@ type SetAddressData = {
11666
11708
  */
11667
11709
  project_id: string;
11668
11710
  /**
11669
- * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`), URL-encoded.
11711
+ * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`, `x:dm:<user_id>`), URL-encoded.
11670
11712
  *
11671
11713
  */
11672
11714
  identifier: string;
@@ -11717,7 +11759,7 @@ type ListAddressConversationsData = {
11717
11759
  */
11718
11760
  project_id: string;
11719
11761
  /**
11720
- * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`), URL-encoded.
11762
+ * The prefixed, self-describing channel identifier (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`, `x:dm:<user_id>`), URL-encoded.
11721
11763
  *
11722
11764
  */
11723
11765
  identifier: string;
@@ -15302,7 +15344,12 @@ type CreateChannelErrors = {
15302
15344
  */
15303
15345
  409: ErrorResponse;
15304
15346
  /**
15305
- * The requested path is not enabled on this deployment (e.g. embedded signup or a Discord channel where neither is enabled).
15347
+ * `x_key_registration_limited` — the X bot used its daily chat key registrations; `details.reset_at` says when it may register again.
15348
+ *
15349
+ */
15350
+ 429: ErrorResponse;
15351
+ /**
15352
+ * The requested path is not enabled on this deployment (e.g. embedded signup, or a Discord or X channel, where it is not enabled).
15306
15353
  *
15307
15354
  */
15308
15355
  501: ErrorResponse;
@@ -15349,7 +15396,7 @@ type CreateWhatsappSignupLinkErrors = {
15349
15396
  */
15350
15397
  404: ErrorResponse;
15351
15398
  /**
15352
- * The requested path is not enabled on this deployment (e.g. embedded signup or a Discord channel where neither is enabled).
15399
+ * The requested path is not enabled on this deployment (e.g. embedded signup, or a Discord or X channel, where it is not enabled).
15353
15400
  *
15354
15401
  */
15355
15402
  501: ErrorResponse;
@@ -15390,7 +15437,7 @@ type CompleteWhatsappSignupErrors = {
15390
15437
  */
15391
15438
  409: ErrorResponse;
15392
15439
  /**
15393
- * The requested path is not enabled on this deployment (e.g. embedded signup or a Discord channel where neither is enabled).
15440
+ * The requested path is not enabled on this deployment (e.g. embedded signup, or a Discord or X channel, where it is not enabled).
15394
15441
  *
15395
15442
  */
15396
15443
  501: ErrorResponse;
@@ -15555,7 +15602,7 @@ type ListChannelConversationsData = {
15555
15602
  */
15556
15603
  cursor?: string;
15557
15604
  /**
15558
- * Filter to one address by the identifier conversations carry (`discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`, `whatsapp:dm:<phone>`), in this channel's kind; any other form is `400`. At most one row matches.
15605
+ * Filter to one address by the identifier conversations carry (`discord:dm:<user_id>`, `discord:thread:<guild_id>:<channel_id>`, `whatsapp:dm:<phone>`, `x:dm:<user_id>`), in this channel's kind; any other form is `400`. At most one row matches.
15559
15606
  *
15560
15607
  */
15561
15608
  identifier?: string;
@@ -15593,7 +15640,7 @@ type ListChannelConversationsResponse = ListChannelConversationsResponses[keyof
15593
15640
  type OpenChannelConversationData = {
15594
15641
  body: {
15595
15642
  /**
15596
- * The address identifier, in this channel's kind (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`); any other form is `400`.
15643
+ * The address identifier, in this channel's kind (`whatsapp:dm:<phone>`, `discord:dm:<user_id>`, `x:dm:<user_id>`); any other form is `400`.
15597
15644
  */
15598
15645
  identifier: string;
15599
15646
  };
@@ -35665,6 +35712,7 @@ export declare class Channels {
35665
35712
  *
35666
35713
  * Connect a channel. The required fields depend on `channel`; no credential is ever returned.
35667
35714
  * **Discord** (`channel: discord`) — supply `application_id` and `bot_token`, plus the `modes` selecting which Gateway flows to serve (direct messages, and/or @mention-opens-a-thread). The token is checked with Discord first: `400 invalid_bot_token` when Discord rejects it, `400 application_mismatch` when it belongs to another application, `502 discord_unavailable` when Discord cannot be read. Returns `501` when this deployment does not enable Discord channels.
35715
+ * **X** (`channel: x`) — supply the bot's `bot_token` (X developer portal, Chat bots) and the `consumer_key` and `consumer_secret` of the app that issued it. naturali then registers its own webhook on that app, subscribes it to the bot's incoming direct messages and registers the bot's chat encryption key, keeping the private key sealed: replies are end-to-end encrypted, and the project never handles keys, webhooks or ciphertext. Pass `chat_private_keys` and `chat_key_version` instead to keep a key the bot already registered. `400 invalid_bot_token` or `400 invalid_consumer_credentials` when X rejects a credential, `409 bot_in_use` when another channel holds the bot, `502 x_provisioning_failed` when X refuses the webhook or the subscription (an app holds a limited number of webhooks), `429 x_key_registration_limited` when the bot used its few daily key registrations, `502 x_unavailable` when X cannot be reached. Returns `501` when this deployment does not enable X channels.
35668
35716
  * **WhatsApp** (default) — one of two credential paths, both filling the same write-only secret:
35669
35717
  * * **BYOT** (`credential_source: byot`, default) — supply
35670
35718
  * `phone_number_id` and `access_token` from your own Meta app. The
@@ -35730,7 +35778,7 @@ export declare class Channels {
35730
35778
  * List the channel's conversations
35731
35779
  *
35732
35780
  * A cursor page of the channel's conversations, newest first. A conversation is one address's dialogue on the channel — the continuity anchor that resumes the same runtime session instead of starting fresh per message — so this is the read path for who has talked to the channel and which actor/session their dialogue resolved to.
35733
- * Conversations are created by the inbound path (the WhatsApp webhook, the Discord gateway worker) when a real message arrives; there is no way to create one directly.
35781
+ * Conversations are created by the inbound path (the WhatsApp and X webhooks, the Discord gateway worker) when a real message arrives; there is no way to create one directly.
35734
35782
  *
35735
35783
  */
35736
35784
  static listChannelConversations<ThrowOnError extends boolean = false>(options: Options<ListChannelConversationsData, ThrowOnError>): RequestResult<ListChannelConversationsResponses, ListChannelConversationsErrors, ThrowOnError>;
package/dist/index.mjs CHANGED
@@ -919,6 +919,7 @@ var Channels = class {
919
919
  *
920
920
  * Connect a channel. The required fields depend on `channel`; no credential is ever returned.
921
921
  * **Discord** (`channel: discord`) — supply `application_id` and `bot_token`, plus the `modes` selecting which Gateway flows to serve (direct messages, and/or @mention-opens-a-thread). The token is checked with Discord first: `400 invalid_bot_token` when Discord rejects it, `400 application_mismatch` when it belongs to another application, `502 discord_unavailable` when Discord cannot be read. Returns `501` when this deployment does not enable Discord channels.
922
+ * **X** (`channel: x`) — supply the bot's `bot_token` (X developer portal, Chat bots) and the `consumer_key` and `consumer_secret` of the app that issued it. naturali then registers its own webhook on that app, subscribes it to the bot's incoming direct messages and registers the bot's chat encryption key, keeping the private key sealed: replies are end-to-end encrypted, and the project never handles keys, webhooks or ciphertext. Pass `chat_private_keys` and `chat_key_version` instead to keep a key the bot already registered. `400 invalid_bot_token` or `400 invalid_consumer_credentials` when X rejects a credential, `409 bot_in_use` when another channel holds the bot, `502 x_provisioning_failed` when X refuses the webhook or the subscription (an app holds a limited number of webhooks), `429 x_key_registration_limited` when the bot used its few daily key registrations, `502 x_unavailable` when X cannot be reached. Returns `501` when this deployment does not enable X channels.
922
923
  * **WhatsApp** (default) — one of two credential paths, both filling the same write-only secret:
923
924
  * * **BYOT** (`credential_source: byot`, default) — supply
924
925
  * `phone_number_id` and `access_token` from your own Meta app. The
@@ -1026,7 +1027,7 @@ var Channels = class {
1026
1027
  * List the channel's conversations
1027
1028
  *
1028
1029
  * A cursor page of the channel's conversations, newest first. A conversation is one address's dialogue on the channel — the continuity anchor that resumes the same runtime session instead of starting fresh per message — so this is the read path for who has talked to the channel and which actor/session their dialogue resolved to.
1029
- * Conversations are created by the inbound path (the WhatsApp webhook, the Discord gateway worker) when a real message arrives; there is no way to create one directly.
1030
+ * Conversations are created by the inbound path (the WhatsApp and X webhooks, the Discord gateway worker) when a real message arrives; there is no way to create one directly.
1030
1031
  *
1031
1032
  */
1032
1033
  static listChannelConversations(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/sdk",
3
- "version": "0.234.0",
3
+ "version": "0.236.0",
4
4
  "description": "TypeScript SDK for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "keywords": [
6
6
  "naturali",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@hey-api/openapi-ts": "^0.99.0",
41
- "@naturali/api": "0.234.0",
41
+ "@naturali/api": "0.236.0",
42
42
  "@ttoss/openapi-codegen": "^0.10.1",
43
43
  "@types/node": "^26.5.1",
44
44
  "tsdown": "^0.23.0",