@@ -31,6 +31,7 @@ values={[
31
31
{ label: 'PHP', value: 'php' },
32
32
{ label: 'Go', value: 'go' },
33
33
{ label: 'C#', value: 'csharp' },
34
+ { label: 'Java', value: 'java' },
34
35
{ label: 'Ruby', value: 'ruby' }
35
36
] }>
36
37
<TabItem value =" js " >
@@ -79,6 +80,34 @@ Install the package:
79
80
dotnet add package NotificationAPI -- version 0.5.0
80
81
```
81
82
83
+ </TabItem >
84
+ <TabItem value =" java " >
85
+
86
+ Add the following dependency to your Maven project:
87
+
88
+ ``` xml
89
+ <dependency >
90
+ <groupId >com.notificationapi</groupId >
91
+ <artifactId >notificationapi-java-server-sdk</artifactId >
92
+ <version >0.2.0</version >
93
+ </dependency >
94
+ ```
95
+
96
+ For optimal functionality, you'll also need the following dependencies:
97
+
98
+ ``` xml
99
+ <dependency >
100
+ <groupId >org.apache.httpcomponents</groupId >
101
+ <artifactId >httpclient</artifactId >
102
+ <version >4.5.14</version >
103
+ </dependency >
104
+ <dependency >
105
+ <groupId >com.fasterxml.jackson.core</groupId >
106
+ <artifactId >jackson-databind</artifactId >
107
+ <version >2.15.2</version >
108
+ </dependency >
109
+ ```
110
+
82
111
</TabItem >
83
112
<TabItem value =" ruby " >
84
113
@@ -194,6 +223,7 @@ values={[
194
223
{ label: 'PHP', value: 'php' },
195
224
{ label: 'Go', value: 'go' },
196
225
{ label: 'C#', value: 'csharp' },
226
+ { label: 'Java', value: 'java' },
197
227
{ label: 'Ruby', value: 'ruby' }
198
228
]
199
229
}>
@@ -369,6 +399,40 @@ await notificationApi.Send(new SendNotificationData("order_tracking", user)
369
399
});
370
400
```
371
401
402
+ </TabItem >
403
+ <TabItem value =" java " >
404
+
405
+ ``` java
406
+ // import
407
+ import com.notificationapi.NotificationApi ;
408
+ import com.notificationapi.model.NotificationRequest ;
409
+ import com.notificationapi.model.User ;
410
+ import java.util.HashMap ;
411
+ import java.util.Map ;
412
+
413
+ // Initialize NotificationAPI (default US region)
414
+ // If in the CA region, use the third parameter: "https://api.ca.notificationapi.com"
415
+ // If in the EU region, use the third parameter: "https://api.eu.notificationapi.com"
416
+ NotificationApi api = new NotificationApi (" CLIENT_ID" , " CLIENT_SECRET" , " https://api.notificationapi.com" );
417
+
418
+ // Create user
419
+ User user = new User (" spongebob.squarepants" )
420
+ .setEmail(
" [email protected] " )
// required for email notifications
421
+ .setNumber(" +15005550006" ); // optional phone number required to send SMS notifications
422
+
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" );
428
+
429
+ // Create and send notification request
430
+ NotificationRequest request = new NotificationRequest (" order_tracking" , user)
431
+ .setMergeTags(mergeTags);
432
+
433
+ String response = api. send(request);
434
+ ```
435
+
372
436
</TabItem >
373
437
<TabItem value =" ruby " >
374
438
0 commit comments