Notification Tray - more info on API

For the Notification Tray feature,

this documentation page shows 4 GET/SET API endpoints, but they’re shown very briefly:
Notification Tray - Amity Docs

Is there more details on those, with a sample format, and responses, and how to write request in C# or others, the same way you can see of API features on this page?

I noticed the Notification Tray API features are not shown in this API docs ^

Hi @abhishek ,

Currently, this is the only API doc we have for this Notification Tray - Amity Docs.

Are you experiencing any difficulties while using the notification tray APIs? If you have any questions or find certain aspects unclear, please don’t hesitate to reach out.

It’s important to mention that the notification tray is currently in beta and operates separately from the other production APIs.

Hello team, could you provide a JavaScript/Fetch sample request for:

Retrieve notification records of a user
[GET] https://beta.amity.services/notifications/v3/history?

If possible, do you also have a C# (HttpClient) sample request?

Hello, here’s the sample for JavaScript:

var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer ");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://beta.amity.services/notifications/v3/history", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

and this is for C#:

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://beta.amity.services/notifications/v3/history");
request.Headers.Add("Authorization", "Bearer ");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

Please use this as a sample, you may need to make some adjustments as necessary.

1 Like

This was very helpful, thank you. I got it working.

Notifications Tray records notifications of predefined events, shown on this table:

Notification Tray - Amity Docs

So there’s notifications for posts, comments, replies, and mentions, but is Amity working on adding more? For example, channel chat messages, or when a new member joins a channel/leaves a channel, etc?

If not, I’d love to know a way to send these types of custom notifications, and add them to a user’s history of notifications. For example, in my app, I need to send notifications to users whenever a user reaches a certain high level in the game that our app is connected to.

At present, we do not have plans to include additional chat events in the notification tray. However, you can make use of our webhook events to address these specific requirements.

Regarding your game use case, it is rather specialized and should be implemented on your side, as we do not have events available to support this functionality :slightly_smiling_face: :pray:

Which webhook events allow me to add more to a user’s in-app Notification Tray?

Are you referring to /webhook/push-notifications/.../?