You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -75,50 +81,28 @@ Siren constructor accepts the following arguments
75
81
</tbody>
76
82
</table>
77
83
78
-
```bash
79
-
const sirenInstance = new Siren({
80
-
token: "your-user-token",
81
-
recipientId: "your-recipient-id",
82
-
onError: (error) => {
83
-
# error callback function
84
-
});
85
-
actionCallbacks:{
86
-
onNotificationReceived: (response) => {
87
-
# handle the notification list
88
-
},
89
-
onUnViewedCountReceived:(response) => {
90
-
# handle the unviewed count response
91
-
},
92
-
},
93
-
```
94
-
To generate the token and recipientId, follow the below steps
95
-
1. Create a new in_app provider account or use an existing one. From the in_app provider account use the `providerIntegrationId`.
96
-
2. Create a new API_KEY or use an existing one.
97
-
3. Utilize the `providerIntegrationId` and `API_KEY` to make a POST request to the /api/v1/in-app/recipients API. This will generate the user_token and recipient_id.
98
-
4. Include the API_KEY as the bearer token in the authorization header of the request.
Method to verify validity of the passed tokens. Access to the remaining exposed functions is only granted after invoking this function. Upon successful verification, it returns a 'SUCCESS' string as data.
88
+
This method verifies the validity of the given tokens (recipientId and userToken).This method is called automatically while creating the instance . Once the verification is successful, the remaining exposed methods can be accessed.
109
89
```bash
110
90
await sirenInstance.verifyToken();
111
91
```
112
92
113
93
### 2. fetchUnviewedNotificationsCount
114
-
The method to retrieve the count of unviewed notifications
94
+
This method retrieves the count of unviewed notifications.
@@ -132,48 +116,45 @@ Method to fetch the paginated list of notifications
132
116
<tbody>
133
117
<tr>
134
118
<td>page</td>
135
-
<td>Represents current page</td>
119
+
<td>Current page</td>
136
120
<td>number</td>
137
121
<td>false</td>
138
122
<td>0</td>
139
123
</tr>
140
124
<tr>
141
125
<td>size</td>
142
-
<td>Number of items to be fetched in a single call</td>
126
+
<td>Number of items fetched </td>
143
127
<td>number</td>
144
128
<td>false</td>
145
129
<td>10</td>
146
130
</tr>
147
131
<tr>
148
132
<td>start</td>
149
-
<td>Accepts a date string and serves as a filter to fetch notifications created after the specified date. If no value is provided, it defaults to retrieving the first 10 notifications<br />
133
+
<td>Accepts an ISO date string to filter notifications created after the specified date. By default, only the first 20 notifications will be fetched <br />
150
134
eg: 2024-02-19T06:37:33.792+00:00</td>
151
135
<td>string</td>
152
136
<td>false</td>
153
137
<td>null</td>
154
138
</tr>
155
139
<tr>
156
140
<td>end</td>
157
-
<td>Accepts a date string and serves as a filter to fetch notifications created before the specified date. If no value is provided, it defaults to retrieving the first 10 notifications<br />
141
+
<td>Accepts an ISO date string to filter notifications created before the specified date. By default, only the first 20 notifications will be fetched <br />
158
142
eg: 2024-02-19T06:37:33.792+00:00</td>
159
143
<td>string</td>
160
144
<td>false</td>
161
145
<td>null</td>
162
146
</tr>
163
147
<tr>
164
148
<td>isRead</td>
165
-
<td>This filter is used to fetch onlyread or unread notifications. If not specified, it retrieves both read and unread notifications</td>
166
-
<td>number</td>
149
+
<td>Filter to fetch read or unread notifications. If not specified, it retrieves both read and unread notifications</td>
The notifications received can be subscribed using the `onNotificationReceived` actionCallback.
184
+
199
185
<table>
200
186
<thead>
201
187
<tr>
@@ -223,82 +209,77 @@ Method to initiate the real-time fetching of notifications
223
209
</tr>
224
210
<tr>
225
211
<td>start</td>
226
-
<td>Accepts a date string and serves as a filter to fetch notifications created before the specified date. If no value is provided, it defaults to retrieving the first 10 notifications</td>
212
+
<td>Accepts an ISO date string to filter notifications created after the specified date. By default, only the first 20 notifications will be fetched </td>
227
213
<td>string</td>
228
214
<td>false</td>
229
215
<td>null</td>
230
216
</tr>
231
217
<tr>
232
218
<td>end</td>
233
-
<td>Accepts a date string and serves as a filter to fetch notifications created before the specified date. If no value is provided, it defaults to retrieving the first 10 notifications</td>
219
+
<td>Accepts an ISO date string to filter notifications created before the specified date. By default, only the first 20 notifications will be fetched</td>
234
220
<td>string</td>
235
221
<td>false</td>
236
222
<td>null</td>
237
223
</tr>
238
224
<tr>
239
225
<td>isRead</td>
240
-
<td>This filter is used to fetch onlyread or unread notifications. If not specified, it retrieves both read and unread notifications</td>
226
+
<td>Filter to fetch read or unread notifications. If not specified, it retrieves both read and unread notifications</td>
These new notifications can be subscribed using the `onNotificationReceived` actionCallback.
252
-
253
234
### 5. startRealTimeUnviewedCountFetch
254
-
Method to initiate real-time tracking of unviewed notification count. It returns the count value after the last markNotificationsAsViewed functioncall. The count can be subscribed using the onUnViewedCountReceived actionCallback.
235
+
This method initiates the real-time fetching of unviewed notification count.The count can be subscribed using the onUnViewedCountReceived actionCallback. It returns the count after the last markNotificationsAsViewed functioncall.
0 commit comments