diff --git a/.changeset/manifest-user-connections.md b/.changeset/manifest-user-connections.md new file mode 100644 index 000000000..27ad8bedf --- /dev/null +++ b/.changeset/manifest-user-connections.md @@ -0,0 +1,5 @@ +--- +"@slack/web-api": minor +--- + +feat: add the `user_connections` feature (`is_enabled`, `auth_hosts`) and the `user_connection` and `user_connection_status_requested` events to the app manifest types diff --git a/packages/web-api/src/types/request/manifest.ts b/packages/web-api/src/types/request/manifest.ts index afe338dba..b52ea290d 100644 --- a/packages/web-api/src/types/request/manifest.ts +++ b/packages/web-api/src/types/request/manifest.ts @@ -83,6 +83,11 @@ interface ManifestFeatures { * @see {@link https://docs.slack.dev/messaging/unfurling-links-in-messages Link unfurling: configuring domains}. */ unfurl_domains?: string[]; + /** + * @description A subgroup of settings that describe {@link https://docs.slack.dev/authentication/standardized-auth standardized app authentication} + * configuration. + */ + user_connections?: ManifestUserConnections; } interface ManifestAgentView { @@ -189,6 +194,17 @@ interface ManifestSlashCommand { usage_hint?: string; } +interface ManifestUserConnections { + /** @description A boolean that specifies whether or not standardized app authentication is enabled for the app. */ + is_enabled: boolean; + /** + * @description An array of strings containing the hosts, without a scheme, that a provider's `auth_url` and + * `disconnect_url` may use. Subdomains of a listed host are also allowed. The hosts are kept while `is_enabled` is + * false, so turning standardized app authentication off only flips `is_enabled`. + */ + auth_hosts: string[]; +} + interface ManifestOAuthConfig { /** * @description An array of strings containing {@link https://docs.slack.dev/authentication/installing-with-oauth OAuth redirect URLs}. @@ -604,6 +620,8 @@ type ManifestEvent = | 'tokens_revoked' | 'url_verification' | 'user_change' + | 'user_connection' + | 'user_connection_status_requested' | 'user_huddle_changed' | 'user_profile_changed' | 'user_resource_denied' diff --git a/packages/web-api/test/types/methods/apps.test-d.ts b/packages/web-api/test/types/methods/apps.test-d.ts index b1c9b002f..a715bf0e4 100644 --- a/packages/web-api/test/types/methods/apps.test-d.ts +++ b/packages/web-api/test/types/methods/apps.test-d.ts @@ -24,6 +24,32 @@ expectAssignable>([ // -- sad path expectError(web.apps.manifest.create()); // lacking argument expectError(web.apps.manifest.create({})); // empty argument +expectError( + web.apps.manifest.create({ + manifest: { + display_information: { name: 'Connector' }, + features: { + user_connections: { + // missing is_enabled + auth_hosts: ['example.com'], + }, + }, + }, + }), +); +expectError( + web.apps.manifest.create({ + manifest: { + display_information: { name: 'Connector' }, + features: { + user_connections: { + // missing auth_hosts + is_enabled: true, + }, + }, + }, + }), +); expectError( web.apps.manifest.create({ manifest: { @@ -75,6 +101,39 @@ expectAssignable>([ }, }, ]); +// -- happy path: user_connections +expectAssignable>([ + { + manifest: { + display_information: { name: 'Connector' }, + features: { + user_connections: { + is_enabled: true, + auth_hosts: ['example.com', 'auth.example.com'], + }, + }, + settings: { + event_subscriptions: { + bot_events: ['user_connection', 'user_connection_status_requested'], + }, + socket_mode_enabled: true, + }, + }, + }, +]); +expectAssignable>([ + { + manifest: { + display_information: { name: 'Connector' }, + features: { + user_connections: { + is_enabled: false, + auth_hosts: ['example.com'], + }, + }, + }, + }, +]); // apps.manifest.delete // -- sad path