-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsms_postman_collection.json
300 lines (300 loc) · 10.2 KB
/
sms_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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
{
"info": {
"_postman_id": "ab3149a3-76fa-4e84-a69f-249d6dcc935f",
"name": "Emarsys SMS Postman",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "campaigns",
"item": [
{
"name": "{campaign Id}",
"item": [
{
"name": "Launch SMS Campaign",
"request": {
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-WSSE",
"value": "{{wsse-header}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"status\": \"scheduled\",\n \"scheduled_to\": \"2022-02-28T08:52:00.000Z\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/campaigns/:campaignId",
"host": [
"{{baseUrl}}"
],
"path": [
"campaigns",
":campaignId"
],
"variable": [
{
"key": "campaignId",
"value": "lorem",
"description": "(Required) "
}
]
},
"description": "Lets you launch/schedule a *batch* campaign, or cancel its scheduled launch by updating the value of the **status** attribute the following way:\r\n\r\n**1.** To launch the campaign at a specific date (schedule a campaign):\r\n\r\n- {\r\n \"**status**\": \"*scheduled*\",\r\n \r\n \"**scheduled_to**\": \"2018-02-28T13:15:00.000Z\"\r\n}\r\n\r\n**2.** To launch the campaign immediately:\r\n\r\n - {\r\n \"**status**\": \"*triggered*\"\r\n}\r\n\r\n**3.** To cancel a scheduled launch:\r\n\r\n- {\r\n \"**status**\": \"*draft*\"\r\n}\r\n___\r\n**Mandatory parameters:**\r\n- **customerId**\r\n- **campaignId**\r\n- **status** (*draft* or *triggered*)\r\n___\r\nCampaigns with **type** *AC* must be triggered/scheduled/canceled through an AC program.\r\n\r\n**Note**: Only campaigns in *scheduled* state can be canceled."
},
"response": []
},
{
"name": "Update SMS Campaigns",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-WSSE",
"value": "{{wsse-header}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"type\": \"batch\",\n \"title\": \"test\",\n \"sender\": \"test\",\n \"message\": \"test\",\n \"deduplicate_recipients\": true,\n \"source_type\": \"segment\",\n \"source_id\": \"100025715\",\n \"unsubscribe\": {\n \"enabled\": true,\n \"title\": \"Unsubscribe\",\n \"text\": \"Are you sure you want to opt out of our SMS campains?\",\n \"button_text\": \"Opt-out\",\n \"after_text\": \"You've been removed from our SMS campaign list.\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/campaigns/:campaignId",
"host": [
"{{baseUrl}}"
],
"path": [
"campaigns",
":campaignId"
],
"variable": [
{
"key": "campaignId",
"value": "Lorem",
"description": "(Required) "
}
]
},
"description": "Lets you update an existing SMS campaign.\n\n---\n**Mandatory parameters**\n\nAt least one of the following:\n\n- **type**: the type can only be changed from *ac* to *batch* if no active AC program uses the campaign\n- **title**\n- **sender**\n-\t**message**\n-\t**deduplicate_recipients**\n-\t**source_type** (**source_type** and **source_id** must be present in the suite in case of *batch* campaigns, and must be *null* or undefined for campaigns with **type** *ac*)\n-\t**source_id**\n-\t**unsubscribe.enabled**\n-\t**unsubscribe.title**\n-\t**unsubscribe.text**\n-\t**unsubscribe.button_text**\n-\t**unsubscribe.after_text**\n\n---\n**Forbidden parameters**\n\nIn order to change the following parameters, a **Launch a Campaign** request must be made:\n-\t**status**\n- **scheduled_to**\n\n---\n**IMPORTANT**\nMake sure the following conditions apply:\n- The recipient source exists in the Suite if **source_type**|**source_id** is updated.\n-\ta campaign can only be updated while it is in either *draft** or *scheduled* state. If the campaign is in *scheduled* state, the **scheduled_to** date must be at least 1 minute in the future.\n- TWIG template syntax is used."
},
"response": []
},
{
"name": "Get SMS Campaign",
"request": {
"method": "GET",
"header": [
{
"key": "X-WSSE",
"value": "{{wsse-header}}",
"type": "text"
}
],
"url": {
"raw": "{{baseUrl}}/campaigns/:campaignId",
"host": [
"{{baseUrl}}"
],
"path": [
"campaigns",
":campaignId"
],
"variable": [
{
"key": "campaignId",
"value": "lorem",
"description": "(Required) "
}
]
},
"description": "Returns the SMS campaign with the specified campaign ID."
},
"response": []
}
]
},
{
"name": "List SMS Campaigns",
"request": {
"method": "GET",
"header": [
{
"key": "X-WSSE",
"value": "{{wsse-header}}",
"type": "text"
}
],
"url": {
"raw": "{{baseUrl}}/campaigns?limit=1&offset=1",
"host": [
"{{baseUrl}}"
],
"path": [
"campaigns"
],
"query": [
{
"key": "limit",
"value": "1",
"description": "(Required) Limits the number of SMS campaigns returned in the list."
},
{
"key": "offset",
"value": "1",
"description": "Used to skip a number of SMS campaigns before results are fetched (remember that campaigns are listed in a *latest first* fashion)."
}
]
},
"description": "Returns a list of ongoing SMS campaigns.\n\n**Example**\n\nhttps://api.emarsys.net/api/sms/campaigns?limit=1000&offset=0"
},
"response": []
},
{
"name": "Create SMS Campaign",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-WSSE",
"value": "{{wsse-header}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"type\": \"batch\",\n \"title\": \"Hello World\",\n \"sender\": \"test account\",\n \"message\": \"test message\",\n \"deduplicate_recipients\": true,\n \"source_type\": \"contactList\",\n \"source_id\": \"1234\",\n \"unsubscribe\": {\n \"enabled\": true,\n \"title\": \"Unsubscribe\",\n \"text\": \"Are you sure you want to opt out of our SMS campaigns?\",\n \"button_text\": \"Opt-out\",\n \"after_text\": \"You've been removed from our SMS campaign list.\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/campaigns",
"host": [
"{{baseUrl}}"
],
"path": [
"campaigns"
]
},
"description": "Lets you create an SMS campaign.\n\nMake sure the following conditions apply:\n- You are using all the mandatory parameters;\n- The\trecipient source exists in your Suite (in case of batch SMS sending);\n- **source_type** and **source_id** must be *null* or undefined in case of AC type requests;\n- TWIG template syntax is used."
},
"response": []
}
]
},
{
"name": "Query Inbound SMS Messages",
"request": {
"method": "GET",
"header": [
{
"key": "X-WSSE",
"value": "{{wsse-header}}",
"type": "text"
}
],
"url": {
"raw": "api.emarsys.net/api/sms/inbound-messages?limit=500&offset=10&startDate=&endDate=",
"host": [
"api",
"emarsys",
"net"
],
"path": [
"api",
"sms",
"inbound-messages"
],
"query": [
{
"key": "limit",
"value": "500",
"description": "The maximum number of inbound SMS fetched by request."
},
{
"key": "offset",
"value": "10",
"description": "The logic will start fetching after skipping the number of inbound sms messages specified here."
},
{
"key": "startDate",
"value": "",
"description": "All fetched inbound SMS messages will be newer than the date specified here.\nIt must be URL-encoded."
},
{
"key": "endDate",
"value": "",
"description": "All fetched inbound SMS messages will be older than the date specified here.\nIt must be URL-encoded."
}
]
},
"description": "Fetches inbound SMS messages in **latest first** order.\n\n**Example:**\n\napi.emarsys.net/api/sms/inbound-messages?limit=500&offset=100?startDate=2018-02-28T13%3A15%3A00.000Z&endDate=2018-03-05T00%3A00%3A00.000Z"
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"const crypto_js = require('crypto-js');",
"",
"var ts = (new Date()).toISOString();",
"",
"var nonce = crypto_js.lib.WordArray.random(16).toString(crypto_js.enc.Hex);",
"",
"var digest = crypto_js.enc.Base64.stringify(crypto_js.enc.Utf8.parse(crypto_js.SHA1(nonce + ts + pm.environment.get(\"wsse-secret\")).toString(crypto_js.enc.Hex)));",
"",
"pm.environment.set(\"wsse-header\",'UsernameToken Username=\"' + pm.environment.get(\"wsse-user\") + '\", PasswordDigest=\"' + digest + '\", Created=\"' + ts + '\", nonce=\"' + nonce + '\"');",
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
],
"variable": [
{
"key": "baseUrl",
"value": "https://api.emarsys.net/api/sms",
"type": "string"
}
]
}