Sending Notification to Specific User with Onesignal

There was a problem in the JSON you submitted: unexpected character at line 1, column 3 it is saying.

I am not able to get what exactly is the problem in this.

Can someone help me please

{“app_id”: “b230cf39-782f-41d8-b99f-2df930fd6ca6",
“contents”: {“en”: “HKP this is the test message”},
“headings”: {“en”: “HKGT Internal"},
“url”: “”,
“include_player_ids”: [“20351ae5-310c-4af5-931b-1f4330dd4331"]}

The above is in BODY. I am not able to figure out why it is giving that error

Please help

The url property is blank, do you need that?

I don’t need that

But I tried it by removing that also. Same error is coming.

Even I tried removing contents and headings also.

Same error is coming

Finally it is working. I just moved app_id to query parameters and shifted include_player_ids to front. I didn’t know the reason but it worked

But in the popup if I click OK it is going to somewhere. Although I have not given anything in URL

1 Like

This is the code that @bymaho posted above. I notice yours is different. Do you think that may be what’s causing your issues?

1 Like

Hi All,

I am going through all these responses and I can set up for sending to a single user based upon an event. However, I have some further specific needs:

Imagine a news app which sends push notifications of specific stories based upon a users interests that they select when registering for the app. So, my questions would be:

  1. OneSignal has a segmentation option based upon User Tags that are inserted in the app. Is it possible for me to use this so that I can group segments of the user base together to customize the notifications different groups would receive?

  2. Assuming #1 is possible, then if a user clicks on the notification, how can I create the link between the OneSignal notification and a specific app page?

Thanks

I don’t have the answer to your question, but you should post on how to send a push message based upon an in-app event! That sounds really cool!

You can segment notifications either using the segment parameter or tag parameter you can see more here https://documentation.onesignal.com/reference#create-notification

However the answer to your second question. I haven’t found a way to provide deep links to the url in the app. Would be keen to see if the thunkable team know how this is done

@jared this is entirely possible to activate a notification from an in app event you can also use one signals api to delay a notification.

For example I use this to allow my users to submit a support ticket to another user, and they set a validity on the support ticket which I use to delay another notification which sends to them the day before the ticket expires to provide follow up. It’s useful

1 Like

@jacob1, I can see the documentation provided by OneSignal. However, I am curious of taking this a step further.

For the news app analogy (not what I am trying to make, but easy to use for explaining intent), imagine a set of preference selections in which I could select topics of interest. So these selections would then be stored in Firebase (appearing as True of False).

So I would then want to be able to send important news alert to a user that selected interest in a particular topic, but not to those that did not select this. I can easily add another layer to Firebase that marks users as A, B, C, D, etc. based upon their selections. But what I stumble on is how to use this same segmentation in OneSignal.

Any thoughts on how to do this?

I think this would be possible, I would complete it as below…

Set the parent nodes as preference topics so your path in firebase would look something like:

Users Topic Preferences > Topic Example Name > Users Push ID

  1. When user marks their preference save their Push ID under the parent node for that topic in firebase

  2. Then use a Web API component with a POST request send that to one signal api and use the “tag” parameter against this user. This could be the same as your parent node topic preference name.

  3. Whenever a user marks their preference in the app it will add an additional tag to them In onesignal so you can filter the messages.

PM me if you need a hand

1 Like

All,

Just letting everyone here know I found a solution to my earlier post on this topic regarding putting tags into OneSignal so that you can create segments for sending push notifications.

Using Gender selection as an example, the block looks like this:

Hope this helps others that may encounter the same issue that I did.

Best,
K

https://x.thunkable.com/copy/1ea79eed4bb6f90ad849b9c6cddae14d

I tried to do as you told me.
But it doesn’t work.
What is wrong?

I would have forgotten something and entered something wrong.
Please let me know how.

Linked the file I tried.
I would appreciate it if you could.

I don’t understand explanation 3.
I would be grateful if you could suggest the block coding for the 3rd explanation.

You set the body but did you initiate the push/get command?

I am a complete beginner.
I have never used api.

I just have to follow the tutorial and do the same.

I would be really grateful if you could give me a full block coding example, including the ones I didn’t do.

Do the tutorials on YouTube. There are multiple.

Have you done those yet. There 3-5 different tutorials

1 Like

I searched all youtube lectures.
However, nothing like this is covered in detail.
It couldn’t fill my shortage.

What youtube handles push / get command?

Each one would use at least one of them.

The problem is what you want isn’t necessarily easy.

You can’t build a house with a toy hammer. You have to learn how to use the adult hammer.

Thunkable makes many things easy. But somethings are intermediate and require lots of trial and error.

I think a Clean tutorial for just this would be cool. I may try to tackle this sometime this week or next!