-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathopenapi.yaml
13619 lines (13253 loc) · 533 KB
/
openapi.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
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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
info:
description: 'Whispir Platform API for cross channel and multi channel communications. Documentation on each endpoint is available at https://developers.whispir.com.'
x-release-please-start-version: true
version: 1.2.1
x-release-please-end: true
title: Whispir Platform API
termsOfService: 'https://www.whispir.com/terms-of-service'
contact:
email: [email protected]
name: Whispir Support
url: 'https://www.whispir.com/support'
license:
name: MIT
url: 'https://opensource.org/licenses/MIT'
tags:
- name: Messages
description: Communications are the core of what the Whispir Platform API offers as a service to customers.
externalDocs:
url: 'https://developers.whispir.com/c2NoOjE0NDgyNjQ-message'
- name: Resources
description: 'Using Whispir’s API, one can submit data payloads to be stored by Whispir and used in various API calls. These files are uploaded through the /resources endpoint.'
externalDocs:
url: 'https://developers.whispir.com/c2NoOjI0NTEwMjA-resource'
- name: Templates
description: 'Using the Whispir Platform API, messages can be stored as Message Templates that can be easily referenced within your API calls.'
externalDocs:
url: 'https://developers.whispir.com/c2NoOjM0ODAzNDA4-template'
- name: Response Rules
description: Using Response Rules in combination with Message Templates allows users to automatically group responses to messages into different response groups for reporting purposes.
externalDocs:
url: 'https://developers.whispir.com/c2NoOjM4OTQzOTA1-response-rule'
- name: Contacts
description: 'Contacts form the core of the Whispir offerings. They make up the base data to which and from which all communications are performed. The Whispir API provides secure cloud based storage for your contact information. This can then easily be retrieved by any application or device that requires access, and has permission to do so.'
externalDocs:
url: 'https://developers.whispir.com/c2NoOjM0ODAzNDA5-contact'
- name: Keys
description: Keys are used to manage user access.
- name: Distribution Lists
description: Whispir’s API allows users to categorise their contacts into different groups to simplify the distribution of messages.
externalDocs:
url: 'https://developers.whispir.com/c2NoOjM4OTQzOTE5-distribution-list'
- name: Scenarios
description: 'Scenarios allows users to simplify the message delivery processes through automated one click communications. The process involves creating a fixed message or a message template combined with a contact or a distribution list. When the scenario is executed, the message is sent to the contacts.'
externalDocs:
url: 'https://developers.whispir.com/c2NoOjM4OTQzOTIw-scenario'
- name: Callbacks
description: Whispir utilises API Callbacks to send simple notifications to different registered services in the event that some change has occurred on the Whispir Platform.
externalDocs:
url: 'https://developers.whispir.com/c2NoOjM4OTQzOTIx-callback'
- name: Workspaces
description: 'Workspace allows application developers to create new work areas for the varying use cases of their application. They provides different functions that can be provided to users of the application, e.g. creating messages, executing scenarios, or viewing distribution lists.'
externalDocs:
url: 'https://developers.whispir.com/c2NoOjM4OTQzOTI0-workspace'
- name: Activities
description: 'Activities are all the individual changes, tasks, calls, messages.. just about everything performed in a given company workspaces. Each Activity log entry contains information about the workspace, the module (message, email, IVR..), the user who performed it, time stamps, description of the activity, and its status (success, fail) etc.'
externalDocs:
url: 'https://developers.whispir.com/c2NoOjQ2MzAxMjM-activity'
- name: Custom Lists
description: Custom Lists are user specific translations or preferred options in the various list controls used in the platform tool. These provide the freedom for the user to customize the list options in various modules like Messages and Events. These custom list either can complement or completely overwrite the existing list items.
externalDocs:
url: 'https://developers.whispir.com/b3A6Mzg5NDM5NzY-list-custom-lists'
- name: Users
description: 'Access to use the Whispir API, Platform and its features is strictly limited to user permission set. One needs to have proper permissions to access all the features provided by the platform, and when using the API, have appropriate permissions to modify the user attributes of themselves or others in their company workspaces.'
externalDocs:
url: 'https://developers.whispir.com/c2NoOjU4ODQwOQ-user'
- name: Events
description: 'Whispir’s Events API allows users to capture, create and manage Events (including Incidents, Issues, Places, and Assets). Link multi-channel communications to each event to track report and disseminate information textually and Geo-spatially.'
externalDocs:
url: 'https://developers.whispir.com/c2NoOjY5MTI5NA-event'
- name: Imports
description: The Imports endpoint allows users to import a CSV/JSON/XML file of contacts (via /resources) to be added to the contacts database.
externalDocs:
url: 'https://developers.whispir.com/c2NoOjM4OTQzOTI4-import'
- name: Auth
description: The Auth endpoint allows users to retrieve and verify a JWT authentication token.
externalDocs:
url: 'https://developers.whispir.com/b3A6NDEyMTEzOA-create-an-auth-token'
- name: Verify
description: This service enables the API client to generate and send codes to the recipient and have it verified through another endpoint.
externalDocs:
url: 'https://developers.whispir.com/pk6eca8bz1c3k-send-code'
paths:
'/workspaces/{workspaceId}/messages':
post:
tags:
- Messages
x-sdkOperation: create
x-isPost: true
summary: Send a message
description: |-
Communications are the core of what the Whispir Platform API offers as a service to customers.
Whispir has the ability to send communications across 7 different channels in a single API request:
- **SMS** - up to 1600 characters per message, premium routes, delivery receipts
- **Email** - free email messaging with HTML and Plain Text support
- **Voice** - high quality outbound voice calls delivered to mobiles and landlines within seconds
- **Rich Messages** - personalised, targeted rich messaging to drive conversations
- **Twitter** - support for instant publishing to multiple twitter accounts
- **Facebook** - simplify the process of publishing to multiple facebook accounts instantaneously
- **RSS** - easily generate RSS feeds for consumption by other services
- **WhatsApp** - send templated WhatsApp messages
All communications are driven from the Messages endpoint resources within the API. This endpoint allows a user to perform the following tasks:
1. Create and send a new message
2. Retrieve a list of previously sent messages
* * *
### Using Templates
Messages can simply specify the `messageTemplateId` in the messages request, instead of specifying the entire content payload.
The message template can then easily be changed (using either another API request or by logging in to the Whispir Platform) and the part of the application sending the messages does not need to be altered.
* * *
### Callback Parameters
The callback API allows you to pass in any values (parameters), which you want to be returned as is, included in the callback response.
* * *
### Using Events
Once you have created an [Event](./openapi.yaml/paths/~1workspaces~1{workspaceId}~1events/post) in the Whispir Platform, the next logical step is to be able to deliver a notification about the event.
```json
{
"to": "+1000000000",
"subject": "Event Notification",
"eventId": "2EE7FEA3343662BE",
"body": "An event has occurred: @@summary@@. A resolution is required by @@actionDate1@@."
}
```
* * *
### Message Variables
Whispir allows the use of message variables to dynamically customise the content in a message. Available variables include [Native Tags](#native-tags), [System Tags](#system-tags), and [Custom Tags](#custom-tags). Each of these variables are described in the following sections.
#### Native Tags
When sending messages using the Whispir API you can automatically customise your communications including recipients information as part of the message. This is facilitated by the Whispir's native message variables [or native tags] that will be resolved against the recipients MRIs.
> **IMPORTANT**: the following tags can be included in any SMS, email or voice message. They are NOT meant to be used in rich messages. In this case recipient-specific fields can be populated using the Whispir JavaScript API.
Contact Tag | Description
---------|----------
@@first_name@@ | Recipient’s first name. <br/> For example, John.
@@last_name@@ | Recipient’s last name. <br/> For example, Smith.
@@recipient_email@@ | Recipient’s primary email address.<br/>For example, [email protected]
@@recipient_sms@@ | Recipient’s primary mobile phone number. <br/><br/>For example, 61400400400.
@@recipient_voice@@ | Recipient’s primary phone number for voice calls.<br/><br/> For example, 61400400400.
@@pin@@ | Whispir message retrieval service call back PIN (only populated when voice is used). <br/><br/> For example, 1234.
@@recipient_role@@ | Resolves to the recipient’s ‘Role’ field.<br/><br/> For example, Manager.
@@recipient_additionalrole@@ | Resolves to the recipient’s ‘Additional Role’ field. <br/><br/>For example, Team Leader.
@@team_name1@@ | Resolves to the recipient’s ‘Team Name’ field.<br/><br/> For example, Red Team.
@@messagelabel@@| Resolves to the label field of the sent message. <br/><br/>For example, Incident #1234.
@@messagecategories@@ | Resolves to the list of categories used in the message, separated with commas. <br/><br/>For example, Product Update.
@@web_link@@ | Resolves to a generated link for the web channel content. This can be used for one-click unsubscribe.<br /><br />For example, <pre>https://<region>.whispir.com/unsubscribe?_parameters=value</pre>
``` JSON
POST https://api.<region>.whispir.com/workspaces/{workspaceId}/messages
Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk
x-api-key: your_api_key
Content-Type: application/vnd.whispir.message-v1+json
Accept: application/vnd.whispir.message-v1+json
{
"to" : "[email protected]",
"subject" : "Test SMS Message with tags",
"body" : "Hi @@first_name@@. This is your message."
}
```
``` XML
POST https://api.<region>.whispir.com/workspaces/{workspaceId}/messages
Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk
x-api-key: your_api_key
Content-Type: application/vnd.whispir.message-v1+xml
Accept: application/vnd.whispir.message-v1+xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:message xmlns:ns2="http://schemas.api.whispir.com">
<to>[email protected]</to>
<subject>Test SMS Message with tags</subject>
<body>Hi @@first_name@@. This is your message.</body>
</ns2:message>
```
The main difference with the examples seen so far is given here by the `to` field of the payloads, where a Contact MRI is specified. This reference allows the Whispir platform to inspect the Contact to retrieve the Contact tags.
* * *
#### System Tags
When sending messages using the Whispir API, you can automatically include system-generated information via system variables. Each of them will resolve to the value obtained when you send the message. Unlike the preceding ones, they don't depend from the Contacts information stored in Whispir, so they can be included also in messages where the recipients are not represented by their MRI.
System Tag | Description|
---------|----------
@@dd@@| Current day with leading zero. <br/> For example, 08.
@@mm@@ | Current month with leading zero. <br/> For example, 06.
@@yy@@| Current year, short form.<br/>For example, 22.
@@yyyy@@| Current year, long form. <br/><br/>For example, 2022.
@@day@@ | Day in spoken form.<br/><br/> For example, Wednesday.
@@month@@| Month in spoken form. <br/><br/> For example, January.
@@hrs@@| Current hour with leading zero, in 24 hour format.<br/><br/> For example, 16.
@@min@@ | Current minute with leading zero.<br/><br/> For example, 45.
@@date@ | Current date in format (yyyy-mm-dd)<br/><br/> For example, 2022-02-02.
@@time@@| Current time in 24-hour format. <br/><br/>For example, 16:37.
* * *
#### Custom Tags
Using message attributes and message Templates allows developers to cleanly separate these responsibilities. This is done by combining the message channels being used for the message and the data driving the message.
Under the operational point of view this solution is achieved with two steps:
1. Creating a Template including attributes
2. Using the Template and replacing the values for the attributes
Whispir’s API customers can simplify their requests by using the message attributes directly from the API.
Using message attributes allows to achieve flexibility in the communications. With this solution, Developers just need to take care of the data behind a message while the Marketing team can focus on the presentation or messaging channels within the message.
> Unlike native tags, user-defined attributes require Whispir administrative assistance to enable and are configured at the account level. Please contact your Whispir account manager or the [Whispir Support Team](mailto:[email protected]) if interested in using them. Whispir’s API only accepts message attributes containing alpha-numeric ASCII characters.
We are about to see a full example where an initial fixed message has been adapted to be reusable.
**Without Custom Tags**
```JSON
POST http://api.<region>.whispir.com/workspaces/{workspaceId}/messages
Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk
x-api-key: your_api_key
Content-Type: application/vnd.whispir.message-v1+json
Accept: application/vnd.whispir.message-v1+json
{
"to" : "[email protected]",
"subject" : "Reminder",
"body" : "Your invitation to the Acme Event will expire on 13/06/2019 at 23:59:59",
"email" : {
"type" : "text/plain",
"body" : "Your invitation to the Acme Event will expire on 13/06/2019 at 23:59:59"
}
}
```
```XML
POST http://api.<region>.whispir.com/workspaces/{workspaceId}/messages
Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk
x-api-key: your_api_key
Content-Type: application/vnd.whispir.message-v1+xml
Accept: application/vnd.whispir.message-v1+xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:message xmlns:ns2="http://schemas.api.whispir.com">
<to>[email protected]</to>
<subject>Reminder</subject>
<body>Your invitation to the Acme Event will expire on 13/06/2019 at 23:59:59</body>
<email>
<type>text/plain</type>
<body>Your invitation to the Acme Event will expire on 13/06/2019 at 23:59:59</body>
</email>
</ns2:message>
```
**With Custom Tags**
#### Using Message Variables in Templates
```JSON
Step 1 - Creating a Template including the attributes
POST http://api.<region>.whispir.com/workspaces/{workspaceId}/templates
Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk
x-api-key: your_api_key
Content-Type: application/vnd.whispir.template-v1+json
Accept: application/vnd.whispir.template-v1+json
{
"messageTemplateName" : "Event Reminder",
"subject" : "Reminder:",
"body" : "Your invitation to the Acme Event will expire on @@event_expiry@@ at @@event_expiry_time@@",
"email" : {
"type" : "text/plain",
"body" : "Your invitation to the Acme Event will expire on @@event_expiry@@."
}
}
Response - template created
201 - Created
Location: http://api.<region>.whispir.com/workspaces/{workspaceId}/templates/DACADB02209CC93C
{
...
"id": "DACADB02209CC93C",
...
}
Step 2 - Using Template including attributes to send the message
POST http://api.<region>.whispir.com/workspaces/{workspaceId}/messages
Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk
x-api-key: your_api_key
Content-Type: application/vnd.whispir.message-v1+json
Accept: application/vnd.whispir.message-v1+json
{
"to" : "[email protected]",
"messageTemplateId" : "DACADB02209CC93C",
"messageattributes" : {
"attribute" : [{
"name" : "event_expiry",
"value" : "13/06/2019"
},{
"name" : "event_expiry_time",
"value" : "23:59:59"
}]
}
}
```
```XML
Step 1 - Creating a Template including attributes
POST http://api.<region>.whispir.com/workspaces/{workspaceId}/templates
Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk
x-api-key: your_api_key
Content-Type: application/vnd.whispir.template-v1+xml
Accept: application/vnd.whispir.template-v1+xml
<?xml version="1.0" encoding="UTF-8"?>
<ns3:template xmlns:ns3="http://schemas.api.whispir.com"
xmlns:ns2="http://schemas.api.whispir.com/dap">
<messageTemplateName>Event Reminder</messageTemplateName>
<subject>Reminder</subject>
<body>Your invitation to the Acme Event will expire on @@event_expiry@@ at @@event_expiry_time@@</body>
<email>
<type>text/plain</type>
<body>Your invitation to the Acme Event will expire on @@event_expiry@@ at @@event_expiry_time@@</body>
</email>
</ns3:template>
Response - template created
201 - Created
Location: http://api.<region>.whispir.com/workspaces/{workspaceId}/templates/DACADB02209CC93C
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns3:template xmlns:ns2="http://schemas.api.whispir.com/dap" xmlns:ns3="http://schemas.api.whispir.com">
...
<id>DACADB02209CC93C</id>
...
<ns3:template>
Step 2 - Using Template including attributes to send the message
POST http://api.<region>.whispir.com/workspaces/{workspaceId}/messages
Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk
x-api-key: your_api_key
Content-Type: application/vnd.whispir.message-v1+xml
Accept: application/vnd.whispir.message-v1+xml
<?xml version="1.0" encoding="UTF-8"?>
<ns3:template xmlns:ns3="http://schemas.api.whispir.com"
xmlns:ns2="http://schemas.api.whispir.com/dap">
<to>[email protected]</to>
<messageTemplateId>DACADB02209CC93C</messageTemplateId>
<messageattributes>
<attribute>
<element>
<name>@@event_expiry@@</name>
<value>13/06/2019</value>
</element>
<element>
<name>@@event_expiry_time@@</name>
<value>23:59:59</value>
</element>
</attribute>
</messageattributes>
<ns3:template>
```
Using this message template ID and now using the message attribute @@event_expiry@@, the updated code example (combining the message template and message attribute) is far simpler to implement and is more efficient.
* * *
### Scheduled Messages
#### Timezone - Scheduling rules
Using the Whispir API you can schedule messages to be sent later, both once or repeatedly with the possibility to specify the interval between the sessions. The service is available for SMS, email, voice, rich messages
A message is scheduled according to the timezone set in the Whispir account of the user who initiates the message request. This setting can be found in the Whispir Portal under "Settings"->"User Manager"->"View/Edit". Whispir DOES NOT honor the timezone where the sender or the message recipient are currently located in
For example if the user’s time zone is set to UTC in their Whispir profile then messages are scheduled to be sent as per UTC, even if the user triggers the message while sitting in Singapore (+8). So please ensure that any scheduled communication is sent at the appropriate/preferred time
Also, changing the user's timezone setting after the message is triggered DOES NOT change the original scheduled time.
#### Sending messages at a later date
```JSON
POST https://api.<region>.whispir.com/workspaces/{workspaceId}/messages
Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk
x-api-key: your_api_key
Content-Type: application/vnd.whispir.message-v1+json
Accept: application/vnd.whispir.message-v1+json
ONCE
In this sample we will schedule a single message to be delivered at 3:55pm on 14 February 2019
{
"to" : "[email protected]",
"subject" : "Test scheduled email message",
"email" : {
"body" : "This is my scheduled content",
"type" : "text/plain"
},
"messageType" : "SCHEDULED",
"scheduleType" : "ONCE",
"scheduleDate" : "14/02/2019 15:55"
}
REPEAT
In this sample we will will schedule 10 messages to be delivered every hour starting from 3:55pm on 14 February 2019
{
"to" : "[email protected]",
"subject" : "Test scheduled email message",
"email" : {
"body" : "This is my scheduled content",
"type" : "text/plain"
},
"messageType" : "SCHEDULED",
"scheduleType" : "REPEAT",
"scheduleDate" : "14/02/2019 15:55",
"repetitionCount" : "10",
"repeatDays" : "0",
"repeatHrs" : "1",
"repeatMin" : "0"
}
```
```XML
POST https://api.<region>.whispir.com/workspaces/{workspaceId}/messages
Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk
x-api-key: your_api_key
Content-Type: application/vnd.whispir.message-v1+json
Accept: application/vnd.whispir.message-v1+json
ONCE
In this sample we will schedule a single message to be delivered at 3:55pm on 14 February 2019
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:message xmlns:ns2="http://schemas.api.whispir.com" xmlns:ns3="http://schemas.api.whispir.com/dap">
<to>[email protected]</to>
<subject>Test scheduled email message</subject>
<email>
<body>This is my scheduled content</body>
<type>text/plain</type>
</email>
<messageType>SCHEDULED</messageType>
<scheduleType>ONCE</scheduleType>
<scheduleDate>14/02/2019 15:55</scheduleDate>
</ns2:message>
REPEAT
In this sample we will will schedule 10 messages to be delivered every hour starting from 3:55pm on 14 February 2019
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:message xmlns:ns2="http://schemas.api.whispir.com" xmlns:ns3="http://schemas.api.whispir.com/dap">
<to>[email protected]</to>
<subject>Test scheduled email message</subject>
<email>
<body>This is my scheduled content</body>
<type>text/plain</type>
</email>
<messageType>SCHEDULED</messageType>
<scheduleType>REPEAT</scheduleType>
<scheduleDate>14/02/2019 15:55</scheduleDate>
<repetitionCount>10</repetitionCount>
<repeatDays>0</repeatDays>
<repeatHrs>1</repeatHrs>
<repeatMin>0</repeatMin>
</ns2:message>
```
* * *
### Opt-out and Unsubscribe
Whispir provides a way for clients who require sending to a marketing email to include two new headers as directed by mail inboxes providers.
It creates a way for recipients to opt out of email lists easily, which will add up to a sender's reputation and deliverability.
This additional request body is optional under the `email` property.
```JSON
POST https://api.<region>.whispir.com/workspaces/{workspaceId}/messages
Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk
x-api-key: your_api_key
Content-Type: application/vnd.whispir.message-v1+json
Accept: application/vnd.whispir.message-v1+json
In this sample we will send a message with an opt out option property
{
"to" : "[email protected]",
"subject" : "Test Opt-out and Unsubscribe",
"email" : {
"body" : "This is a test message",
"type" : "text/plain"
"optOutOption": {
"rmsUnsubscribeUrl": "@@web_link@@#unsubscribe",
"oneClickApiMapping": "2ab64862"
}
},
"web": {
"type": "text/html",
"body": "<div class='content'>This is the body of my rich message</div>"
}
}
```
```XML
POST https://api.<region>.whispir.com/workspaces/{workspaceId}/messages
Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk
x-api-key: your_api_key
Content-Type: application/vnd.whispir.message-v1+xml
Accept: application/vnd.whispir.message-v1+xml
In this sample we will send a message with an opt out option property
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:message xmlns:ns2="http://schemas.api.whispir.com" xmlns:ns3="http://schemas.api.whispir.com/dap">
<to>[email protected]</to>
<subject>Test scheduled email message</subject>
<email>
<body>This is my scheduled content</body>
<type>text/plain</type>
<optOutOption>
<rmsUnsubscribeUrl>@@web_link@@#unsubscribe</rmsUnsubscribeUrl>
<oneClickApiMapping>2ab64862</oneClickApiMapping>
</optOutOption>
</email>
<web>
<type>text/html</type>
<body>
<div class='content'>This is the body of my rich message</div>
</body>
</web>
</ns2:message>
```
In this example we're utilizing the `@@web_link@@` tag that generates an unsubscribe link for the recipients.
The `web` payload is required when using the `@@web_link@@` value in the `email`.`optOutOption`.
The `rmsUnsubscribeUrl` is a URL link to the web channel unsubscribe content for `GET` requests, and for one-click unsubscribe functionality via `POST` requests.
The `oneClickApiMapping` property requires you to have an existing API Mapping and have access to its details. This API Mapping is triggered for one-click unsubscribe functionality.
Both the `rmsUnsubscribeUrl` and `oneClickApiMapping` properties are optional, but `rmsUnsubscribeUrl` is required to enable unsubscribe, `oneClickApiMapping` is required to enable one-click unsubscribe.
operationId: messageCreate
parameters:
- $ref: '#/components/parameters/X-Api-Key'
- $ref: '#/components/parameters/Message-Content-Type'
- $ref: '#/components/parameters/Message-Accept'
requestBody:
content:
application/vnd.whispir.message-v1+json:
schema:
$ref: '#/components/schemas/Message'
examples:
SMS:
value:
to: '61400400400'
subject: Test Message
body: This is the body of my test SMS message
Email:
value:
subject: Test Message
email:
body: This is the body of my test Email message
footer: This is the footer of my message
type: text/plain
Email with attachment:
value:
subject: Test Message
email:
body: This is the body of my test Email message
footer: This is the footer of my message
type: text/html
resources:
attachments:
- attachmentName: sample.json
attachmentDesc: Sample
derefUri: eyAKICAgICJzYW1wbGUiOiB0cnVlCn0=
Voice:
value:
to: '61400400400'
subject: Test Message
voice:
header: 'This is the introduction, read out to the recipient prior to any key press.'
body: 'This is the body of the voice call, read out after the key press'
type: 'Pin:,ConfCall:,ConfAccountNo:,ConfPinNo:,ConfModPinNo:'
SMS with Message Variables:
value:
subject: Test Message
body: Hi @@first_name@@. The current day is @@day@@.
SMS & Email:
value:
to: '61400400400,[email protected]'
subject: Test Message
body: This is the body of my test SMS message
email:
body: This is the body of my test Email message
footer: This is the footer of my message
type: text/plain
SMS & Web Page:
value:
to: '61400400400'
subject: Test Message
body: This is the body of my test SMS message. @@web_link@@
web:
body: This is the content of my web publishing or Rich Push Message
type: text/plain
SMS - Single Scheduled Message:
value:
to: '61400400400'
subject: Single Scheduled Message
body: This is a single scheduled SMS message.
messageType: SCHEDULED
scheduleType: ONCE
scheduleDate: '14/02/2019 15:55'
SMS - Repeated Scheduled Message:
value:
to: '61400400400'
subject: Repeated Scheduled Message
body: This is a repeated scheduled SMS message.
messageType: SCHEDULED
scheduleType: REPEAT
scheduleDate: '14/02/2019 15:55'
repetitionCount: 10
repeatDays: 0
repeatHrs: 1
repeatMin: 0
description: 'Message object needed to create message. At least one of the Body fields must be populated [SMS, email, voice or web].'
required: true
responses:
'200':
description: The response code for a message that is accepted for scheduled delivery.
content:
application/vnd.whispir.message-v1+json:
schema:
$ref: '#/components/schemas/Message'
examples:
Response:
value:
to: '61400400400'
subject: Repeated Scheduled Message
body: This is a repeated scheduled SMS message.
messageType: SCHEDULED
scheduleDate: '01/04/2022 13:40'
scheduleType: REPEAT
repetitionCount: 10
repeatDays: 0
repeatHrs: 0
repeatMin: 1
link:
- uri: 'https://api.au.whispir.com/workspaces/9A4C5521FFC7B15B/messages/89518B11A0458848AC3926AEAA48BA14'
rel: self
method: GET
host: api.au.whispir.com
port: -1
validBody: true
validSubject: true
whatsappValidMessage: true
headers:
Content-Type:
$ref: '#/components/headers/Message-Content-Type'
Content-Length:
$ref: '#/components/headers/Content-Length'
Access-Control-Allow-Origin:
$ref: '#/components/headers/Access-Control-Allow-Origin'
Cache-Control:
$ref: '#/components/headers/Cache-Control'
Expires:
$ref: '#/components/headers/Expires'
Location:
schema:
type: string
example: 'https://api.au.whispir.com/workspaces/9A4C5521FFC7B15B/messages/747AB7E716C1802B6476784AEB5C9BB8'
description: The URI to fetch details of the resource.
'202':
description: The response code for a message that is accepted for immediate delivery.
content:
application/vnd.whispir.message-v1+json:
schema:
type: string
enum:
- Your request has been accepted for processing
description: The status of the response acceptance.
examples:
Response:
value: Your request has been accepted for processing
headers:
Content-Type:
$ref: '#/components/headers/Message-Content-Type'
Content-Length:
$ref: '#/components/headers/Content-Length'
Access-Control-Allow-Origin:
$ref: '#/components/headers/Access-Control-Allow-Origin'
Cache-Control:
$ref: '#/components/headers/Cache-Control'
Expires:
$ref: '#/components/headers/Expires'
Location:
schema:
type: string
example: 'https://api.au.whispir.com/workspaces/9A4C5521FFC7B15B/messages/747AB7E716C1802B6476784AEB5C9BB8'
description: The URI to fetch details of the resource.
'400':
$ref: '#/components/responses/400BadRequest'
'401':
$ref: '#/components/responses/401Unauthorized'
'403':
$ref: '#/components/responses/403Forbidden'
'404':
$ref: '#/components/responses/404NotFound'
'405':
$ref: '#/components/responses/405MethodNotAllowed'
'413':
$ref: '#/components/responses/413EntityTooLarge'
'415':
$ref: '#/components/responses/415UnsupportedMediaType'
'422':
$ref: '#/components/responses/422UnprocessibleEntity'
'500':
$ref: '#/components/responses/500InternalServerError'
'501':
$ref: '#/components/responses/501MethodNotImplemented'
get:
tags:
- Messages
x-sdkOperation: list
summary: List messages
description: |-
List all sent messages for the workspace.
Pagination is available.
operationId: messageList
parameters:
- $ref: '#/components/parameters/X-Api-Key'
- $ref: '#/components/parameters/Message-Accept'
- $ref: '#/components/parameters/limit'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/sortOrder'
- $ref: '#/components/parameters/sortFields'
responses:
'200':
description: OK
content:
application/vnd.whispir.message-v1+json:
schema:
$ref: '#/components/schemas/MessageCollection'
examples:
Response:
value:
messages:
- subject: Test Message
to: '61400400400'
repetitionCount: 0
repeatDays: 0
repeatHrs: 0
repeatMin: 0
from: Test User
direction: OUTGOING
responseCount: '0'
createdTime: 1647467664000
link:
- uri: 'https://api.au.whispir.com/workspaces/9A4C5521FFC7B15B/messages/747AB7E716C1802B6476784AEB5C9BB8'
rel: self
method: GET
host: api.au.whispir.com
port: -1
whatsappValidMessage: true
validBody: true
validSubject: true
- subject: Test Message
to: '61400400400'
repetitionCount: 0
repeatDays: 0
repeatHrs: 0
repeatMin: 0
from: Test User
direction: OUTGOING
responseCount: '0'
createdTime: 1647466923000
link:
- uri: 'https://api.au.whispir.com/workspaces/9A4C5521FFC7B15B/messages/E9F52215AD0787EBECDD691916955C1E'
rel: self
method: GET
host: api.au.whispir.com
port: -1
whatsappValidMessage: true
validBody: true
validSubject: true
status: ''
link: []
headers:
Content-Type:
$ref: '#/components/headers/Message-Content-Type'
Content-Length:
$ref: '#/components/headers/Content-Length'
Access-Control-Allow-Origin:
$ref: '#/components/headers/Access-Control-Allow-Origin'
Cache-Control:
$ref: '#/components/headers/Cache-Control'
Expires:
$ref: '#/components/headers/Expires'
'400':
$ref: '#/components/responses/400BadRequest'
'401':
$ref: '#/components/responses/401Unauthorized'
'403':
$ref: '#/components/responses/403Forbidden'
'404':
$ref: '#/components/responses/404NotFound'
'405':
$ref: '#/components/responses/405MethodNotAllowed'
'413':
$ref: '#/components/responses/413EntityTooLarge'
'415':
$ref: '#/components/responses/415UnsupportedMediaType'
'422':
$ref: '#/components/responses/422UnprocessibleEntity'
'500':
$ref: '#/components/responses/500InternalServerError'
'501':
$ref: '#/components/responses/501MethodNotImplemented'
parameters:
- $ref: '#/components/parameters/workspaceId'
'/workspaces/{workspaceId}/messages/{messageId}':
get:
tags:
- Messages
x-sdkOperation: retrieve
summary: Retrieve a message
description: |-
Each of the URLs specified in the response can be accessed using the REL and appropriate METHOD to perform the specified functionality.
**Rel Attribute Descriptions**
* * *
- **self:** Retrieves the current message.
- **summaryStatus:** Returns the status information of the message as a messagestatus object, in a summary view.
- **detailedStatus:** Returns the status information of the message as a messagestatus object, in a detailed view.
- **summaryResponses:** Returns the response information of the message as a messageresponse object, in a summary view.
- **detailedResponses:** Returns the response information of the message as a messageresponse object, in a detailed view.
- **summaryResponsesWithResponseRule:** Returns the response information of the message as a messageresponse object, filtered by the Response Rule (if one was used) in a summary view.
- **detailedResponsesWithResponseRule:** Returns the response information of the message as a messageresponse object, filtered by the Response Rule (if one was used) in a detailed view.
operationId: messageRetrieve
responses:
'200':
description: OK
headers:
Content-Type:
$ref: '#/components/headers/Message-Content-Type'
Content-Length:
$ref: '#/components/headers/Content-Length'
Access-Control-Allow-Origin:
$ref: '#/components/headers/Access-Control-Allow-Origin'
Cache-Control:
$ref: '#/components/headers/Cache-Control'
Expires:
$ref: '#/components/headers/Expires'
content:
application/vnd.whispir.message-v1+json:
schema:
$ref: '#/components/schemas/Message'
examples:
Response:
value:
to: '61400400400'
subject: Test Message
body: This is the body of my test SMS message
label: ''
type: default
repetitionCount: 0
dlr:
period: ''
rule: ''
type: ''
publishToWeb: false
expiryDay: 0
expiryHour: 0
expiryMin: 0
feedIds: ''
bool: false
repeatDays: 0
repeatHrs: 0
repeatMin: 0
voice:
body: Test message
type: 'Pin:,ConfCall:,ConfAccountNo:,ConfPinNo:,ConfModPinNo:'
from: [email protected]
direction: OUTGOING
responseCount: '0'
social:
social:
- id: social
- id: social_long
createdTime: 1647466923000
link:
- uri: 'https://api.au.whispir.com/workspaces/9A4C5521FFC7B15B/messages/747AB7E716C1802B6476784AEB5C9BB8'
rel: self
method: GET
host: api.au.whispir.com
port: -1
- uri: 'https://api.au.whispir.com/workspaces/9A4C5521FFC7B15B/messages/747AB7E716C1802B6476784AEB5C9BB8/messagestatus?view=summary'
rel: summaryStatus
method: GET
host: api.au.whispir.com
port: -1
- uri: 'https://api.au.whispir.com/workspaces/9A4C5521FFC7B15B/messages/747AB7E716C1802B6476784AEB5C9BB8/messagestatus?view=detailed'
rel: detailedStatus
method: GET
host: api.au.whispir.com
port: -1
- uri: 'https://api.au.whispir.com/workspaces/9A4C5521FFC7B15B/messages/747AB7E716C1802B6476784AEB5C9BB8/messageresponses?view=summary&filter=default'
rel: summaryResponses
method: GET
host: api.au.whispir.com
port: -1
- uri: 'https://api.au.whispir.com/workspaces/9A4C5521FFC7B15B/messages/747AB7E716C1802B6476784AEB5C9BB8/messageresponses?view=detailed&filter=default'
rel: detailedResponses
method: GET
host: api.au.whispir.com
port: -1
- uri: 'https://api.au.whispir.com/workspaces/9A4C5521FFC7B15B/messages/747AB7E716C1802B6476784AEB5C9BB8/messageresponses?view=summary&filter=responserule'
rel: summaryResponsesWithResponseRule
method: GET
host: api.au.whispir.com
port: -1
- uri: 'https://api.au.whispir.com/workspaces/9A4C5521FFC7B15B/messages/747AB7E716C1802B6476784AEB5C9BB8/messageresponses?view=detailed&filter=responserule'
rel: detailedResponsesWithResponseRule
method: GET
host: api.au.whispir.com
port: -1
validBody: true
validSubject: true
whatsappValidMessage: true
'400':
$ref: '#/components/responses/400BadRequest'
'401':
$ref: '#/components/responses/401Unauthorized'
'403':
$ref: '#/components/responses/403Forbidden'
'404':
$ref: '#/components/responses/404NotFound'
'405':
$ref: '#/components/responses/405MethodNotAllowed'
'413':
$ref: '#/components/responses/413EntityTooLarge'
'415':
$ref: '#/components/responses/415UnsupportedMediaType'
'422':
$ref: '#/components/responses/422UnprocessibleEntity'
'500':
$ref: '#/components/responses/500InternalServerError'
'501':
$ref: '#/components/responses/501MethodNotImplemented'
parameters:
- $ref: '#/components/parameters/X-Api-Key'
- $ref: '#/components/parameters/Message-Accept'
- schema:
type: string
pattern: '^[A-F0-9]+'
name: messageId
in: path
required: true
description: The identifier for the message.
parameters:
- $ref: '#/components/parameters/workspaceId'
'/workspaces/{workspaceId}/messages/{messageId}/messagestatus':
get:
summary: List message status for a sent message
x-sdkOperation: listMessageStatus
description: |
Whispir will automatically monitor the status of each message after it has been sent to each recipient. Using the message status information, you are able to determine who received the message, what exact time they received it, on what message channel (SMS, Email, Voice, Web, Push Notification), whether they replied to the message, what time they replied, and on what messaging channel.
Each message progresses through various states, from Pending to Acknowledged.
### Message Status Descriptions
- **Pending (PENDING):** The message has not yet been processed by Whispir. It is in a queue and will be processed shortly.
- **Sent (SENT):** The message has been sent from Whispir to the recipient, however, there has been no acknowledgement from the recipient via read receipt that the message has arrived.
- **Received (DELIVRD):**
- **Email:** Whispir has received acknowledgement via a read receipt that the message has arrived in the inbox.
- **SMS:** Received status can mean one of two things for SMS.
1. The message has been received by the network and is being processed for delivery to the handset.
How long the message stays in this state is up to the telco.
2. The message has been received by the handset and confirmed by the telco.
- **Acknowledged (READ):** Whispir has received an intended response from the recipient, either by reply SMS, Email or Voice prompt
- **Undeliverable (FAILED):** Whispir was not able to deliver the message to the intended recipient on the specified channel. This may be due to incorrect information e.g. wrong phone number or email address, or due to poor network coverage.
Using the API, developers are able to access this status information at either a Summary or Detailed level.
The first thing a developer must do in order to retrieve the status of a sent message is retrieve the message using the API.
### Retrieve Summary Status
Using the links provided in the message response, the user can simply make a new API request to retrieve the summaryStatus URL.