Skip to content

Commit 3d158d5

Browse files
authored
Add slack Webhooks (#145)
* Add support for slack webhooks * Add changeset
1 parent c5115e2 commit 3d158d5

File tree

3 files changed

+136
-0
lines changed

3 files changed

+136
-0
lines changed

.changeset/short-baboons-relate.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@team-plain/typescript-sdk': minor
3+
---
4+
5+
Regenerate types for slack webhooks (`thread.slack_message_received` and `thread.slack_message_sent`)

src/webhooks/webhook-schema.json

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
"thread.thread_assignment_transitioned",
8181
"thread.email_received",
8282
"thread.email_sent",
83+
"thread.slack_message_received",
84+
"thread.slack_message_sent",
8385
"thread.chat_sent",
8486
"thread.note_created",
8587
"thread.thread_labels_changed",
@@ -1604,6 +1606,30 @@
16041606
"API",
16051607
"SLACK"
16061608
]
1609+
},
1610+
"actorId": {
1611+
"type": [
1612+
"string",
1613+
"null"
1614+
],
1615+
"default": null
1616+
},
1617+
"actorType": {
1618+
"anyOf": [
1619+
{
1620+
"type": "string",
1621+
"enum": [
1622+
"user",
1623+
"machineUser",
1624+
"customer",
1625+
"system"
1626+
]
1627+
},
1628+
{
1629+
"type": "null"
1630+
}
1631+
],
1632+
"default": null
16071633
}
16081634
},
16091635
"required": [
@@ -2532,6 +2558,65 @@
25322558
}
25332559
]
25342560
},
2561+
"slackMessage": {
2562+
"type": "object",
2563+
"properties": {
2564+
"timelineEntryId": {
2565+
"$ref": "#/definitions/id"
2566+
},
2567+
"id": {
2568+
"$ref": "#/definitions/id"
2569+
},
2570+
"text": {
2571+
"type": "string"
2572+
},
2573+
"resolvedText": {
2574+
"type": "string",
2575+
"default": ""
2576+
},
2577+
"attachments": {
2578+
"type": "array",
2579+
"items": {
2580+
"$ref": "#/definitions/attachment"
2581+
}
2582+
},
2583+
"slackChannelId": {
2584+
"type": "string"
2585+
},
2586+
"slackChannelName": {
2587+
"type": "string"
2588+
},
2589+
"slackMessageLink": {
2590+
"type": "string"
2591+
},
2592+
"createdAt": {
2593+
"$ref": "#/definitions/datetime"
2594+
},
2595+
"createdBy": {
2596+
"$ref": "#/definitions/actor"
2597+
},
2598+
"updatedAt": {
2599+
"$ref": "#/definitions/datetime"
2600+
},
2601+
"updatedBy": {
2602+
"$ref": "#/definitions/actor"
2603+
}
2604+
},
2605+
"required": [
2606+
"timelineEntryId",
2607+
"id",
2608+
"text",
2609+
"attachments",
2610+
"slackChannelId",
2611+
"slackChannelName",
2612+
"slackMessageLink",
2613+
"createdAt",
2614+
"createdBy",
2615+
"updatedAt",
2616+
"updatedBy"
2617+
],
2618+
"additionalProperties": false
2619+
},
25352620
"customerChangedPayload": {
25362621
"type": "object",
25372622
"properties": {
@@ -3120,6 +3205,48 @@
31203205
],
31213206
"additionalProperties": false
31223207
},
3208+
"threadSlackMessageReceivedEventPayload": {
3209+
"type": "object",
3210+
"properties": {
3211+
"eventType": {
3212+
"type": "string",
3213+
"const": "thread.slack_message_received"
3214+
},
3215+
"thread": {
3216+
"$ref": "#/definitions/thread"
3217+
},
3218+
"slackMessage": {
3219+
"$ref": "#/definitions/slackMessage"
3220+
}
3221+
},
3222+
"required": [
3223+
"eventType",
3224+
"thread",
3225+
"slackMessage"
3226+
],
3227+
"additionalProperties": false
3228+
},
3229+
"threadSlackMessageSentEventPayload": {
3230+
"type": "object",
3231+
"properties": {
3232+
"eventType": {
3233+
"type": "string",
3234+
"const": "thread.slack_message_sent"
3235+
},
3236+
"thread": {
3237+
"$ref": "#/definitions/thread"
3238+
},
3239+
"slackMessage": {
3240+
"$ref": "#/definitions/slackMessage"
3241+
}
3242+
},
3243+
"required": [
3244+
"eventType",
3245+
"thread",
3246+
"slackMessage"
3247+
],
3248+
"additionalProperties": false
3249+
},
31233250
"customerCreatedPublicEventPayload": {
31243251
"type": "object",
31253252
"properties": {

src/webhooks/webhook-schema.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ export interface WebhooksSchemaDefinition {
193193
| "thread.thread_assignment_transitioned"
194194
| "thread.email_received"
195195
| "thread.email_sent"
196+
| "thread.slack_message_received"
197+
| "thread.slack_message_sent"
196198
| "thread.chat_sent"
197199
| "thread.note_created"
198200
| "thread.thread_labels_changed"
@@ -537,6 +539,8 @@ export interface LabelType {
537539
export interface ThreadMessageInfo {
538540
timestamp: Datetime;
539541
messageSource: "CHAT" | "EMAIL" | "API" | "SLACK";
542+
actorId?: string | null;
543+
actorType?: ("user" | "machineUser" | "customer" | "system") | null;
540544
}
541545
export interface ThreadStatusTransitionedPublicEventPayload {
542546
eventType: "thread.thread_status_transitioned";

0 commit comments

Comments
 (0)