Skip to content
This repository was archived by the owner on Aug 14, 2025. It is now read-only.

Commit 4b56d60

Browse files
authored
Merge pull request #183 from notificationapi-com/XXtycTeW/3435-update-send-code-samples-in-existing-docs-to-show-new-parameters
Update send function parameters in code examples
2 parents 0bcae96 + 64517c7 commit 4b56d60

File tree

7 files changed

+151
-151
lines changed

7 files changed

+151
-151
lines changed

docs/features/logs.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,19 @@ Call Specific Sub-Events:
5656

5757
## Custom Queries
5858

59-
Besides the predefined filters on the logs table, you can use any custom queries to dig deep. For example: `$.request.mergeTags.firstName="Jane"`
59+
Besides the predefined filters on the logs table, you can use any custom queries to dig deep. For example: `$.request.parameters.firstName="Jane"`
6060

6161
You can search for anything in the `$.request`, which contains the [original parameters you passed to send()](/reference/server.md#send). Here's an example of a `$.request` object:
6262

6363
```js title="$.request"
6464
{
65-
notificationId: '...',
66-
user: {
67-
id: '123',
65+
type: '...',
66+
to: {
67+
id: '123',
6868
6969
number: '+19999999999'
7070
},
71-
mergeTags: {
71+
parameters: {
7272
firstName: 'jane'
7373
}
7474
}
@@ -83,10 +83,10 @@ You can search for anything in the `$.request`, which contains the [original par
8383
##### Property Examples:
8484

8585
- `$.trackingId`
86-
- `$.request.notificationId`
87-
- `$.request.user.number`
88-
- `$.request.mergeTags.firstName`
89-
- `$.request.mergeTags.products[0].sku.title`
86+
- `$.request.type`
87+
- `$.request.to.number`
88+
- `$.request.parameters.firstName`
89+
- `$.request.parameters.products[0].sku.title`
9090

9191
##### Operators:
9292

@@ -105,6 +105,6 @@ A string or number. You can use `*` as a wildcard for string matching. Example:
105105
You can use `&&`, `||` and `()` to combine multiple queries. Examples:
106106

107107
```
108-
($.request.notificationId='new-user' && $.request.user.number='+19999999999') ||
109-
$.request.mergeTags.firstName="Jane"
108+
($.request.type='new-user' && $.request.to.number='+19999999999') ||
109+
$.request.parameters.firstName="Jane"
110110
```

docs/features/mergetags.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ You can use merge tags almost everywhere:
2626

2727
## Passing the values
2828

29-
Use the `mergeTags` fields in the SDKs or APIs to pass in dynamic data. You can even pass in very complex objects and arrays.
29+
Use the `parameters` fields in the SDKs or APIs to pass in dynamic data. You can even pass in very complex objects and arrays.
3030

3131
```js
3232
notificationapi.send({
3333
...,
34-
mergeTags: {
34+
parameters: {
3535
item: 'Krabby Patty Burger',
3636
address: '124 Conch Street',
3737
orderId: '1234567890'

docs/features/scheduling.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ values={[
3939

4040
```js
4141
notificationapi.send({
42-
notificationId: 'order_tracking',
43-
user: {
42+
type: 'order_tracking',
43+
to: {
4444
id: 'spongebob.squarepants',
4545
4646
number: '+15005550006'
4747
},
48-
mergeTags: {
48+
parameters: {
4949
item: 'Krabby Patty Burger',
5050
address: '124 Conch Street',
5151
orderId: '1234567890'
@@ -63,13 +63,13 @@ import asyncio
6363
async def send_notification():
6464
await notificationapi.send(
6565
{
66-
"notificationId": "order_tracking",
67-
"user": {
66+
"type": "order_tracking",
67+
"to": {
6868
"id": "spongebob.squarepants",
6969
"email": "[email protected]",
7070
"number": "+15005550006",
7171
},
72-
"mergeTags": {
72+
"parameters": {
7373
"item": "Krabby Patty Burger",
7474
"address": "124 Conch Street",
7575
"orderId": "1234567890"
@@ -87,13 +87,13 @@ asyncio.run(send_notification())
8787

8888
```php
8989
$notificationapi->send([
90-
"notificationId" => "order_tracking",
91-
"user" => [
90+
"type" => "order_tracking",
91+
"to" => [
9292
"id" => "spongebob.squarepants",
9393
"email" => "[email protected]",
9494
"number" => "+15005550006"
9595
],
96-
"mergeTags" => [
96+
"parameters" => [
9797
"item" => "Krabby Patty Burger",
9898
"address" => "124 Conch Street",
9999
"orderId" => "1234567890"
@@ -106,19 +106,19 @@ $notificationapi->send([
106106
<TabItem value="go">
107107

108108
```go
109-
mergeTags := make(map[string]interface{}) // Change to map[string]interface{}
110-
mergeTags["item"] = "Krabby Patty Burger"
111-
mergeTags["address"] = "124 Conch Street"
112-
mergeTags["orderId"] = "1234567890"
109+
parameters := make(map[string]interface{}) // Change to map[string]interface{}
110+
parameters["item"] = "Krabby Patty Burger"
111+
parameters["address"] = "124 Conch Street"
112+
parameters["orderId"] = "1234567890"
113113

114114
notificationapi.Send(
115115
notificationapi.SendRequest{
116-
NotificationId: "order_tracking",
117-
User: notificationapi.User{
116+
Type: "order_tracking",
117+
To: notificationapi.User{
118118
Id: "test_user_id",
119119
120120
},
121-
MergeTags: mergeTags,
121+
Parameters: parameters,
122122
Schedule: "2024-02-20T14:38:03.509Z"
123123
},
124124
)
@@ -129,12 +129,12 @@ notificationapi.Send(
129129

130130
```csharp
131131
string request = @"{
132-
""notificationId"": ""order_tracking"",
133-
""user"": {
132+
""type"": ""order_tracking"",
133+
""to"": {
134134
""id"": ""spongebob.squarepants"",
135135
""email"": ""[email protected]""
136136
},
137-
""mergeTags"": {
137+
""parameters"": {
138138
""item"": ""Krabby Patty Burger"",
139139
""address"": ""124 Conch Street"",
140140
""orderId"": ""1234567890""
@@ -149,13 +149,13 @@ notificationapi.send(request);
149149

150150
```ruby
151151
notificationapi.send({
152-
notificationId: 'order_tracking',
153-
user: {
152+
type: 'order_tracking',
153+
to: {
154154
id: 'spongebob.squarepants',
155155
156156
number: '+15005550006'
157157
},
158-
mergeTags: {
158+
parameters: {
159159
item: 'Krabby Patty Burger',
160160
address: '124 Conch Street',
161161
orderId: '1234567890'
@@ -181,14 +181,14 @@ Yes, with the `trackingId`, you can cancel a scheduled notification before it is
181181

182182
### How is error checking and logical operations handled with scheduled notifications?
183183

184-
Every notification request is evaluated for correct notificationId, being below the usage quota, valid user preferences, and more. For scheduled notifications, these checks are done twice:
184+
Every notification request is evaluated for correct type, being below the usage quota, valid user preferences, and more. For scheduled notifications, these checks are done twice:
185185

186186
1. Once at the time of receiving the initial request, similar to regular notifications. The results of this step can be found in the response body of your request and in our [log dashboard](logs.md).
187187
2. Once again at the scheduled time. The results of this step can also be found in our [log dashboard](logs.md).
188188

189189
The only exceptions are throttling and deduplication checks that only happen at the scheduled time.
190190

191-
So for example, an invalid `notificationId` error might be generated initially if the notificationId is incorrect, or later if the notification is deleted.
191+
So for example, an invalid `type` error might be generated initially if the type is incorrect, or later if the notification is deleted.
192192

193193
### How are logics managed for scheduled notifications?
194194

docs/quick-start/send-a-notification.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,14 @@ notificationapi.init('CLIENT_ID', 'CLIENT_SECRET');
243243
notificationapi.send({
244244
// The ID of the notification you wish to send.
245245
// You can find this value from the dashboard.
246-
notificationId: 'order_tracking',
246+
type: 'order_tracking',
247247
// The user to send the notification to.
248-
user: {
248+
to: {
249249
id: 'spongebob.squarepants',
250250
email: '[email protected]' //required for email notifications
251251
},
252-
// mergeTags is to pass dynamic values into the notification design.
253-
mergeTags: {
252+
// parameters is to pass dynamic values into the notification design.
253+
parameters: {
254254
item: 'Krabby Patty Burger',
255255
address: '124 Conch Street',
256256
orderId: '1234567890'
@@ -275,12 +275,12 @@ notificationapi.init("CLIENT_ID", "CLIENT_SECRET")
275275
async def send_notification():
276276
await notificationapi.send(
277277
{
278-
"notificationId": "order_tracking",
279-
"user": {
278+
"type": "order_tracking",
279+
"to": {
280280
"id": "spongebob.squarepants",
281281
"email": "[email protected]"
282282
},
283-
"mergeTags": {
283+
"parameters": {
284284
"item": "Krabby Patty Burger",
285285
"address": "124 Conch Street",
286286
"orderId": "1234567890"
@@ -308,15 +308,15 @@ $notificationapi = new NotificationAPI('CLIENT_ID', 'CLIENT_SECRET');
308308
$notificationapi->send([
309309
#The ID of the notification you wish to send. You can find this
310310
#value from the dashboard.
311-
"notificationId" => "order_tracking",
311+
"type" => "order_tracking",
312312
# The user to send the notification to.
313-
"user" => [
313+
"to" => [
314314
"id" => "spongebob.squarepants",
315315
"email" => "[email protected]", # required for email notifications
316316
"number" => "+15005550006" # optional phone number required to send SMS notifications
317317
],
318-
# mergeTags is to pass dynamic values into the notification design.
319-
"mergeTags" => [
318+
# parameters is to pass dynamic values into the notification design.
319+
"parameters" => [
320320
"item" => "Krabby Patty Burger",
321321
"address" => "124 Conch Street",
322322
"orderId" => "1234567890"
@@ -342,24 +342,24 @@ func main() {
342342
// if in EU Region, replace API URL with 'https://api.eu.notificationapi.com'
343343
notificationapi.Init("CLIENT_ID", "CLIENT_SECRET", "https://api.notificationapi.com")
344344

345-
// mergeTags is to pass dynamic values into the notification design.
346-
mergeTags := make(map[string]interface{})
347-
mergeTags["item"] = "Krabby Patty Burger"
348-
mergeTags["address"] = "124 Conch Street"
349-
mergeTags["orderId"] = "1234567890"
345+
// parameters is to pass dynamic values into the notification design.
346+
parameters := make(map[string]interface{})
347+
parameters["item"] = "Krabby Patty Burger"
348+
parameters["address"] = "124 Conch Street"
349+
parameters["orderId"] = "1234567890"
350350

351351
notificationapi.Send(
352352
notificationapi.SendRequest{
353353
// The ID of the notification you wish to send. You can find this
354354
// value from the dashboard.
355-
NotificationId: "order_tracking",
355+
Type: "order_tracking",
356356
// The user to send the notification to.
357-
User: notificationapi.User{
357+
To: notificationapi.User{
358358
Id: "spongebob.squarepants",
359359
360360
Number: "+15005550006" // Optional phone number required to send SMS notifications
361361
},
362-
MergeTags: mergeTags,
362+
Parameters: parameters,
363363
},
364364
)
365365
}
@@ -386,7 +386,7 @@ var user = new NotificationUser("spongebob.squarepants")
386386
TelephoneNumber = "+15005550006"
387387
};
388388

389-
var mergeTags = new Dictionary<string, object>
389+
var parameters = new Dictionary<string, object>
390390
{
391391
{ "item", "Krabby Patty Burger" },
392392
{ "address", "124 Conch Street" },
@@ -395,7 +395,7 @@ var mergeTags = new Dictionary<string, object>
395395

396396
await notificationApi.Send(new SendNotificationData("order_tracking", user)
397397
{
398-
MergeTags = mergeTags
398+
Parameters = parameters
399399
});
400400
```
401401

@@ -420,15 +420,15 @@ User user = new User("spongebob.squarepants")
420420
.setEmail("[email protected]") // required for email notifications
421421
.setNumber("+15005550006"); // optional phone number required to send SMS notifications
422422

423-
// Create merge tags
424-
Map<String, Object> mergeTags = new HashMap<>();
425-
mergeTags.put("item", "Krabby Patty Burger");
426-
mergeTags.put("address", "124 Conch Street");
427-
mergeTags.put("orderId", "1234567890");
423+
// Create parameters
424+
Map<String, Object> parameters = new HashMap<>();
425+
parameters.put("item", "Krabby Patty Burger");
426+
parameters.put("address", "124 Conch Street");
427+
parameters.put("orderId", "1234567890");
428428

429429
// Create and send notification request
430430
NotificationRequest request = new NotificationRequest("order_tracking", user)
431-
.setMergeTags(mergeTags);
431+
.setParameters(parameters);
432432

433433
String response = api.send(request);
434434
```
@@ -449,14 +449,14 @@ notificationapi = NotificationAPI.new("CLIENT_ID", "CLIENT_SECRET")
449449
notificationapi.send({
450450
#The ID of the notification you wish to send. You can find this
451451
#value from the dashboard.
452-
notificationId: 'order_tracking',
452+
type: 'order_tracking',
453453
# The user to send the notification to.
454-
user: {
454+
to: {
455455
id: 'spongebob.squarepants',
456456
email: '[email protected]', # required for email notifications
457457
},
458-
# mergeTags is to pass dynamic values into the notification design.
459-
mergeTags: {
458+
# parameters is to pass dynamic values into the notification design.
459+
parameters: {
460460
item: 'Krabby Patty Burger',
461461
address: '124 Conch Street',
462462
orderId: '1234567890'

docs/reference/js-core.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ This method updates the user's notification preference for a specific notificati
115115

116116
```javascript
117117
await client.updateDeliveryOption({
118-
notificationId: 'new_comment'
118+
type: 'new_comment'
119119
channel: 'INAPP_WEB',
120120
delivery: 'off',
121121
});

0 commit comments

Comments
 (0)