Sending Notification to Specific User with Onesignal

That’s useful information and good to know. Thanks.

This does send notifications to all users .Can u plz help

then

Hi Jacob,

I am trying to create a calendar app where each user can schedule notifications. Is there a way to use this method of sending an individual user a specific notification but at a scheduled time in the future?

Thank you in advance

Hi Guys, today January 20 2024 I made it work with the help of the OneSignal API docs and postman to check the parameters and Headers of the API with the following block result, it works flawlessly!!! I hope it helps!!!

1 Like

Certainly! Here’s the revised text in English:


Tutorial: Sending Push Notifications to Specific Users via REST API in Thunkable

For many months, perhaps years, I struggled to make the Push Notificator work using the REST API method. However, in January 2024, I came across the latest post and decided to give it another try.

After numerous unsuccessful attempts, I saw a glimmer of hope when revisiting the provided guidance. The key lay in the API call header, where I previously made mistakes. Initially, I was only including the “Authorization” and “Content-Type” headers. However, following a recent suggestion here, I realized that it was also necessary to add the “external_id” header to the request.

Although I didn’t fully understand at the time, with the help of some API call responses, I soon identified why the previous attempts had failed. I removed the “accept” header and left only the following headers:

  • Authorization: Bearer (your API key)
  • Content-Type: application/json
  • external_id: GetmypushId

I also understood that to send a push notification to a specific user, it was necessary to declare it as a list, even if it was only a single user to be notified. This is because when creating a JSON object, as it is in a list block, it is interpreted as an array , indicating the possibility of having numerous items inside.

By configuring the blocks in this way, I finally managed to make the API call and notify the specific user, even in test mode, without the need to download and install the application on the phone.

I sincerely hope that this approach resolves the problems of many other developers, just as it resolved mine.

Happy Thunking!

Example API Call in JSON:

{
  "app_id": "your_app_id",
  "include_player_ids": ["user_id"],
  "contents": {"en": "Your notification message here"},
  "headings": {"en": "Notification Title"}
}

I hope this text better reflects your experience and is helpful to the Thunkable community! If you need anything else or have any questions, feel free to ask.