Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserNotification Cloud API #851

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

commonly-ts
Copy link
Contributor

Allows a notification to be sent to a user through a universe.

Example usage

// JavaScript

await noblox.setAPIKey(API_KEY!);

const universeId = 4434277335;
const targetUserId = 1210019099;
const assetId = "774d62e5-3414-b84a-89dd-77d96f1a3d33";

const parameters = {
    data: { stringValue: "Hello world!" }
};

await noblox.sendUserNotification(universeId, targetUserId, assetId, parameters);

Notification:
image
image

How it works

This pull request adds the sendUserNotification function that allows for example, a Discord bot to send a user a notification for a use case such as an application centre. A notification can be sent out to alert the user of their applications status.

Notifications are created through the Notifications tab under Engagement.
image

Custom text that is sent through the API is to be named and placed inside curly braces {myMessage}. To set the message, the code would look like this:

const parameters = {
    myMessage: { stringValue: "This is my message." }
};

This API requires the use of an API key. The given universeId must be added to the API key and given the scope user.user-notification:write.

image

Documentation

https://create.roblox.com/docs/production/promotion/experience-notifications#creating-a-notification-string
https://create.roblox.com/docs/cloud/reference/UserNotification

@Regalijan Regalijan self-requested a review December 17, 2024 21:40
Copy link
Member

@Regalijan Regalijan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also there's no typing added to the jsdocs

lib/games/sendUserNotification.js Outdated Show resolved Hide resolved
@Regalijan
Copy link
Member

It needs a test case too but I'll probably do that myself

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