Class: Knockapi::Models::Message

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/knockapi/models/message.rb,
sig/knockapi/models/message.rbs

Overview

See Also:

  • Knockapi::Resources::Messages#list

Defined Under Namespace

Modules: EngagementStatus, Status Classes: Channel, RecipientSnapshot

Constant Summary collapse

Source =

Returns:

  • (:type_)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(id:, _typename:, channel_id:, engagement_statuses:, inserted_at:, recipient:, source:, status:, updated_at:, actors: nil, archived_at: nil, channel: nil, clicked_at: nil, data: nil, interacted_at: nil, link_clicked_at: nil, metadata: nil, read_at: nil, recipient_snapshot: nil, scheduled_at: nil, seen_at: nil, tenant: nil, workflow: nil) ⇒ Object

Some parameter documentations has been truncated, see Knockapi::Models::Message for more details.

Represents a single message that was generated by a workflow for a given channel.

Parameters:

  • id (String) —

    The unique identifier for the message.

  • _typename (String) —

    The typename of the schema.

  • channel_id (String) —

    Deprecated, use channel.id instead.

  • engagement_statuses (Array<Symbol, Knockapi::Models::Message::EngagementStatus>) —

    A list of engagement statuses.

  • inserted_at (Time) —

    Timestamp when the resource was created.

  • recipient (String, Knockapi::Models::RecipientReference::ObjectReference) —

    A reference to a recipient, either a user identifier (string) or an object refer

  • source (Knockapi::Models::Message::Source) —

    The workflow or guide that triggered the message.

  • status (Symbol, Knockapi::Models::Message::Status) —

    The message delivery status.

  • updated_at (Time) —

    The timestamp when the resource was last updated.

  • actors (Array<String, Knockapi::Models::RecipientReference::ObjectReference>) (defaults to: nil) —

    One or more actors that are associated with this message. Note: this is a list t

  • archived_at (Time, nil) (defaults to: nil) —

    Timestamp when the message was archived.

  • channel (Knockapi::Models::Message::Channel) (defaults to: nil) —

    A configured channel, which is a way to route messages to a provider.

  • clicked_at (Time, nil) (defaults to: nil) —

    Timestamp when the message was clicked.

  • data (Hash{Symbol=>Object}, nil) (defaults to: nil) —

    Data associated with the message’s workflow run. Includes the workflow trigger r

  • interacted_at (Time, nil) (defaults to: nil) —

    Timestamp when the message was interacted with.

  • link_clicked_at (Time, nil) (defaults to: nil) —

    Timestamp when a link in the message was clicked.

  • metadata (Hash{Symbol=>Object}, nil) (defaults to: nil) —

    The metadata associated with the message.

  • read_at (Time, nil) (defaults to: nil) —

    Timestamp when the message was read.

  • recipient_snapshot (Knockapi::Models::Message::RecipientSnapshot, nil) (defaults to: nil) —

    The destination the message was delivered to, captured at send time. Email chann

  • scheduled_at (Time, nil) (defaults to: nil) —

    Timestamp when the message was scheduled to be sent.

  • seen_at (Time, nil) (defaults to: nil) —

    Timestamp when the message was seen.

  • tenant (String, nil) (defaults to: nil) —

    The ID of the tenant associated with the message. Only present when a tenant

  • workflow (String, nil) (defaults to: nil) —

    The key of the workflow that generated the message.



# File 'lib/knockapi/models/message.rb', line 160

Instance Attribute Details

#_typename ⇒ String

The typename of the schema.

Parameters:

  • value (String)

Returns:

  • (String)


17
# File 'lib/knockapi/models/message.rb', line 17

required :_typename, String, api_name: :__typename

#actors ⇒ Array<String, Knockapi::Models::RecipientReference::ObjectReference>?

One or more actors that are associated with this message. Note: this is a list that can contain up to 10 actors if the message is produced from a batch.



71
# File 'lib/knockapi/models/message.rb', line 71

optional :actors, -> { Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientReference] }

#archived_at ⇒ Time?

Timestamp when the message was archived.

Parameters:

  • value (Time, nil)

Returns:

  • (Time, nil)


77
# File 'lib/knockapi/models/message.rb', line 77

optional :archived_at, Time, nil?: true

#channel ⇒ Knockapi::Models::Message::Channel?

A configured channel, which is a way to route messages to a provider.

Parameters:

  • (Knockapi::Message::Channel)

Returns:



83
# File 'lib/knockapi/models/message.rb', line 83

optional :channel, -> { Knockapi::Message::Channel }

#channel_id ⇒ String

Deprecated.

Deprecated, use channel.id instead.

Parameters:

  • value (String)

Returns:

  • (String)


25
# File 'lib/knockapi/models/message.rb', line 25

required :channel_id, String

#clicked_at ⇒ Time?

Timestamp when the message was clicked.

Parameters:

  • value (Time, nil)

Returns:

  • (Time, nil)


89
# File 'lib/knockapi/models/message.rb', line 89

optional :clicked_at, Time, nil?: true

#data ⇒ Hash{Symbol=>Object}?

