-
Notifications
You must be signed in to change notification settings - Fork 0
/
__package__.yml
286 lines (260 loc) · 7.55 KB
/
__package__.yml
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json
imports:
ids: ids.yml
user: user.yml
service:
display-name: Event Service
auth: true
base-path: /v1/apps
headers:
Idempotency-Key:
type: optional<string>
docs: |
The API supports idempotency for safely retrying requests without accidentally performing the same operation twice.
This is useful when an API call is disrupted in transit and you do not receive a response.
For example, if a request to send event does not respond due to a network connection error, you can retry the request with the same idempotency key to guarantee that no more than one event is sent.
An idempotency key is a unique value generated by the client which the server uses to recognize subsequent retries of the same request.
How you create unique keys is up to you, but we suggest using V4 UUIDs, or another random string with enough entropy to avoid collisions.
Idempotency keys can be up to 255 characters long.
endpoints:
send:
docs: This endpoint allows you to send messages
method: POST
path: /{app_id}/events/send
path-parameters:
app_id:
type: ids.AppId
docs: The `id` of the app
request:
name: SendEventRequest
body:
properties:
event:
type: string
docs: The name of the event
data: map<string, unknown>
user:
type: optional<User>
scheduleAt:
type: optional<long>
docs: |
Time to send message expressed as UTC milliseconds.
If not present, message will be sent immediately.
override:
type: optional<EventOverride>
response: SendEventResponse
errors:
- EventNotFoundError
examples:
# success
- path-parameters:
app_id: my_app_id
request:
event: sample_event_1
data:
name: name
date: 01 December 2022
user:
mobile: "+919876543210"
email: [email protected]
whatsapp_mobile: "+919876543210"
response:
body:
id: 1d1ed73c-96e6-4aa3-abc2-2e9a926f773a
success: true
# error
- path-parameters:
app_id: my_app_id
request:
event: sample_event_1
data:
name: name
date: 01 December 2022
user:
mobile: "+919876543210"
email: [email protected]
whatsapp_mobile: "+919876543210"
response:
error: EventNotFoundError
body:
success: false
error: event not found
sendBulk:
method: POST
path: /{app_id}/events/bulk_send
path-parameters:
app_id: ids.AppId
request:
name: BulkSendEventRequest
body:
properties:
event: string
batch:
type: list<BatchEvent>
docs: List of events
response: SendEventResponse
examples:
- path-parameters:
app_id: my-app-id
request:
event: sample_event_1
batch:
- user:
mobile: "+919876543210"
email: [email protected]
whatsapp_mobile: "+919876543210"
data:
name: John Doe
date: 01 December 2022
- user:
mobile: "+919876543210"
email: [email protected]
whatsapp_mobile: "+919876543210"
data:
name: John Doe
date: 01 December 2022
response:
body:
id: 1d1ed73c-96e6-4aa3-abc2-2e9a926f773a
success: true
types:
User:
properties:
user_id:
type: optional<ids.UserId>
docs: |
userId to send the notifications to.
This is your own user identifier which you have used to [create user on Raven](https://docs.raven.dev/api-reference/create-user)
email:
type: optional<string>
mobile:
type: optional<string>
docs: mobile with country code prefix (e.g +91)
whatsapp_mobile:
type: optional<string>
docs: |
mobile with country code prefix (e.g. +91).
if empty, `mobile` is considered for whatsapp
onesignal_external_id:
type: optional<string>
docs: |
[OneSignal external user IDs](https://documentation.onesignal.com/docs/external-user-ids)
onesignal_player_ids:
type: optional<list<string>>
fcm_tokens:
type: optional<list<string>>
docs: List of fcm tokens. eg. ["<fcmtoken1", "<fcmtoken2>"]
ios_tokens:
type: optional<list<string>>
slack:
type: optional<user.SlackProfile>
telegram:
type: optional<user.TelegramProfile>
fcm_topic:
type: optional<string>
fcm_device_group:
type: optional<string>
EventOverride:
properties:
email: optional<EmailOverride>
sms: optional<SmsOverride>
whatsapp: optional<WhatsappOverride>
push: optional<PushOverride>
webhook: optional<WebhookOverride>
voice: optional<VoiceOverride>
slack: optional<SlackOverride>
in_app: optional<InAppOverride>
telegram: optional<TelegramOverride>
providers: map<string, ProviderOverride>
ChannelOverride:
properties:
schedule_at: long
EmailRecipient:
properties:
name: string
address: string
Attachment:
properties:
file_name: string
content: string
url: string
EmailMessage:
properties:
text: string
html_body: string
subject: string
EmailOverride:
extends: ChannelOverride
properties:
from: EmailRecipient
cc: list<EmailRecipient>
bcc: list<EmailRecipient>
attachments: list<Attachment>
message: EmailMessage
SmsMessage:
properties:
text: string
SmsOverride:
extends: ChannelOverride
properties:
sender: string
message: SmsMessage
WhatsappOverride:
extends: ChannelOverride
properties:
message: SmsMessage
PushOverride:
extends: ChannelOverride
WebhookOverride:
extends: ChannelOverride
VoiceOverride:
extends: ChannelOverride
SlackMessage:
properties:
text: string
blocks: unknown
SlackOverride:
extends: ChannelOverride
properties:
message: SlackMessage
InAppOverride:
extends: ChannelOverride
TelegramOverride:
extends: ChannelOverride
Param:
properties:
name: string
value: string
ProviderOverride:
properties:
payload: map<string, unknown>
form_params: list<Param>
query_params: list<Param>
path_params: list<Param>
headers: list<Param>
SendEventResponse:
properties:
id: ids.RequestId
success: boolean
BatchEvent:
properties:
data:
type: map<string, unknown>
docs: |
{
"param1" : "<value1>",
"param2" : "<value2>",
"param3" : object/array"
}
user:
type: optional<User>
override:
type: optional<EventOverride>
EventNotFoundErrorBody:
properties:
success: boolean
error: string
errors:
EventNotFoundError:
status-code: 404
type: EventNotFoundErrorBody