-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMessages.postman_collection.json
266 lines (266 loc) · 22.4 KB
/
Messages.postman_collection.json
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
{
"info": {
"_postman_id": "1acda406-7fec-49cf-97dd-59fcde48d88d",
"name": "Messages",
"description": "The MessageMedia Messages API provides a number of endpoints for building powerful two-way messaging applications. The Messages API provides access to three main resources:\n\n* Messages - Messages delivered from an application to a handset.\n\n* Delivery Reports - Real time reports on the delivery status of a message. As a message\n is processed, it's status may change several times before it is finally delivered to a handset.\n\n* Replies - Messages sent from a handset to an application. These messages are typically a reply\n to a previously sent message.\n\n![Message Flow](https://i.imgur.com/jJeHwf5.png)",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Messages",
"item": [
{
"name": "Send messages",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"messages\": [\n {\n \"callback_url\": \"https://my.callback.url.com\",\n \"content\": \"My first message\",\n \"destination_number\": \"+61491570156\",\n \"delivery_report\": true,\n \"format\": \"SMS\",\n \"message_expiry_timestamp\": \"2016-11-03T11:49:02.807Z\",\n \"metadata\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n },\n \"scheduled\": \"2016-11-03T11:49:02.807Z\",\n \"source_number\": \"+61491570157\",\n \"source_number_type\": \"INTERNATIONAL\"\n },\n {\n \"callback_url\": \"https://my.callback.url.com\",\n \"content\": \"My second message\",\n \"destination_number\": \"+61491570158\",\n \"delivery_report\": true,\n \"format\": \"MMS\",\n \"media\": [ \"https://images.pexels.com/photos/1018350/pexels-photo-1018350.jpeg?cs=srgb&dl=architecture-buildings-city-1018350.jpg\" ],\n \"message_expiry_timestamp\": \"2016-11-03T11:49:02.807Z\",\n \"metadata\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n },\n \"scheduled\": \"2016-11-03T11:49:02.807Z\",\n \"source_number\": \"+61491570159\",\n \"source_number_type\": \"INTERNATIONAL\"\n }\n ]\n}"
},
"url": {
"raw": "{{HOST}}/v1/messages",
"host": [
"{{HOST}}"
],
"path": [
"v1",
"messages"
]
},
"description": "Submit one or more (up to 100 per request) SMS, MMS or text to voice messages for delivery.\n\nThe most basic message has the following structure:\n\n```json\n{\n \"messages\": [\n {\n \"content\": \"My first message!\",\n \"destination_number\": \"+61491570156\"\n }\n ]\n}\n```\n\nMore advanced delivery features can be specified by setting the following properties in a message:\n\n- ```callback_url``` A URL can be included with each message to which Webhooks will be pushed to\n via a HTTP POST request. Webhooks will be sent if and when the status of the message changes as\n it is processed (if the delivery report property of the request is set to ```true```) and when replies\n are received. Specifying a callback URL is optional.\n\n- ```content``` The content of the message. This can be a Unicode string, up to 5,000 characters long.\n Message content is required.\n\n- ```delivery_report``` Delivery reports can be requested with each message. If delivery reports are requested, a webhook\n will be submitted to the ```callback_url``` property specified for the message (or to the webhooks)\n specified for the account every time the status of the message changes as it is processed. The\n current status of the message can also be retrieved via the Delivery Reports endpoint of the\n Messages API. Delivery reports are optional and by default will not be requested.\n\n- ```destination_number``` The destination number the message should be delivered to. This should be specified in E.164\n international format. For information on E.164, please refer to http://en.wikipedia.org/wiki/E.164.\n A destination number is required.\n\n- ```format``` The format specifies which format the message will be sent as, ```SMS``` (text message), ```MMS``` (multimedia message)\n or ```TTS``` (text to speech). With ```TTS``` format, we will call the destination number and read out the\n message using a computer generated voice. Specifying a format is optional, by default ```SMS``` will be used.\n\n- ```source_number``` A source number may be specified for the message, this will be the number that\n the message appears from on the handset. By default this feature is _not_ available and will be ignored\n in the request. Please contact <[email protected]> for more information. Specifying a source\n number is optional and a by default a source number will be assigned to the message.\n\n- ```media``` The media is used to specify the url of the media file that you are trying to send. Supported file formats include png, jpeg and gif. ```format``` parameter must be set to ```MMS``` for this to work.\n\n- ```source_number_type``` If a source number is specified, the type of source number may also be\n specified. This is recommended when using a source address type that is not an internationally\n formatted number, available options are ```INTERNATIONAL```, ```ALPHANUMERIC``` or ```SHORTCODE```. Specifying a\n source number type is only valid when the ```source_number``` parameter is specified and is optional.\n If a source number is specified and no source number type is specified, the source number type will be\n inferred from the source number, however this may be inaccurate.\n\n- ```scheduled``` A message can be scheduled for delivery in the future by setting the scheduled property.\n The scheduled property expects a date time specified in ISO 8601 format. The scheduled time must be\n provided in UTC and is optional. If no scheduled property is set, the message will be delivered immediately.\n\n- ```message_expiry_timestamp``` A message expiry timestamp can be provided to specify the latest time\n at which the message should be delivered. If the message cannot be delivered before the specified\n message expiry timestamp elapses, the message will be discarded. Specifying a message expiry \n timestamp is optional.\n\n- ```metadata``` Metadata can be included with the message which will then be included with any delivery\n reports or replies matched to the message. This can be used to create powerful two-way messaging\n applications without having to store persistent data in the application. Up to 10 key / value metadata data\n pairs can be specified in a message. Each key can be up to 100 characters long, and each value up to \n 256 characters long. Specifying metadata for a message is optional.\n\nThe response body of a successful POST request to the messages endpoint will include a ```messages```\nproperty which contains a list of all messages submitted. The list of messages submitted will\nreflect the list of messages included in the request, but each message will also contain two new\nproperties, ```message_id``` and ```status```. The returned message ID will be a 36 character UUID\nwhich can be used to check the status of the message via the Get Message Status endpoint. The status\nof the message which reflect the status of the message at submission time which will always be\n```queued```. See the Delivery Reports section of this documentation for more information on message\nstatues.\n\n*Note: when sending multiple messages in a request, all messages must be valid for the request to be successful.\nIf any messages in the request are invalid, no messages will be sent.*"
},
"response": []
},
{
"name": "Get message status",
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{HOST}}/v1/messages/:messageId",
"host": [
"{{HOST}}"
],
"path": [
"v1",
"messages",
":messageId"
],
"variable": [
{
"key": "messageId",
"value": ""
}
]
},
"description": "Retrieve the current status of a message using the message ID returned in the send messages end point.\n\nA successful request to the get message status endpoint will return a response body as follows:\n\n```json\n{\n \"format\": \"SMS\",\n \"content\": \"My first message!\",\n \"metadata\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n },\n \"message_id\": \"877c19ef-fa2e-4cec-827a-e1df9b5509f7\",\n \"callback_url\": \"https://my.callback.url.com\",\n \"delivery_report\": true,\n \"destination_number\": \"+61401760575\",\n \"scheduled\": \"2016-11-03T11:49:02.807Z\",\n \"source_number\": \"+61491570157\",\n \"source_number_type\": \"INTERNATIONAL\",\n \"message_expiry_timestamp\": \"2016-11-03T11:49:02.807Z\",\n \"status\": \"enroute\"\n}\n```\n\nThe status property of the response indicates the current status of the message. See the Delivery\nReports section of this documentation for more information on message statues.\n\n*Note: If an invalid or non existent message ID parameter is specified in the request, then\na HTTP 404 Not Found response will be returned*"
},
"response": []
},
{
"name": "Cancel scheduled message",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"status\": \"cancelled\"\n}"
},
"url": {
"raw": "{{HOST}}/v1/messages/:messageId",
"host": [
"{{HOST}}"
],
"path": [
"v1",
"messages",
":messageId"
],
"variable": [
{
"key": "messageId",
"value": ""
}
]
},
"description": "Cancel a scheduled message that has not yet been delivered.\n\nA scheduled message can be cancelled by updating the status of a message from ```scheduled```\nto ```cancelled```. This is done by submitting a PUT request to the messages endpoint using\nthe message ID as a parameter (the same endpoint used above to retrieve the status of a message).\nThe body of the request simply needs to contain a ```status``` property with the value set\nto ```cancelled```.\n\n```json\n{\n \"status\": \"cancelled\"\n}\n```\n\n*Note: Only messages with a status of scheduled can be cancelled. If an invalid or non existent\nmessage ID parameter is specified in the request, then a HTTP 404 Not Found response will be \nreturned*"
},
"response": []
}
]
},
{
"name": "Replies",
"item": [
{
"name": "Check replies",
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{HOST}}/v1/replies",
"host": [
"{{HOST}}"
],
"path": [
"v1",
"replies"
]
},
"description": "Check for any replies that have been received.\n\nReplies are messages that have been sent from a handset in response to a message sent by an\napplication or messages that have been sent from a handset to a inbound number associated with\nan account, known as a dedicated inbound number (contact <[email protected]> for more\ninformation on dedicated inbound numbers).\n\nEach request to the check replies endpoint will return any replies received that have not yet\nbeen confirmed using the confirm replies endpoint. A response from the check replies endpoint\nwill have the following structure:\n\n```json\n{\n \"replies\": [\n {\n \"metadata\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n },\n \"message_id\": \"877c19ef-fa2e-4cec-827a-e1df9b5509f7\",\n \"reply_id\": \"a175e797-2b54-468b-9850-41a3eab32f74\",\n \"date_received\": \"2016-12-07T08:43:00.850Z\",\n \"callback_url\": \"https://my.callback.url.com\",\n \"destination_number\": \"+61491570156\",\n \"source_number\": \"+61491570157\",\n \"vendor_account_id\": {\n \"vendor_id\": \"MessageMedia\",\n \"account_id\": \"MyAccount\"\n },\n \"content\": \"My first reply!\"\n },\n {\n \"metadata\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n },\n \"message_id\": \"8f2f5927-2e16-4f1c-bd43-47dbe2a77ae4\",\n \"reply_id\": \"3d8d53d8-01d3-45dd-8cfa-4dfc81600f7f\",\n \"date_received\": \"2016-12-07T08:43:00.850Z\",\n \"callback_url\": \"https://my.callback.url.com\",\n \"destination_number\": \"+61491570157\",\n \"source_number\": \"+61491570158\",\n \"vendor_account_id\": {\n \"vendor_id\": \"MessageMedia\",\n \"account_id\": \"MyAccount\"\n },\n \"content\": \"My second reply!\"\n }\n ]\n}\n```\n\nEach reply will contain details about the reply message, as well as details of the message the reply was sent\nin response to, including any metadata specified. Every reply will have a reply ID to be used with the\nconfirm replies endpoint.\n\n*Note: The source number and destination number properties in a reply are the inverse of those\nspecified in the message the reply is in response to. The source number of the reply message is the\nsame as the destination number of the original message, and the destination number of the reply\nmessage is the same as the source number of the original message. If a source number\nwasn't specified in the original message, then the destination number property will not be present\nin the reply message.*\n\nSubsequent requests to the check replies endpoint will return the same reply messages and a maximum\nof 100 replies will be returned in each request. Applications should use the confirm replies endpoint\nin the following pattern so that replies that have been processed are no longer returned in\nsubsequent check replies requests.\n1. Call check replies endpoint\n2. Process each reply message\n3. Confirm all processed reply messages using the confirm replies endpoint\n\n*Note: It is recommended to use the Webhooks feature to receive reply messages rather than polling\nthe check replies endpoint.*"
},
"response": []
},
{
"name": "Confirm replies as received",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"reply_ids\": [\n \"011dcead-6988-4ad6-a1c7-6b6c68ea628d\",\n \"3487b3fa-6586-4979-a233-2d1b095c7718\",\n \"ba28e94b-c83d-4759-98e7-ff9c7edb87a1\"\n ]\n}"
},
"url": {
"raw": "{{HOST}}/v1/replies/confirmed",
"host": [
"{{HOST}}"
],
"path": [
"v1",
"replies",
"confirmed"
]
},
"description": "Mark a reply message as confirmed so it is no longer returned in check replies requests.\n\nThe confirm replies endpoint is intended to be used in conjunction with the check replies endpoint\nto allow for robust processing of reply messages. Once one or more reply messages have been processed\nthey can then be confirmed using the confirm replies endpoint so they are no longer returned in\nsubsequent check replies requests.\n\nThe confirm replies endpoint takes a list of reply IDs as follows:\n\n```json\n{\n \"reply_ids\": [\n \"011dcead-6988-4ad6-a1c7-6b6c68ea628d\",\n \"3487b3fa-6586-4979-a233-2d1b095c7718\",\n \"ba28e94b-c83d-4759-98e7-ff9c7edb87a1\"\n ]\n}\n```\n\nUp to 100 replies can be confirmed in a single confirm replies request."
},
"response": []
}
]
},
{
"name": "Delivery Reports",
"item": [
{
"name": "Check delivery reports",
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{HOST}}/v1/delivery_reports",
"host": [
"{{HOST}}"
],
"path": [
"v1",
"delivery_reports"
]
},
"description": "Check for any delivery reports that have been received.\n\nDelivery reports are a notification of the change in status of a message as it is being processed.\n\nEach request to the check delivery reports endpoint will return any delivery reports received that\nhave not yet been confirmed using the confirm delivery reports endpoint. A response from the check\ndelivery reports endpoint will have the following structure:\n\n```json\n{\n \"delivery_reports\": [\n {\n \"callback_url\": \"https://my.callback.url.com\",\n \"delivery_report_id\": \"01e1fa0a-6e27-4945-9cdb-18644b4de043\",\n \"source_number\": \"+61491570157\",\n \"date_received\": \"2017-05-20T06:30:37.642Z\",\n \"status\": \"enroute\",\n \"delay\": 0,\n \"submitted_date\": \"2017-05-20T06:30:37.639Z\",\n \"original_text\": \"My first message!\",\n \"message_id\": \"d781dcab-d9d8-4fb2-9e03-872f07ae94ba\",\n \"vendor_account_id\": {\n \"vendor_id\": \"MessageMedia\",\n \"account_id\": \"MyAccount\"\n },\n \"metadata\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n },\n {\n \"callback_url\": \"https://my.callback.url.com\",\n \"delivery_report_id\": \"0edf9022-7ccc-43e6-acab-480e93e98c1b\",\n \"source_number\": \"+61491570158\",\n \"date_received\": \"2017-05-21T01:46:42.579Z\",\n \"status\": \"enroute\",\n \"delay\": 0,\n \"submitted_date\": \"2017-05-21T01:46:42.574Z\",\n \"original_text\": \"My second message!\",\n \"message_id\": \"fbb3b3f5-b702-4d8b-ab44-65b2ee39a281\",\n \"vendor_account_id\": {\n \"vendor_id\": \"MessageMedia\",\n \"account_id\": \"MyAccount\"\n },\n \"metadata\": {\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n }\n }\n ]\n}\n```\n\nEach delivery report will contain details about the message, including any metadata specified\nand the new status of the message (as each delivery report indicates a change in status of a\nmessage) and the timestamp at which the status changed. Every delivery report will have a \nunique delivery report ID for use with the confirm delivery reports endpoint.\n\n*Note: The source number and destination number properties in a delivery report are the inverse of\nthose specified in the message that the delivery report relates to. The source number of the\ndelivery report is the destination number of the original message.*\n\nSubsequent requests to the check delivery reports endpoint will return the same delivery reports\nand a maximum of 100 delivery reports will be returned in each request. Applications should use the\nconfirm delivery reports endpoint in the following pattern so that delivery reports that have been\nprocessed are no longer returned in subsequent check delivery reports requests.\n1. Call check delivery reports endpoint\n2. Process each delivery report\n3. Confirm all processed delivery reports using the confirm delivery reports endpoint\n\n*Note: It is recommended to use the Webhooks feature to receive reply messages rather than\npolling the check delivery reports endpoint.*"
},
"response": []
},
{
"name": "Confirm delivery reports as received",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"delivery_report_ids\": [\n \"011dcead-6988-4ad6-a1c7-6b6c68ea628d\",\n \"3487b3fa-6586-4979-a233-2d1b095c7718\",\n \"ba28e94b-c83d-4759-98e7-ff9c7edb87a1\"\n ]\n}"
},
"url": {
"raw": "{{HOST}}/v1/delivery_reports/confirmed",
"host": [
"{{HOST}}"
],
"path": [
"v1",
"delivery_reports",
"confirmed"
]
},
"description": "Mark a delivery report as confirmed so it is no longer return in check delivery reports requests.\n\nThe confirm delivery reports endpoint is intended to be used in conjunction with the check delivery\nreports endpoint to allow for robust processing of delivery reports. Once one or more delivery\nreports have been processed, they can then be confirmed using the confirm delivery reports endpoint so they\nare no longer returned in subsequent check delivery reports requests.\n\nThe confirm delivery reports endpoint takes a list of delivery report IDs as follows:\n\n```json\n{\n \"delivery_report_ids\": [\n \"011dcead-6988-4ad6-a1c7-6b6c68ea628d\",\n \"3487b3fa-6586-4979-a233-2d1b095c7718\",\n \"ba28e94b-c83d-4759-98e7-ff9c7edb87a1\"\n ]\n}\n```\n\nUp to 100 delivery reports can be confirmed in a single confirm delivery reports request."
},
"response": []
}
],
"description": "Delivery Reports may carry an additional charge. For pricing, please contact your Account Manager or Support Team (<[email protected]>)"
}
]
}