Skip to content

Commit 9aaed9c

Browse files
committed
Add event hooks to app settings
1 parent 195f7d4 commit 9aaed9c

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

src/client.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,24 @@ export class StreamChat {
754754
'data_template': 'data handlebars template',
755755
'apn_template': 'apn notification handlebars template under v2'
756756
},
757-
'webhook_url': 'https://acme.com/my/awesome/webhook/'
757+
'webhook_url': 'https://acme.com/my/awesome/webhook/',
758+
'event_hooks': [
759+
{
760+
'hook_type': 'webhook',
761+
'enabled': true,
762+
'event_types': ['message.new'],
763+
'webhook_url': 'https://acme.com/my/awesome/webhook/'
764+
},
765+
{
766+
'hook_type': 'sqs',
767+
'enabled': true,
768+
'event_types': ['message.new'],
769+
'sqs_url': 'https://sqs.us-east-1.amazonaws.com/1234567890/my-queue',
770+
'sqs_auth_type': 'key',
771+
'sqs_key': 'my-access-key',
772+
'sqs_secret': 'my-secret-key'
773+
}
774+
]
758775
}
759776
*/
760777
async updateAppSettings(options: AppSettings) {

src/types.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ export type AppSettingsAPIResponse = APIResponse & {
162162
sqs_key?: string;
163163
sqs_secret?: string;
164164
sqs_url?: string;
165+
event_hooks?: Array<EventHook>;
165166
suspended?: boolean;
166167
suspended_explanation?: string;
167168
user_search_disallowed_roles?: string[] | null;
@@ -2242,6 +2243,7 @@ export type AppSettings = {
22422243
sqs_key?: string;
22432244
sqs_secret?: string;
22442245
sqs_url?: string;
2246+
event_hooks?: Array<EventHook>;
22452247
video_provider?: string;
22462248
webhook_events?: Array<string> | null;
22472249
webhook_url?: string;
@@ -3977,3 +3979,27 @@ export type ThreadFilters = QueryFilters<
39773979
| PrimitiveFilter<ThreadResponse['last_message_at']>;
39783980
}
39793981
>;
3982+
3983+
export type HookType = 'webhook' | 'sqs' | 'sns';
3984+
3985+
export type EventHook = {
3986+
id?: string;
3987+
hook_type?: HookType;
3988+
enabled?: boolean;
3989+
event_types?: Array<string>;
3990+
webhook_url?: string;
3991+
sqs_queue_url?: string;
3992+
sqs_region?: string;
3993+
sqs_auth_type?: string;
3994+
sqs_key?: string;
3995+
sqs_secret?: string;
3996+
sqs_role_arn?: string;
3997+
sns_topic_arn?: string;
3998+
sns_region?: string;
3999+
sns_auth_type?: string;
4000+
sns_key?: string;
4001+
sns_secret?: string;
4002+
sns_role_arn?: string;
4003+
created_at?: string;
4004+
updated_at?: string;
4005+
};

0 commit comments

Comments
 (0)