-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmessage.py
More file actions
160 lines (108 loc) · 5.1 KB
/
message.py
File metadata and controls
160 lines (108 loc) · 5.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import Dict, List, Optional
from datetime import datetime
from typing_extensions import Literal
from pydantic import Field as FieldInfo
from .._models import BaseModel
from .recipient_reference import RecipientReference
__all__ = ["Message", "Source", "Channel"]
class Source(BaseModel):
"""The workflow or guide that triggered the message."""
api_typename: str = FieldInfo(alias="__typename")
categories: List[str]
"""The categories associated with the message."""
key: str
"""The key of the workflow or guide that triggered the message."""
version_id: str
"""The ID of the version of the workflow or guide that triggered the message."""
step_ref: Optional[str] = None
"""The step reference for the step in the workflow that generated the message."""
type: Optional[Literal["broadcast", "workflow", "guide"]] = None
"""Whether this message was generated from a workflow, broadcast, or guide."""
workflow_recipient_run_id: Optional[str] = None
"""The unique identifier for the workflow recipient run that generated this
message.
Only present for workflow/broadcast messages.
"""
workflow_run_id: Optional[str] = None
"""The unique identifier for the workflow run that generated this message.
Only present for workflow/broadcast messages.
"""
class Channel(BaseModel):
"""A configured channel, which is a way to route messages to a provider."""
id: str
"""The unique identifier for the channel."""
created_at: datetime
"""The timestamp of when the channel was created."""
provider: str
"""The ID of the provider that this channel uses to deliver messages."""
type: Literal["email", "in_app", "in_app_feed", "in_app_guide", "sms", "push", "chat", "http"]
"""The type of channel, determining what kind of messages it can send."""
updated_at: datetime
"""The timestamp of when the channel was last updated."""
key: Optional[str] = None
"""Unique identifier for the channel within a project (immutable once created)."""
name: Optional[str] = None
"""The human-readable name of the channel."""
class Message(BaseModel):
"""
Represents a single message that was generated by a workflow for a given channel.
"""
id: str
"""The unique identifier for the message."""
api_typename: str = FieldInfo(alias="__typename")
"""The typename of the schema."""
channel_id: str
"""Deprecated, use channel.id instead."""
engagement_statuses: List[Literal["seen", "read", "interacted", "link_clicked", "archived"]]
"""A list of engagement statuses."""
inserted_at: datetime
"""Timestamp when the resource was created."""
recipient: RecipientReference
"""
A reference to a recipient, either a user identifier (string) or an object
reference (ID, collection).
"""
source: Source
"""The workflow or guide that triggered the message."""
status: Literal["queued", "sent", "delivered", "delivery_attempted", "undelivered", "not_sent", "bounced"]
"""The message delivery status."""
updated_at: datetime
"""The timestamp when the resource was last updated."""
actors: Optional[List[RecipientReference]] = None
"""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](/designing-workflows/batch-function).
"""
archived_at: Optional[datetime] = None
"""Timestamp when the message was archived."""
channel: Optional[Channel] = None
"""A configured channel, which is a way to route messages to a provider."""
clicked_at: Optional[datetime] = None
"""Timestamp when the message was clicked."""
data: Optional[Dict[str, object]] = None
"""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](/designing-workflows/fetch-function). For messages produced
after a [batch step](/designing-workflows/batch-function), includes the payload
`data` from the most-recent trigger request (the final `activity` in the batch).
"""
interacted_at: Optional[datetime] = None
"""Timestamp when the message was interacted with."""
link_clicked_at: Optional[datetime] = None
"""Timestamp when a link in the message was clicked."""
metadata: Optional[Dict[str, object]] = None
"""The metadata associated with the message."""
read_at: Optional[datetime] = None
"""Timestamp when the message was read."""
scheduled_at: Optional[datetime] = None
"""Timestamp when the message was scheduled to be sent."""
seen_at: Optional[datetime] = None
"""Timestamp when the message was seen."""
tenant: Optional[str] = None
"""The ID of the `tenant` associated with the message.
Only present when a `tenant` is provided on a workflow trigger request.
"""
workflow: Optional[str] = None
"""The key of the workflow that generated the message."""