You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This endpoint allows you to post new replies or internal notes to existing tickets.
9
+
This endpoint allows you to post new replies, internal notes, or simulated client/user email replies to existing tickets. There are three types of thread entries you can create:
10
+
11
+
1.**Internal Notes** (`thread_type=note`): Staff-only notes not visible to clients
12
+
2.**Staff Responses** (`thread_type=response`): Public replies from staff members
13
+
3.**Client/User Replies** (`thread_type=email`): Simulates an email reply from a client/user
10
14
11
15
### Authentication
12
16
@@ -27,17 +31,19 @@ The API accepts both JSON and XML formats. Make sure to set the appropriate Cont
27
31
28
32
| Parameter | Type | Description | Required |
29
33
|-----------|------|-------------|----------|
30
-
| thread_type | string | Type of thread entry: 'note' for internal note, 'response' for public reply | Yes |
34
+
| thread_type | string | Type of thread entry: 'note' for internal note, 'response' for public reply, 'email' for client/user reply simulation| Yes |
31
35
| message | string | Content of the thread entry | Yes (unless using cannedId) |
32
-
| staffId | integer | ID of staff member making the post | No |
36
+
| staffId | integer | ID of staff member making the post (not used for 'email' type) | No |
33
37
| alert | boolean | Whether to alert participants | No (default: true) |
34
-
| poster | string | Name of the poster | No (default: 'API')|
35
-
| cannedId | integer | ID of canned response to use | No |
38
+
| poster | string | Name of the poster (default: 'API', not used for 'email' type) | No|
39
+
| cannedId | integer | ID of canned response to use (not used for 'email' type) | No |
36
40
| cannedMode | string | How to use canned response: 'prepend', 'append', 'replace' | No (default: 'replace') |
37
41
| cannedAttachments | boolean | Whether to include canned response attachments | No (default: false) |
The 'email' thread type simulates a user sending an email reply to the ticket. This is useful for integrations that need to add replies on behalf of clients or users. Unlike the 'note' and 'response' thread types which are posted by staff members, the 'email' thread type is associated with a user (either the ticket owner or a specified user).
139
+
140
+
```json
141
+
POST /api/tickets/123/add_thread.json
142
+
X-API-Key: 184F66085DA76CDF5300FE2C6E229238
143
+
Content-Type: application/json
144
+
145
+
{
146
+
"thread_type": "email",
147
+
"message": "Thank you for your response. I have another question...",
Upon successful creation of a thread entry, the API will respond with a 201 Created status and a JSON or XML response containing details about the created thread.
133
163
134
-
JSON Response Example:
164
+
#### JSON Response Example for Staff Entry (note/response):
135
165
```json
136
166
{
137
167
"ticket_id": 123,
@@ -154,6 +184,34 @@ JSON Response Example:
154
184
}
155
185
```
156
186
187
+
#### JSON Response Example for Client/User Reply (email):
188
+
```json
189
+
{
190
+
"ticket_id": 123,
191
+
"ticket_number": "ABC-123-4567",
192
+
"thread_id": 457,
193
+
"thread_type": "email",
194
+
"message_id": "<def456@osticket.com>",
195
+
"timestamp": "2023-05-24 11:15:00",
196
+
"current_status": {
197
+
"id": 1,
198
+
"name": "Open",
199
+
"state": "open"
200
+
},
201
+
"user": {
202
+
"id": 5,
203
+
"name": "John Doe",
204
+
"email": "johndoe@example.com"
205
+
},
206
+
"attachments": [
207
+
{
208
+
"id": 790,
209
+
"name": "screenshot.png"
210
+
}
211
+
]
212
+
}
213
+
```
214
+
157
215
### Error Responses
158
216
159
217
The API will return appropriate HTTP status codes for different error conditions:
0 commit comments