1
- # Messaging Exchange and Event Bus for Node.js & Python
1
+ # Messaging Exchange and Event Bus for Node.js & Reports in Python, PySpark
2
+
3
+ Subsystem of the SFPL growth and experimentation framework.
2
4
3
5
### 🔴 ; Important 🔴 ;
4
6
``` diff
5
7
- This project is a work in progress. Please come back shortly.
6
8
```
7
9
## Design
8
10
9
- Request -> Prioritization -> Triage (write [ messageid/dateuuid, owner] ; [ owner, msgs] , [ option Realtime, Nearline, scheduled, failed] , [ capture,reporting,recall] )
11
+ ** Essentially this is Optimizely for messaging**
12
+
13
+ Tracking messaging like we do the rest of internet traffic is essential to understanding our customers and optimizing growth. Messaging exchange (MSGXC) is a central system for dispatching and tracking all messgaing (currently supports iOS native, Android native, SMS, Email, Websockets, WebPush Notifications).
10
14
11
15
### Components
12
16
13
17
* Realtime
14
- * Websockets (Socket.io, uWebSockets)
18
+ * Websockets
15
19
* Web Notifications
16
20
* Native Messaging
17
21
* Nearline
@@ -25,7 +29,7 @@ Request -> Prioritization -> Triage (write [messageid/dateuuid, owner]; [owner,
25
29
* Native messaging receipts
26
30
* Offline
27
31
* PySpark Reports
28
- * Scheduler
32
+ * Scheduler
29
33
30
34
31
35
### Urgency
@@ -41,7 +45,9 @@ Request -> Prioritization -> Triage (write [messageid/dateuuid, owner]; [owner,
41
45
42
46
Run ``` docker-compose up ``` in the root of this project to get elassandra (cassandra with elastic search), and NATS.io working.
43
47
44
- ### API
48
+ ## API
49
+
50
+ ### User Functions
45
51
46
52
#### GETs
47
53
@@ -57,6 +63,91 @@ Checks whether the server is up.
57
63
``` 200 ```
58
64
59
65
66
+ #### POSTs
67
+
68
+ ##### Enlist
69
+ _ Requires Any JWT_
70
+ ```
71
+ /api/v1/enlist
72
+ ```
73
+
74
+ Enlists a user's devices including web-browsers, native android/os, to receive messages.
75
+
76
+ ** Request body:**
77
+ ```
78
+ {"os": "ios", "token": "ad62ea6ea23d6974871cf59a06cbdb2783b85adbafe3355c0007362249d3e75c"}
79
+
80
+ *or*
81
+
82
+ {"os": "android", "token": "e_nslPZejyM:APA91bHR-znf4EuSIKeY9dzlX4cupXA5cdsW1SzOHUFRrsteaL5WDuzsh_cnpVpQC3IPcewl_v3N0kbArC67UTEW_ENt5Ej5Sn0qi1RoRHv5beLNi9y4OzZ__T3SH3tW5gwqxn2Hap01"}
83
+
84
+ *or*
85
+
86
+ {
87
+ endpoint: 'https://fcm.googleapis.com/fcm/send/czVGxJOoycA:APA91bGZt8FZU2fEAnDCr1PdRb7HDtayoGDUO1dy6vjTu1sDKhGAAB0i2nXw_jGKhnzmh5rmK4klsyaRQaUpM0oS0VYGBCTTpF-nkP67UEW7BX9o7vNatcPuiG-yHa75hXE80B5F7DNi',
88
+ expirationTime: null,
89
+ keys: {
90
+ p256dh: 'BN81HfHxzt4V4lXDV_2ia8Rl_QvqofvoNI7_MOHCiOMEYuFXFNDBOJzKCCj2nzK5luwnH6rvBCN2jx7lNHpraaw',
91
+ auth: '0ywNrBxQ-rm4skkHDJB5lw'
92
+ }
93
+ }
94
+ ```
95
+
96
+ ** Correct Response:**
97
+ ``` true ```
98
+
99
+ ##### Publish
100
+ _ Requires Any JWT_
101
+ ```
102
+ /api/v1/publish
103
+ ```
104
+
105
+ Publish a message to a thread (this sends a message to the mthread).
106
+
107
+ ** Request body:**
108
+ ```
109
+ {"tid": "5ae3c890-5e55-11ea-9283-4fa18a847130", "msg":"the message you want to send", "opts", { }}
110
+ ```
111
+
112
+ ** Correct Response:**
113
+ ``` true ```
114
+
115
+
116
+ ##### Subscribe
117
+ _ Requires Any JWT_
118
+ ```
119
+ /api/v1/subscribe
120
+ ```
121
+
122
+ Subscribe a user to a thread (this adds a user to the subs column in mthreads).
123
+
124
+ ** Request body:**
125
+ ```
126
+ {"tid": "5ae3c890-5e55-11ea-9283-4fa18a847130"}
127
+ ```
128
+
129
+ ** Correct Response:**
130
+ ``` true ```
131
+
132
+
133
+ ##### Unubscribe
134
+ _ Requires Any JWT_
135
+ ```
136
+ /api/v1/unsubscribe
137
+ ```
138
+
139
+ Unsubscribe a user from a thread (this removes a user from the subs column in mthreads).
140
+
141
+ ** Request body:**
142
+ ```
143
+ {"tid": "5ae3c890-5e55-11ea-9283-4fa18a847130"}
144
+ ```
145
+
146
+ ** Correct Response:**
147
+ ``` true ```
148
+
149
+ ### Admin Functions
150
+
60
151
#### POSTs
61
152
62
153
##### BROADCAST
@@ -96,7 +187,7 @@ opts _Optional_
96
187
``` true ```
97
188
98
189
##### SEND
99
- _ Requires Any JWT_
190
+ _ Requires Admin JWT_
100
191
```
101
192
/api/v1/send
102
193
```
@@ -114,39 +205,10 @@ opts _Optional_
114
205
** Correct Response:**
115
206
``` true ```
116
207
117
- ##### SUBSCRIBE-NATIVE
118
- _ Requires Any JWT_
119
- ```
120
- /api/v1/native/subscribe
121
- ```
122
-
123
- Subscribes a user to native messaging using their current device.
124
-
125
- ** Request body:**
126
- ```
127
- {"os": "ios", "token": "ad62ea6ea23d6974871cf59a06cbdb2783b85adbafe3355c0007362249d3e75c"}
128
-
129
- or
130
-
131
- {"os": "android", "token": "e_nslPZejyM:APA91bHR-znf4EuSIKeY9dzlX4cupXA5cdsW1SzOHUFRrsteaL5WDuzsh_cnpVpQC3IPcewl_v3N0kbArC67UTEW_ENt5Ej5Sn0qi1RoRHv5beLNi9y4OzZ__T3SH3tW5gwqxn2Hap01"}
132
-
133
- or
134
-
135
- {
136
- endpoint: 'https://fcm.googleapis.com/fcm/send/czVGxJOoycA:APA91bGZt8FZU2fEAnDCr1PdRb7HDtayoGDUO1dy6vjTu1sDKhGAAB0i2nXw_jGKhnzmh5rmK4klsyaRQaUpM0oS0VYGBCTTpF-nkP67UEW7BX9o7vNatcPuiG-yHa75hXE80B5F7DNi',
137
- expirationTime: null,
138
- keys: {
139
- p256dh: 'BN81HfHxzt4V4lXDV_2ia8Rl_QvqofvoNI7_MOHCiOMEYuFXFNDBOJzKCCj2nzK5luwnH6rvBCN2jx7lNHpraaw',
140
- auth: '0ywNrBxQ-rm4skkHDJB5lw'
141
- }
142
- }
143
- ```
144
-
145
- ** Correct Response:**
146
- ``` true ```
147
-
148
208
## TODO
149
209
210
+ - [ ] Request -> Prioritization -> Triage (write [ messageid/dateuuid, owner] ; [ owner, msgs] , [ option Realtime, Nearline, scheduled, failed] , [ tracking,capture,reporting,recall] )
211
+ - [ ] Scheduler
150
212
- [ ] Processing in batches
151
213
- [ ] Multicast using elastic search (instead of slower CQL)
152
214
- [x] Add web notifications and SMS (Amazon/Twilio)
0 commit comments