Data associated with the message’s workflow run. Includes the workflow trigger request’s data payload merged with any additional data returned by a fetch function. For messages produced after a batch step, includes the payload data from the most-recent trigger request (the final activity in the batch).

Parameters:

  • value (::Hash[Symbol, top], nil)

Returns:



99
# File 'lib/knockapi/models/message.rb', line 99

optional :data, Knockapi::Internal::Type::HashOf[Knockapi::Internal::Type::Unknown], nil?: true

#engagement_statuses ⇒ Array<Symbol, Knockapi::Models::Message::EngagementStatus>

A list of engagement statuses.

Parameters:

  • value (::Array[Knockapi::Models::Message::engagement_status])

Returns:



31
32
# File 'lib/knockapi/models/message.rb', line 31

required :engagement_statuses,
-> { Knockapi::Internal::Type::ArrayOf[enum: Knockapi::Message::EngagementStatus] }

#id ⇒ String

The unique identifier for the message.

Parameters:

  • value (String)

Returns:

  • (String)


11
# File 'lib/knockapi/models/message.rb', line 11

required :id, String

#inserted_at ⇒ Time

Timestamp when the resource was created.

Parameters:

  • value (Time)

Returns:

  • (Time)


38
# File 'lib/knockapi/models/message.rb', line 38

required :inserted_at, Time

#interacted_at ⇒ Time?

Timestamp when the message was interacted with.

Parameters:

  • value (Time, nil)

Returns:

  • (Time, nil)


105
# File 'lib/knockapi/models/message.rb', line 105

optional :interacted_at, Time, nil?: true

Timestamp when a link in the message was clicked.

Parameters:

  • value (Time, nil)

Returns:

  • (Time, nil)


111
# File 'lib/knockapi/models/message.rb', line 111

optional :link_clicked_at, Time, nil?: true

#metadata ⇒ Hash{Symbol=>Object}?

The metadata associated with the message.

Parameters:

  • value (::Hash[Symbol, top], nil)

Returns:



117
# File 'lib/knockapi/models/message.rb', line 117

optional :metadata, Knockapi::Internal::Type::HashOf[Knockapi::Internal::Type::Unknown], nil?: true

#read_at ⇒ Time?

Timestamp when the message was read.

Parameters:

  • value (Time, nil)

Returns:

  • (Time, nil)


123
# File 'lib/knockapi/models/message.rb', line 123

optional :read_at, Time, nil?: true

#recipient ⇒ String, Knockapi::Models::RecipientReference::ObjectReference

A reference to a recipient, either a user identifier (string) or an object reference (ID, collection).

Parameters:

  • value (Knockapi::Models::recipient_reference)

Returns:



45
# File 'lib/knockapi/models/message.rb', line 45

required :recipient, union: -> { Knockapi::RecipientReference }

#recipient_snapshot ⇒ Knockapi::Models::Message::RecipientSnapshot?

The destination the message was delivered to, captured at send time. Email channels carry email/name; chat channels carry the destination channel_id or user_id, or via_incoming_webhook. Null when no snapshot was captured.

Parameters:

  • value (Knockapi::Message::RecipientSnapshot, nil)

Returns:



131
# File 'lib/knockapi/models/message.rb', line 131

optional :recipient_snapshot, -> { Knockapi::Message::RecipientSnapshot }, nil?: true

#scheduled_at ⇒ Time?

Timestamp when the message was scheduled to be sent.

Parameters:

  • value (Time, nil)

Returns:

  • (Time, nil)


137
# File 'lib/knockapi/models/message.rb', line 137

optional :scheduled_at, Time, nil?: true

#seen_at ⇒ Time?

Timestamp when the message was seen.

Parameters:

  • value (Time, nil)

Returns:

  • (Time, nil)


143
# File 'lib/knockapi/models/message.rb', line 143

optional :seen_at, Time, nil?: true

#source ⇒ Knockapi::Models::Message::Source

The workflow or guide that triggered the message.

Parameters:

  • value (Knockapi::Message::Source)

Returns:



51
# File 'lib/knockapi/models/message.rb', line 51

required :source, -> { Knockapi::Message::Source }

#status ⇒ Symbol, Knockapi::Models::Message::Status

The message delivery status.

Parameters:

  • value (Knockapi::Models::Message::status)

Returns:



57
# File 'lib/knockapi/models/message.rb', line 57

required :status, enum: -> { Knockapi::Message::Status }

#tenant ⇒ String?

The ID of the tenant associated with the message. Only present when a tenant is provided on a workflow trigger request.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


150
# File 'lib/knockapi/models/message.rb', line 150

optional :tenant, String, nil?: true

#updated_at ⇒ Time

The timestamp when the resource was last updated.

Parameters:

  • value (Time)

Returns:

  • (Time)


63
# File 'lib/knockapi/models/message.rb', line 63

required :updated_at, Time

#workflow ⇒ String?

Deprecated.

The key of the workflow that generated the message.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


158
# File 'lib/knockapi/models/message.rb', line 158

optional :workflow, String, nil?: true

Class Method Details

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/knockapi/models/message.rb', line 224

Instance Method Details

#to_hash ⇒ {

Returns:

  • ({)


109
# File 'sig/knockapi/models/message.rbs', line 109

def to_hash: -> {