Skip to content
This repository was archived by the owner on Aug 14, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions docs/features/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ Call Specific Sub-Events:

## Custom Queries

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

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:

```js title="$.request"
{
notificationId: '...',
user: {
id: '123',
type: '...',
to: {
id: '123',
email: 'jane@doe.com',
number: '+19999999999'
},
mergeTags: {
parameters: {
firstName: 'jane'
}
}
Expand All @@ -83,10 +83,10 @@ You can search for anything in the `$.request`, which contains the [original par
##### Property Examples:

- `$.trackingId`
- `$.request.notificationId`
- `$.request.user.number`
- `$.request.mergeTags.firstName`
- `$.request.mergeTags.products[0].sku.title`
- `$.request.type`
- `$.request.to.number`
- `$.request.parameters.firstName`
- `$.request.parameters.products[0].sku.title`

##### Operators:

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

```
($.request.notificationId='new-user' && $.request.user.number='+19999999999') ||
$.request.mergeTags.firstName="Jane"
($.request.type='new-user' && $.request.to.number='+19999999999') ||
$.request.parameters.firstName="Jane"
```
4 changes: 2 additions & 2 deletions docs/features/mergetags.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ You can use merge tags almost everywhere:

## Passing the values

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

```js
notificationapi.send({
...,
mergeTags: {
parameters: {
item: 'Krabby Patty Burger',
address: '124 Conch Street',
orderId: '1234567890'
Expand Down
48 changes: 24 additions & 24 deletions docs/features/scheduling.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ values={[

```js
notificationapi.send({
notificationId: 'order_tracking',
user: {
type: 'order_tracking',
to: {
id: 'spongebob.squarepants',
email: 'spongebob@squarepants.com',
number: '+15005550006'
},
mergeTags: {
parameters: {
item: 'Krabby Patty Burger',
address: '124 Conch Street',
orderId: '1234567890'
Expand All @@ -63,13 +63,13 @@ import asyncio
async def send_notification():
await notificationapi.send(
{
"notificationId": "order_tracking",
"user": {
"type": "order_tracking",
"to": {
"id": "spongebob.squarepants",
"email": "spongebob@squarepants.com",
"number": "+15005550006",
},
"mergeTags": {
"parameters": {
"item": "Krabby Patty Burger",
"address": "124 Conch Street",
"orderId": "1234567890"
Expand All @@ -87,13 +87,13 @@ asyncio.run(send_notification())

```php
$notificationapi->send([
"notificationId" => "order_tracking",
"user" => [
"type" => "order_tracking",
"to" => [
"id" => "spongebob.squarepants",
"email" => "spongebob@squarepants.com",
"number" => "+15005550006"
],
"mergeTags" => [
"parameters" => [
"item" => "Krabby Patty Burger",
"address" => "124 Conch Street",
"orderId" => "1234567890"
Expand All @@ -106,19 +106,19 @@ $notificationapi->send([
<TabItem value="go">

```go
mergeTags := make(map[string]interface{}) // Change to map[string]interface{}
mergeTags["item"] = "Krabby Patty Burger"
mergeTags["address"] = "124 Conch Street"
mergeTags["orderId"] = "1234567890"
parameters := make(map[string]interface{}) // Change to map[string]interface{}
parameters["item"] = "Krabby Patty Burger"
parameters["address"] = "124 Conch Street"
parameters["orderId"] = "1234567890"

notificationapi.Send(
notificationapi.SendRequest{
NotificationId: "order_tracking",
User: notificationapi.User{
Type: "order_tracking",
To: notificationapi.User{
Id: "test_user_id",
Email: "spongebob@squarepants.com",
},
MergeTags: mergeTags,
Parameters: parameters,
Schedule: "2024-02-20T14:38:03.509Z"
},
)
Expand All @@ -129,12 +129,12 @@ notificationapi.Send(

```csharp
string request = @"{
""notificationId"": ""order_tracking"",
""user"": {
""type"": ""order_tracking"",
""to"": {
""id"": ""spongebob.squarepants"",
""email"": ""spongebob@squarepants.com""
},
""mergeTags"": {
""parameters"": {
""item"": ""Krabby Patty Burger"",
""address"": ""124 Conch Street"",
""orderId"": ""1234567890""
Expand All @@ -149,13 +149,13 @@ notificationapi.send(request);

```ruby
notificationapi.send({
notificationId: 'order_tracking',
user: {
type: 'order_tracking',
to: {
id: 'spongebob.squarepants',
email: 'spongebob@squarepants.com',
number: '+15005550006'
},
mergeTags: {
parameters: {
item: 'Krabby Patty Burger',
address: '124 Conch Street',
orderId: '1234567890'
Expand All @@ -181,14 +181,14 @@ Yes, with the `trackingId`, you can cancel a scheduled notification before it is

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

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:
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:

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).
2. Once again at the scheduled time. The results of this step can also be found in our [log dashboard](logs.md).

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

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

### How are logics managed for scheduled notifications?

Expand Down
62 changes: 31 additions & 31 deletions docs/quick-start/send-a-notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,14 @@ notificationapi.init('CLIENT_ID', 'CLIENT_SECRET');
notificationapi.send({
// The ID of the notification you wish to send.
// You can find this value from the dashboard.
notificationId: 'order_tracking',
type: 'order_tracking',
// The user to send the notification to.
user: {
to: {
id: 'spongebob.squarepants',
email: 'spongebob@squarepants.com' //required for email notifications
},
// mergeTags is to pass dynamic values into the notification design.
mergeTags: {
// parameters is to pass dynamic values into the notification design.
parameters: {
item: 'Krabby Patty Burger',
address: '124 Conch Street',
orderId: '1234567890'
Expand All @@ -275,12 +275,12 @@ notificationapi.init("CLIENT_ID", "CLIENT_SECRET")
async def send_notification():
await notificationapi.send(
{
"notificationId": "order_tracking",
"user": {
"type": "order_tracking",
"to": {
"id": "spongebob.squarepants",
"email": "spongebob@squarepants.com"
},
"mergeTags": {
"parameters": {
"item": "Krabby Patty Burger",
"address": "124 Conch Street",
"orderId": "1234567890"
Expand Down Expand Up @@ -308,15 +308,15 @@ $notificationapi = new NotificationAPI('CLIENT_ID', 'CLIENT_SECRET');
$notificationapi->send([
#The ID of the notification you wish to send. You can find this
#value from the dashboard.
"notificationId" => "order_tracking",
"type" => "order_tracking",
# The user to send the notification to.
"user" => [
"to" => [
"id" => "spongebob.squarepants",
"email" => "spongebob@squarepants.com", # required for email notifications
"number" => "+15005550006" # optional phone number required to send SMS notifications
],
# mergeTags is to pass dynamic values into the notification design.
"mergeTags" => [
# parameters is to pass dynamic values into the notification design.
"parameters" => [
"item" => "Krabby Patty Burger",
"address" => "124 Conch Street",
"orderId" => "1234567890"
Expand All @@ -342,24 +342,24 @@ func main() {
// if in EU Region, replace API URL with 'https://api.eu.notificationapi.com'
notificationapi.Init("CLIENT_ID", "CLIENT_SECRET", "https://api.notificationapi.com")

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

notificationapi.Send(
notificationapi.SendRequest{
// The ID of the notification you wish to send. You can find this
// value from the dashboard.
NotificationId: "order_tracking",
Type: "order_tracking",
// The user to send the notification to.
User: notificationapi.User{
To: notificationapi.User{
Id: "spongebob.squarepants",
Email: "spongebob@squarepants.com",
Number: "+15005550006" // Optional phone number required to send SMS notifications
},
MergeTags: mergeTags,
Parameters: parameters,
},
)
}
Expand All @@ -386,7 +386,7 @@ var user = new NotificationUser("spongebob.squarepants")
TelephoneNumber = "+15005550006"
};

var mergeTags = new Dictionary<string, object>
var parameters = new Dictionary<string, object>
{
{ "item", "Krabby Patty Burger" },
{ "address", "124 Conch Street" },
Expand All @@ -395,7 +395,7 @@ var mergeTags = new Dictionary<string, object>

await notificationApi.Send(new SendNotificationData("order_tracking", user)
{
MergeTags = mergeTags
Parameters = parameters
});
```

Expand All @@ -420,15 +420,15 @@ User user = new User("spongebob.squarepants")
.setEmail("spongebob@squarepants.com") // required for email notifications
.setNumber("+15005550006"); // optional phone number required to send SMS notifications

// Create merge tags
Map<String, Object> mergeTags = new HashMap<>();
mergeTags.put("item", "Krabby Patty Burger");
mergeTags.put("address", "124 Conch Street");
mergeTags.put("orderId", "1234567890");
// Create parameters
Map<String, Object> parameters = new HashMap<>();
parameters.put("item", "Krabby Patty Burger");
parameters.put("address", "124 Conch Street");
parameters.put("orderId", "1234567890");

// Create and send notification request
NotificationRequest request = new NotificationRequest("order_tracking", user)
.setMergeTags(mergeTags);
.setParameters(parameters);

String response = api.send(request);
```
Expand All @@ -449,14 +449,14 @@ notificationapi = NotificationAPI.new("CLIENT_ID", "CLIENT_SECRET")
notificationapi.send({
#The ID of the notification you wish to send. You can find this
#value from the dashboard.
notificationId: 'order_tracking',
type: 'order_tracking',
# The user to send the notification to.
user: {
to: {
id: 'spongebob.squarepants',
email: 'spongebob@squarepants.com', # required for email notifications
},
# mergeTags is to pass dynamic values into the notification design.
mergeTags: {
# parameters is to pass dynamic values into the notification design.
parameters: {
item: 'Krabby Patty Burger',
address: '124 Conch Street',
orderId: '1234567890'
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/js-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ This method updates the user's notification preference for a specific notificati

```javascript
await client.updateDeliveryOption({
notificationId: 'new_comment'
type: 'new_comment'
channel: 'INAPP_WEB',
delivery: 'off',
});
Expand Down
Loading