From 64517c7f95a0d1fb33f7020c465ad1fe429303ff Mon Sep 17 00:00:00 2001 From: Danny Simms <103758200+GreyNewfie@users.noreply.github.com> Date: Fri, 20 Jun 2025 17:50:21 -0230 Subject: [PATCH] Update documentation send parameter - Replace 'mergeTags' with 'parameters', 'user' with 'to' and 'notificationId' with 'type' across various files for consistency and clarity in API usage. --- docs/features/logs.md | 22 ++--- docs/features/mergetags.md | 4 +- docs/features/scheduling.md | 48 ++++----- docs/quick-start/send-a-notification.md | 62 ++++++------ docs/reference/js-core.md | 2 +- docs/reference/react-sdk.md | 40 ++++---- docs/reference/server.md | 124 ++++++++++++------------ 7 files changed, 151 insertions(+), 151 deletions(-) diff --git a/docs/features/logs.md b/docs/features/logs.md index d00106dc..463973b0 100644 --- a/docs/features/logs.md +++ b/docs/features/logs.md @@ -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' } } @@ -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: @@ -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" ``` diff --git a/docs/features/mergetags.md b/docs/features/mergetags.md index 853b04ce..c2d75641 100644 --- a/docs/features/mergetags.md +++ b/docs/features/mergetags.md @@ -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' diff --git a/docs/features/scheduling.md b/docs/features/scheduling.md index 609e25f5..ec285983 100644 --- a/docs/features/scheduling.md +++ b/docs/features/scheduling.md @@ -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' @@ -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" @@ -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" @@ -106,19 +106,19 @@ $notificationapi->send([ ```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" }, ) @@ -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"" @@ -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' @@ -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? diff --git a/docs/quick-start/send-a-notification.md b/docs/quick-start/send-a-notification.md index 05fa2160..82a8cdb4 100644 --- a/docs/quick-start/send-a-notification.md +++ b/docs/quick-start/send-a-notification.md @@ -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' @@ -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" @@ -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" @@ -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, }, ) } @@ -386,7 +386,7 @@ var user = new NotificationUser("spongebob.squarepants") TelephoneNumber = "+15005550006" }; -var mergeTags = new Dictionary +var parameters = new Dictionary { { "item", "Krabby Patty Burger" }, { "address", "124 Conch Street" }, @@ -395,7 +395,7 @@ var mergeTags = new Dictionary await notificationApi.Send(new SendNotificationData("order_tracking", user) { - MergeTags = mergeTags + Parameters = parameters }); ``` @@ -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 mergeTags = new HashMap<>(); -mergeTags.put("item", "Krabby Patty Burger"); -mergeTags.put("address", "124 Conch Street"); -mergeTags.put("orderId", "1234567890"); +// Create parameters +Map 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); ``` @@ -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' diff --git a/docs/reference/js-core.md b/docs/reference/js-core.md index c6e213b8..e5823f2e 100644 --- a/docs/reference/js-core.md +++ b/docs/reference/js-core.md @@ -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', }); diff --git a/docs/reference/react-sdk.md b/docs/reference/react-sdk.md index 23d51c4c..ad998f50 100644 --- a/docs/reference/react-sdk.md +++ b/docs/reference/react-sdk.md @@ -492,7 +492,7 @@ This refers to what notifications are counted in the counters or unread badges. ```jsx { - return n.notificationId === 'welcome_notification' && !n.archived; + return n.type === 'welcome_notification' && !n.archived; }} /> ``` @@ -508,7 +508,7 @@ This refers to which notifications are rendered in the pre-existing popup, feed, ```jsx { - return n.notificationId === 'welcome_notification' && !n.archived; + return n.type === 'welcome_notification' && !n.archived; }} /> ``` @@ -556,7 +556,7 @@ notificationapi.preferences; ```jsx notificationapi.updateDelivery( - notificationId, + type, channel, delivery, subNotificationId? @@ -605,23 +605,23 @@ We have our own websocket for sending & receiving new notifications. With this w The in-app notification object takes several arguments. -| Parameter | Type | Description | -| ------------------ | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **actioned1** | `string` | Coming soon! Assign a function for button 1 in your template, if a custom button has been assigned. | -| **actioned2** | `string` | Coming soon! Assign a function for button 2 in your template, if a custom button has been assigned. | -| **archived** | `string` | Determines if the notification is considered as archived. Also referred to as "resolved". | -| **body** | `ReactNode` | Used to add your [custom UI](react-sdk#ui-customizations) to your notification. | -| **clicked** | `string` | Determines if the notification has been clicked on by the recipient. | -| **date** | `string` | Using ISO 8607 formatting (YYYY-MM-DD), give your notification a date. | -| **expDate** | `number` | Give your notification a TTL by passing in a Unix timestamp (in sencods). The notification will expire once the timestamp has passed. | -| **id** | `string` | Your notification's tracking ID. Not the same as notificationId. | -| **imageURL** | `string` | Embed an image within your notification. | -| **notificationId** | `string` | The ID for your notification's template. | -| **opened** | `string` | Determines if the notification has been opened by the recipient. Notifications are considered opened if rendered onscreen for the recipient. | -| **parameters** | `Record` | [Mergetags.](/features/mergetags) Give your notification mergetags/props that can pass values into matching mergetags within your notification templates. | -| **redirectURL** | `string` | Give your notification a link to send users to upon clicking. | -| **replies** | `object: { date: string, message: string }[],` | Coming soon - Contains user comments/replies to the notification if enabled. | -| **title** | `string` | A title for your in-app notification. | +| Parameter | Type | Description | +| --------------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **actioned1** | `string` | Coming soon! Assign a function for button 1 in your template, if a custom button has been assigned. | +| **actioned2** | `string` | Coming soon! Assign a function for button 2 in your template, if a custom button has been assigned. | +| **archived** | `string` | Determines if the notification is considered as archived. Also referred to as "resolved". | +| **body** | `ReactNode` | Used to add your [custom UI](react-sdk#ui-customizations) to your notification. | +| **clicked** | `string` | Determines if the notification has been clicked on by the recipient. | +| **date** | `string` | Using ISO 8607 formatting (YYYY-MM-DD), give your notification a date. | +| **expDate** | `number` | Give your notification a TTL by passing in a Unix timestamp (in sencods). The notification will expire once the timestamp has passed. | +| **id** | `string` | Your notification's tracking ID. Not the same as type. | +| **imageURL** | `string` | Embed an image within your notification. | +| **type** | `string` | The ID for your notification's template. | +| **opened** | `string` | Determines if the notification has been opened by the recipient. Notifications are considered opened if rendered onscreen for the recipient. | +| **parameters** | `Record` | [Mergetags.](/features/mergetags) Give your notification mergetags/props that can pass values into matching mergetags within your notification templates. | +| **redirectURL** | `string` | Give your notification a link to send users to upon clicking. | +| **replies** | `object: { date: string, message: string }[],` | Coming soon - Contains user comments/replies to the notification if enabled. | +| **title** | `string` | A title for your in-app notification. | ## identify diff --git a/docs/reference/server.md b/docs/reference/server.md index 810a872a..9c24aa86 100644 --- a/docs/reference/server.md +++ b/docs/reference/server.md @@ -326,12 +326,12 @@ class MyNotification extends Notification public function toNotificationApi($notifiable) { return [ - "notificationId" => "my_notification_id", - "user" => [ + "type" => "my_notification_id", + "to" => [ "id" => $notifiable->getAttribute('id'), "email" => $notifiable->getAttribute('email'), ], - "mergeTags" => $this->mergeTags + "parameters" => $this->mergeTags ]; } } @@ -630,7 +630,7 @@ use dotenv::dotenv; #[derive(Serialize)] struct NotificationPayload<'a> { - #[serde(rename = "notificationId")] + #[serde(rename = "type")] notification_id: &'a str, user: User, #[serde(rename = "mergeTags")] @@ -663,13 +663,13 @@ async fn main() -> Result<(), Box> { // Prepare notification payload let payload = NotificationPayload { - notification_id: "order_tracking", - user: User { + notification_type: "order_tracking", + to: User { id: "spongebob.squarepants".to_string(), email: "spongebob@squarepants.com".to_string(), number: "+15005550006".to_string() }, - merge_tags: MergeTags { + parameters: Parameters { item: "Krabby Patty Burger", address: "124 Conch Street", orderId: "1234567890", @@ -740,13 +740,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' @@ -763,13 +763,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" @@ -786,13 +786,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" @@ -818,17 +818,17 @@ $user->email = "spongebob@squarepants.com"; $user->number = "+15005550006"; -// Optional mergeTags to customize the notification -$mergeTags = [ +// Optional parameters to customize the notification +$parameters = [ "item" => "Krabby Patty Burger", "address" => "124 Conch Street" "commentId" => "1234567890" ]; // Send the notification to the user -$user->notify(new MyNotification($mergeTags)); +$user->notify(new MyNotification($parameters)); -// If you don't have merge tags, you can simply call: + // If you don't have parameters, you can simply call: // $user->notify(new MyNotification()); ``` @@ -838,13 +838,13 @@ Alternatively you can send a notification without using Laravel's notifications: ```php $data = [ - "notificationId" => "my_notification_id", - "user" => [ + "type" => "my_notification_id", + "to" => [ "id" => "test_user_id", "email" => "spongebob@squarepants.com", "number" => "+15005550006" ], - "mergeTags" => [ + "parameters" => [ "item" => "Krabby Patty Burger", "address" => "124 Conch Street", "commentId" => "1234567890" @@ -860,19 +860,19 @@ $result = (new NotificationApiService)->send($data) ```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, }, ) ``` @@ -888,8 +888,8 @@ var user = new NotificationUser("user_id") TelephoneNumber = "+15005550006" }; -// Optional mergeTags to customize the notification -var mergeTags = new Dictionary +// Optional parameters to customize the notification +var parameters = new Dictionary { { "item", "Krabby Patty Burger" }, { "address", "124 Conch Street" }, @@ -899,7 +899,7 @@ var mergeTags = new Dictionary // Replace my_notification_id with your notification's ID await notificationApi.Send(new SendNotificationData("my_notification_id", user) { - MergeTags = mergeTags + Parameters = parameters }); ``` @@ -921,15 +921,15 @@ User user = new User("spongebob.squarepants") .setEmail("spongebob@squarepants.com") .setNumber("+15005550006"); -// Create merge tags -Map mergeTags = new HashMap<>(); -mergeTags.put("item", "Krabby Patty Burger"); -mergeTags.put("address", "124 Conch Street"); -mergeTags.put("orderId", "1234567890"); +// Create parameters +Map 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); ``` @@ -939,13 +939,13 @@ String response = api.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' @@ -964,11 +964,11 @@ use dotenv::dotenv; #[derive(Serialize)] struct NotificationPayload<'a> { - #[serde(rename = "notificationId")] - notification_id: &'a str, - user: User, - #[serde(rename = "mergeTags")] - merge_tags: MergeTags<'a>, + #[serde(rename = "type")] + notification_type: &'a str, + to: User, + #[serde(rename = "parameters")] + parameters: Parameters<'a>, } #[derive(Serialize)] @@ -979,7 +979,7 @@ struct User { } #[derive(Serialize)] -struct MergeTags<'a> { +struct Parameters<'a> { item: &'a str, address: &'a str, orderId: &'a str, @@ -997,13 +997,13 @@ async fn main() -> Result<(), Box> { // Prepare notification payload let payload = NotificationPayload { - notification_id: "order_tracking", - user: User { + notification_type: "order_tracking", + to: User { id: "spongebob.squarepants".to_string(), email: "spongebob@squarepants.com".to_string(), number: "+15005550006".to_string() }, - merge_tags: MergeTags { + parameters: Parameters { item: "Krabby Patty Burger", address: "124 Conch Street", orderId: "1234567890", @@ -1038,15 +1038,15 @@ The send() method accepts an object with the following fields: | Name | Type | Description | | ---------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `notificationId`\* | string | The ID of the notification you wish to send. You can find this value from the dashboard. | -| `user`\* | object | The user to send the notification to. | -| `user.id`\* | string | The ID of the user in your system. Required. This is the only user field required for sending in-app, web push, and mobile push notifications. | -| `user.email` | string | Required for sending email notifications, otherwise optional. | -| `user.number` | string | Required for SMS/CALL notifications, otherwise optional. Valid format: `+15005550006`. Unformatted US/Canada numbers are also accepted, e.g., (415) 555-1212, 415-555-1212, or 4155551212. | -| `user.timezone` | string | The user's timezone. Timezone names correspond to the Zone and Link names of the IANA Time Zone Database, such as 'America/New_York', 'America/Denver', 'EST', and 'UTC'. | -| `mergeTags` | object | Used to pass in dynamic values into the notification design. Read more: [Dynamic Parameters (Merge Tags)](/features/mergetags) | +| `type`\* | string | The ID of the notification you wish to send. You can find this value from the dashboard. | +| `to`\* | object | The user to send the notification to. | +| `to.id`\* | string | The ID of the user in your system. Required. This is the only user field required for sending in-app, web push, and mobile push notifications. | +| `to.email` | string | Required for sending email notifications, otherwise optional. | +| `to.number` | string | Required for SMS/CALL notifications, otherwise optional. Valid format: `+15005550006`. Unformatted US/Canada numbers are also accepted, e.g., (415) 555-1212, 415-555-1212, or 4155551212. | +| `to.timezone` | string | The user's timezone. Timezone names correspond to the Zone and Link names of the IANA Time Zone Database, such as 'America/New_York', 'America/Denver', 'EST', and 'UTC'. | +| `parameters` | object | Used to pass in dynamic values into the notification design. Read more: [Dynamic Parameters (Merge Tags)](/features/mergetags) | | `schedule` | string | An ISO 8601 datetime string to schedule the notification for. For example, `2024-02-20T14:38:03.509Z` | -| `replace` | object, string key/value pair | Similar to mergeTags, but more flexible. Like the programmatic string replace function, this parameter will replace any string in the notification templates with another string. This operation happens on the fly when sending the notification and does not actually modify the templates.
This operation is case-sensitive and happens after mergeTags are injected. | +| `replace` | object, string key/value pair | Similar to parameters, but more flexible. Like the programmatic string replace function, this parameter will replace any string in the notification templates with another string. This operation happens on the fly when sending the notification and does not actually modify the templates.
This operation is case-sensitive and happens after parameters are injected. | | `subNotificationId` | string | To break down your notification into multiple categories or groups. Read more: [Sub Notifications](/features/subnotifications) | | `templateId` | string | By default, notifications are sent using the default template of each channel. You can permanently change the default template from the dashboard. However, you can also use this parameter to force using a specific template. This is useful in multiple situations:
- Design variation: using different wording and design, e.g. "You have new updates" vs. "You don't have any updates"
- White-labeling: using a specific template that you designed for a white-labeled customer
- Language: creating and using multiple templates for multiple languages
If the provided templateId does not exist for a channel, the default template will be used, and a warning message will be generated. | | `forceChannels` (deprecated) | string[] | Used to override the channels which are used for the notification. This field only overrides the notification's channels configuration. It does not override the user preferences.
Values available for use are:
EMAIL, INAPP_WEB, SMS, CALL, PUSH, WEB_PUSH
E.g. forceChannels: `["EMAIL", "SMS"]` | @@ -1409,7 +1409,7 @@ values={[ ```js notificationapi.setUserPreferences('userId', [ { - notificationId: 'new_order', + type: 'new_order', channel: 'INAPP_WEB', delivery: 'weekly' }, @@ -1430,7 +1430,7 @@ import asyncio async def set_user_preferences(): await notificationapi.set_user_preferences("userId", [ { - "notificationId": "new_order", + "type": "new_order", "channel": "INAPP_WEB", "delivery": "weekly" }, @@ -1451,7 +1451,7 @@ asyncio.run(set_user_preferences()) ```php $notificationapi->setUserPreferences("userId", [ [ - "notificationId" => "new_order", + "type" => "new_order", "channel" => "INAPP_WEB", "delivery" => "weekly" ],