@@ -131,6 +131,7 @@ def get_context_data(self, **kwargs):
131
131
LabelsEndpoint .get_write_explorer (),
132
132
LabelsEndpoint .get_delete_explorer (),
133
133
MessagesEndpoint .get_read_explorer (),
134
+ MessagesEndpoint .get_write_explorer (),
134
135
MessageActionsEndpoint .get_write_explorer (),
135
136
ResthooksEndpoint .get_read_explorer (),
136
137
ResthookEventsEndpoint .get_read_explorer (),
@@ -483,8 +484,14 @@ class BroadcastsEndpoint(ListAPIMixin, WriteAPIMixin, BaseEndpoint):
483
484
{
484
485
"urns": ["tel:+250788123123", "tel:+250788123124"],
485
486
"contacts": ["09d23a05-47fe-11e4-bfe9-b8f6b119e9ab"],
486
- "text": {"eng": "Hello @contact.name!", "spa": "Hola @contact.name!"},
487
- "quick_replies": {"eng": [{"text": "Hey"}, {"text": "Hello!"}]}
487
+ "text": {
488
+ "eng": "Hello @contact.name! Burger or pizza?",
489
+ "spa": "Hola @contact.name! Hamburguesa o pizza?"
490
+ },
491
+ "quick_replies": {
492
+ "eng": [{"text": "Burger", "extra": "With cheese"}, {"text": "Pizza"}],
493
+ "spa": [{"text": "Hamburguesa", "extra": "Con queso"}, {"text": "Pizza"}]
494
+ },
488
495
"base_language": "eng"
489
496
}
490
497
@@ -495,9 +502,15 @@ class BroadcastsEndpoint(ListAPIMixin, WriteAPIMixin, BaseEndpoint):
495
502
"urns": ["tel:+250788123123", "tel:+250788123124"],
496
503
"contacts": [{"uuid": "09d23a05-47fe-11e4-bfe9-b8f6b119e9ab", "name": "Joe"}]
497
504
"groups": [],
498
- "text": {"eng": "Hello @contact.name!", "spa": "Hola @contact.name!"},
505
+ "text": {
506
+ "eng": "Hello @contact.name! Burger or pizza?",
507
+ "spa": "Hola @contact.name! Hamburguesa o pizza?"
508
+ },
499
509
"attachments": {"eng": [], "spa": []},
500
- "quick_replies": {"eng": [{"text": "Hey"}, {"text": "Hello!"}], "spa": []},
510
+ "quick_replies": {
511
+ "eng": [{"text": "Burger", "extra": "With cheese"}, {"text": "Pizza"}],
512
+ "spa": [{"text": "Hamburguesa", "extra": "Con queso"}, {"text": "Pizza"}]
513
+ },
501
514
"base_language": "eng",
502
515
"created_on": "2013-03-02T17:28:12.123456Z"
503
516
}
@@ -2309,9 +2322,9 @@ class MessagesEndpoint(ListAPIMixin, WriteAPIMixin, BaseEndpoint):
2309
2322
POST /api/v2/messages.json
2310
2323
{
2311
2324
"contact": "d33e9ad5-5c35-414c-abd4-e7451c69ff1d",
2312
- "text": "Hi Bob ",
2325
+ "text": "Burger or pizza? ",
2313
2326
"attachments": [],
2314
- "quick_repies": [{"text": "Hey" }, {"text": "Hi "}]
2327
+ "quick_repies": [{"text": "Burger", "extra": "With cheese" }, {"text": "Pizza "}]
2315
2328
2316
2329
}
2317
2330
@@ -2327,9 +2340,9 @@ class MessagesEndpoint(ListAPIMixin, WriteAPIMixin, BaseEndpoint):
2327
2340
"type": "text",
2328
2341
"status": "queued",
2329
2342
"visibility": "visible",
2330
- "text": "Hi Bob ",
2343
+ "text": "Burger or pizza? ",
2331
2344
"attachments": [],
2332
- "quick_replies": [{"text": "Hey" }, {"text": "Hi "}],
2345
+ "quick_replies": [{"text": "Burger", "extra": "With cheese" }, {"text": "Pizza "}],
2333
2346
"labels": [],
2334
2347
"flow": null,
2335
2348
"created_on": "2023-01-06T15:33:00.813162Z",
@@ -2471,6 +2484,25 @@ def get_read_explorer(cls):
2471
2484
"example" : {"query" : "folder=inbox&after=2014-01-01T00:00:00.000" },
2472
2485
}
2473
2486
2487
+ @classmethod
2488
+ def get_write_explorer (cls ):
2489
+ return {
2490
+ "method" : "POST" ,
2491
+ "title" : "Send Messages" ,
2492
+ "url" : reverse ("api.v2.messages" ),
2493
+ "slug" : "message-write" ,
2494
+ "fields" : [
2495
+ {"name" : "contact" , "required" : True , "help" : "The UUID of the contact" },
2496
+ {"name" : "text" , "required" : False , "help" : "The text of the message (string)" },
2497
+ {"name" : "attachments" , "required" : False , "help" : "The attachments on the message (array of strings)" },
2498
+ {
2499
+ "name" : "quick_replies" ,
2500
+ "required" : False ,
2501
+ "help" : "The quick replies on the message (array of objects)" ,
2502
+ },
2503
+ ],
2504
+ }
2505
+
2474
2506
2475
2507
class MessageActionsEndpoint (BulkWriteAPIMixin , BaseEndpoint ):
2476
2508
"""
0 commit comments