Skip to content

Comments

Chore: add new model classes.#5

Merged
sahandseifi merged 3 commits intomainfrom
4NhY0NHd/3202-add-base-url-to-the-java-sdk
May 22, 2025
Merged

Chore: add new model classes.#5
sahandseifi merged 3 commits intomainfrom
4NhY0NHd/3202-add-base-url-to-the-java-sdk

Conversation

@mbasadi
Copy link
Member

@mbasadi mbasadi commented May 22, 2025

No description provided.

…fication options, including CallOptions, Device, EmailOptions, InAppOptions, MobilePushOptions, Options, PushProvider, PushSubscription, PushToken, SlackOptions, SmsOptions, User, WebPushOptions, and WebPushToken. Enhance NotificationRequest to support new options and parameters for improved notification handling.
@mbasadi mbasadi changed the title Update version to 0.3.0 in pom.xml and add new model classes for notification options, including CallOptions, Device, EmailOptions, InAppOptions, MobilePushOptions, Options, PushProvider, PushSubscription, PushToken, SlackOptions, SmsOptions, User, WebPushOptions, and WebPushToken. Enhance NotificationRequest to support new options and parameters for improved notification handling. Chore: add new model classes. May 22, 2025
@mbasadi mbasadi requested a review from sahandseifi May 22, 2025 17:45
@mbasadi
Copy link
Member Author

mbasadi commented May 22, 2025

How to send an SMS
import com.notificationapi.NotificationApi;
import com.notificationapi.model.NotificationRequest;
import com.notificationapi.model.User;
import com.notificationapi.model.SmsOptions;

public class SendSmsExample {
public static void main(String[] args) {
String clientId = "your_client_id";
String clientSecret = "your_client_secret";

    try (NotificationApi api = new NotificationApi(clientId, clientSecret)) {
        // Create the user with a phone number
        User user = new User("user123")
            .setNumber("+1234567890"); // Replace with the recipient's phone number

        // Create the SMS options
        SmsOptions smsOptions = new SmsOptions()
            .setMessage("Hello from NotificationAPI!");

        // Create the notification request with your template ID
        NotificationRequest request = new NotificationRequest("your_sms_template_id", user)
            .setSms(smsOptions);

        // Send the SMS
        String response = api.send(request);
        System.out.println("Response: " + response);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

}

@sahandseifi sahandseifi merged commit 9e90e4f into main May 22, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants