Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.20.0"
".": "1.21.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 89
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-7e6c3d2d08fa9268892688e94d3850b533da24c9d0e06d51ab174efffdb7d561.yml
openapi_spec_hash: 3fae433b8b054e688b2f3bc157d22d88
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-226200e7cda539eab84341167939339109659a66a48312fd41cb8b15b89ef8e2.yml
openapi_spec_hash: 2097f5fdc617bdbe6a2780daa693a2f8
config_hash: 658c551418df454aa40794f8ac679c18
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 1.21.0 (2025-10-13)

Full Changelog: [v1.20.0...v1.21.0](https://github.com/knocklabs/knock-go/compare/v1.20.0...v1.21.0)

### Features

* **api:** api update ([ceb191b](https://github.com/knocklabs/knock-go/commit/ceb191b1bdc66202543551c54b4d9d1a91c964a9))
* **api:** api update ([ca17afa](https://github.com/knocklabs/knock-go/commit/ca17afae039100cc6d79e006b5d6e430ef0f2bcc))

## 1.20.0 (2025-10-02)

Full Changelog: [v1.19.0...v1.20.0](https://github.com/knocklabs/knock-go/compare/v1.19.0...v1.20.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/knocklabs/knock-go@v1.20.0'
go get -u 'github.com/knocklabs/knock-go@v1.21.0'
```

<!-- x-release-please-end -->
Expand Down
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package internal

const PackageVersion = "1.20.0" // x-release-please-version
const PackageVersion = "1.21.0" // x-release-please-version
101 changes: 94 additions & 7 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ type Message struct {
ID string `json:"id,required"`
// The typename of the schema.
Typename string `json:"__typename,required"`
// The ID for the channel the message was sent through.
// Deprecated, use channel.id instead.
//
// Deprecated: deprecated
ChannelID string `json:"channel_id,required" format:"uuid"`
// A list of engagement statuses.
EngagementStatuses []MessageEngagementStatus `json:"engagement_statuses,required"`
Expand All @@ -329,7 +331,7 @@ type Message struct {
// A reference to a recipient, either a user identifier (string) or an object
// reference (ID, collection).
Recipient RecipientReferenceUnion `json:"recipient,required"`
// The workflow that triggered the message.
// The workflow or guide that triggered the message.
Source MessageSource `json:"source,required"`
// The message delivery status.
Status MessageStatus `json:"status,required"`
Expand All @@ -341,6 +343,8 @@ type Message struct {
Actors []RecipientReferenceUnion `json:"actors"`
// Timestamp when the message was archived.
ArchivedAt time.Time `json:"archived_at,nullable" format:"date-time"`
// A configured channel, which is a way to route messages to a provider.
Channel MessageChannel `json:"channel"`
// Timestamp when the message was clicked.
ClickedAt time.Time `json:"clicked_at,nullable" format:"date-time"`
// Data associated with the message’s workflow run. Includes the workflow trigger
Expand Down Expand Up @@ -384,6 +388,7 @@ type messageJSON struct {
UpdatedAt apijson.Field
Actors apijson.Field
ArchivedAt apijson.Field
Channel apijson.Field
ClickedAt apijson.Field
Data apijson.Field
InteractedAt apijson.Field
Expand Down Expand Up @@ -426,18 +431,20 @@ func (r MessageEngagementStatus) IsKnown() bool {
return false
}

// The workflow that triggered the message.
// The workflow or guide that triggered the message.
type MessageSource struct {
Typename string `json:"__typename,required"`
// The categories associated with the message.
Categories []string `json:"categories,required"`
// The key of the workflow that triggered the message.
// The key of the workflow or guide that triggered the message.
Key string `json:"key,required"`
// The ID of the version of the workflow that triggered the message.
// The ID of the version of the workflow or guide that triggered the message.
VersionID string `json:"version_id,required" format:"uuid"`
// The step reference for the step in the workflow that generated the message.
StepRef string `json:"step_ref,nullable"`
JSON messageSourceJSON `json:"-"`
StepRef string `json:"step_ref,nullable"`
// Whether this message was generated from a workflow, broadcast, or guide.
Type MessageSourceType `json:"type"`
JSON messageSourceJSON `json:"-"`
}

// messageSourceJSON contains the JSON metadata for the struct [MessageSource]
Expand All @@ -447,6 +454,7 @@ type messageSourceJSON struct {
Key apijson.Field
VersionID apijson.Field
StepRef apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
Expand All @@ -459,6 +467,23 @@ func (r messageSourceJSON) RawJSON() string {
return r.raw
}

// Whether this message was generated from a workflow, broadcast, or guide.
type MessageSourceType string

const (
MessageSourceTypeBroadcast MessageSourceType = "broadcast"
MessageSourceTypeWorkflow MessageSourceType = "workflow"
MessageSourceTypeGuide MessageSourceType = "guide"
)

func (r MessageSourceType) IsKnown() bool {
switch r {
case MessageSourceTypeBroadcast, MessageSourceTypeWorkflow, MessageSourceTypeGuide:
return true
}
return false
}

// The message delivery status.
type MessageStatus string

Expand All @@ -480,6 +505,68 @@ func (r MessageStatus) IsKnown() bool {
return false
}

// A configured channel, which is a way to route messages to a provider.
type MessageChannel struct {
// The unique identifier for the channel.
ID string `json:"id,required"`
// The timestamp of when the channel was created.
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// The ID of the provider that this channel uses to deliver messages.
Provider string `json:"provider,required"`
// The type of channel, determining what kind of messages it can send.
Type MessageChannelType `json:"type,required"`
// The timestamp of when the channel was last updated.
UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
// Unique identifier for the channel within a project (immutable once created).
Key string `json:"key,nullable"`
// The human-readable name of the channel.
Name string `json:"name,nullable"`
JSON messageChannelJSON `json:"-"`
}

// messageChannelJSON contains the JSON metadata for the struct [MessageChannel]
type messageChannelJSON struct {
ID apijson.Field
CreatedAt apijson.Field
Provider apijson.Field
Type apijson.Field
UpdatedAt apijson.Field
Key apijson.Field
Name apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *MessageChannel) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r messageChannelJSON) RawJSON() string {
return r.raw
}

// The type of channel, determining what kind of messages it can send.
type MessageChannelType string

const (
MessageChannelTypeEmail MessageChannelType = "email"
MessageChannelTypeInApp MessageChannelType = "in_app"
MessageChannelTypeInAppFeed MessageChannelType = "in_app_feed"
MessageChannelTypeInAppGuide MessageChannelType = "in_app_guide"
MessageChannelTypeSMS MessageChannelType = "sms"
MessageChannelTypePush MessageChannelType = "push"
MessageChannelTypeChat MessageChannelType = "chat"
MessageChannelTypeHTTP MessageChannelType = "http"
)

func (r MessageChannelType) IsKnown() bool {
switch r {
case MessageChannelTypeEmail, MessageChannelTypeInApp, MessageChannelTypeInAppFeed, MessageChannelTypeInAppGuide, MessageChannelTypeSMS, MessageChannelTypePush, MessageChannelTypeChat, MessageChannelTypeHTTP:
return true
}
return false
}

// A message delivery log contains a `request` from Knock to a downstream provider
// and the `response` that was returned.
type MessageDeliveryLog struct {
Expand Down