-
Notifications
You must be signed in to change notification settings - Fork 0
/
marketplace-apps.yaml
275 lines (274 loc) · 11 KB
/
marketplace-apps.yaml
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
openapi: 3.0.0
info:
version: 1.0.0
title: Marketplace Apps
# description: |-
# The following marketplace apps endpoints are available:
# * **WhatsApp**: Send a template [WhatsApp](https://docs.rocket.chat/extend-rocket.chat-capabilities/rocket.chat-marketplace/rocket.chat-public-apps-guides/omnichannel-apps/whatsapp) message.
# * **Rasa**: Close a [Rasa](https://docs.rocket.chat/extend-rocket.chat-capabilities/rocket.chat-marketplace/rocket.chat-public-apps-guides/omnichannel-apps/rasa-app) app chat or perform handover.
servers:
- url: https://apiexplorer.support.rocket.chat
paths:
'/api/apps/public/{app-id}/incoming':
parameters:
- schema:
type: string
name: app-id
in: path
required: true
description: The app id. Navigate to App Info > Details > APIs > POST incoming to get the complete URL for this endpoint.
post:
summary: Close Chat or Perform Handover
tags:
- Rasa App
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
msg:
type: string
examples:
Example 1:
value:
msg: ' Close chat request handled successfully'
Example 2:
value:
msg: ' Perform Handover request handled successfully'
'401':
$ref: '#/components/responses/authorizationError'
operationId: post-api-apps-public-app-id-incoming
description: |-
Close a chat session or perform handover. The appropriate endpoint URL including the `appId` for closing chat or perfoming handover in your workspace is displayed under **App Info > Details > APIs > POST incoming** section of the Rasa app.
### Changelog
| Version | Description |
| ---------------- | ------------|
|5.0.0 | Added |
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
content:
application/json:
schema:
type: object
required:
- action
- sessionId
properties:
action:
type: string
description: 'The action can either be `handover` or `close-chat`. '
sessionId:
type: string
description: The ID of the Rasa session.
actionData:
type: object
properties:
targetDepartment:
type: string
description: The targeted department.
examples:
Example 1:
value:
action: close-chat
sessionId: 2Sfq8wXw4fYPMf6r4
'/api/apps/public/{appId}/templateMessage':
post:
tags:
- WhatsApp
summary: Send a WhatsApp Template Message
description: |-
Send template messages via WhatsApp to targeted contacts directly from your workspace using this endpoint. It supports only <a href="https://docs.rocket.chat/docs/whatsapp-cloud-app" target="_blank">WhatsApp Cloud App</a> and <a href="https://docs.rocket.chat/docs/whatsapp-sandbox" target="_blank">WhatsApp Sandbox App</a>.
To get the valid endpoint URL for sending template messages in your workspace,
- Go to Administration > Apps > Marketplace
- Search for WhatsApp Cloud app
- Navigate to App Info > Details > POST templateMessage.
- Copy the endpoint URL for sending template messages in your workspace. The URL also includes the `appId`.
operationId: post-api-apps-public-app_id-templateMessage
parameters:
- name: appId
in: path
required: true
schema:
type: string
requestBody:
description: 'We strongly recommend including the + prefix for all phone numbers in the payload. While you can submit numbers without the leading + sign, we have encountered cases where WhatsApp will return an invalid response despite the number being in use.'
content:
application/json:
schema:
type: object
properties:
phoneNumbers:
type: array
description: 'Recipient WhatsApp IDs where you want to send the template message. You can validate a WhatsApp id from <a href="https://developers.facebook.com/docs/whatsapp/on-premises/reference/contacts" target="_blank">here</a>.'
items:
type: string
connectedWhatsAppNo:
type: string
description: The WhatsApp Number from which you want to send this template message. The WhatsApp number connected to your workspace via the app.
targetAgent:
type: string
description: Username of the agent you want to transfer the chat to when the WhatsApp user replies.
targetDepartment:
type: string
description: Department name or ID where you want to transfer the chat to when the WhatsApp user replies.
template:
type: object
description: 'Provide information about the template message you wish to send. Refer to <a href="https://developers.facebook.com/docs/whatsapp/api/messages/message-templates#the-template-object" target="_blank">Message Templates</a> and <a href="https://developer.rocket.chat/docs/whatsapp-business-template-messages#send-whatsapp-template-messages-from-your-workspace" target="_blank">Sending WhatsApp template messages from your workspace</a> for template examples.'
properties:
namespace:
type: string
name:
type: string
language:
type: object
properties:
code:
type: string
policy:
type: string
components:
type: array
items:
type: object
properties:
type:
type: string
parameters:
type: array
items:
type: object
properties:
type:
type: string
text:
type: string
required:
- phoneNumbers
- connectedWhatsAppNo
- template
example:
phoneNumbers:
- '2368106035555'
connectedWhatsAppNo: '104920685899299'
template:
name: ship
language:
code: en
policy: deterministic
components:
- type: body
parameters:
- type: text
text: '20'
responses:
'200':
$ref: '#/components/responses/trueSuccess'
'401':
$ref: '#/components/responses/authorizationError'
'403':
$ref: '#/components/responses/forbiddenError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
examples:
Too many phone numbers:
value:
success: false
error: Too many phone numbers! Please make sure that phoneNumbers are <= 250
Agent Not Found:
value:
success: false
error: No Agent found with username abc98
Department Not Found:
value:
success: false
error: No Department found with id/Name SalesDepartment
Invalid WhatsApp Contact:
value:
success: false
error: Connected WhatsApp Number (connectedWhatsAppNo) i.e. 565412001234 is not a valid WhatsApp contact. Contact Status is invalid
Invalid Connected WhatsApp Number:
value:
success: false
error: 'Error! Connected WhatsApp Number (connectedWhatsAppNo) i.e. 565412001234 has not been registered yet on Rocket.Chat. Please goto #omnichannel-whatsapp-setup channel and connect this WhatsApp number first there before sending this request again.'
components:
schemas: {}
parameters:
Auth-Token:
name: X-Auth-Token
in: header
description: The `authToken` of the authenticated user.
required: true
schema:
type: string
example: RScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
UserId:
name: X-User-Id
in: header
description: The `userId` of the authenticated user.
required: true
schema:
type: string
example: rbAXPnMktTFbNpwtJ
responses:
trueSuccess:
description: OK
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
examples:
Success:
value:
success: true
authorizationError:
description: Unauthorized
content:
application/json:
schema:
type: object
properties:
status:
type: string
message:
type: string
examples:
Authorization Error:
value:
status: error
message: You must be logged in to do this.
forbiddenError:
description: Forbidden
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
examples:
Permission Error:
value:
success: false
error: 'User does not have the permissions required for this action [error-unauthorized]'
tags:
- name: Rasa App
- name: WhatsApp