Skip to main content
← Data, API & Backend
Data, API & Backend October 6, 2022 · 17 replies

One signal example

Archived from the Bravo community forum (2021–2026). Some answers may refer to older versions of Bravo.

Does anyone have any example of Onesignal implementation with Xano and Bravo?

17 replies

Diego Iglesias Bravo team October 7, 2022

Can you explain your use case? For the usual notifications set up you can just use OneSignal directly.

Fred October 14, 2022

example is would be, I need the user to get notified when a booking date is approaching

Diego Iglesias Bravo team October 20, 2022

Okay I have created a snippet in Xano to send Push notifications with OneSignal:
https://www.xano.com/snippet/wU7QiMUz

You can add it to your booking date API endpoint. It receives four parameters:

  • message

  • appID (OneSignal)

  • apiKey (OneSignal)

  • playerID (OneSignal, represents the unique user ID)

    Screenshot 2022-10-20 at 18.54.44.png

    You can test it via TestFlight. Requirements:

    • Have the [action:enablenotifications] tag on the design

    • Have a OneSignal account (you try it for free)

    • Have OneSignal set up in Bravo. Select "My account" and set the OneSignal appId and apiKey

      Screenshot 2022-10-20 at 19.01.21.png

    • Have an Apple Developer account

    • Follow the iOS publishing process until step 5 (TestFlight)

Let me know if you need any help!

Fred October 20, 2022

that is superuseful!! It will save me a ton of time! Thank you very much!

Fred October 20, 2022

for Android I'll need to publish on the Playstore right?

Diego Iglesias Bravo team October 20, 2022

to test it on Android you just need to download the apk and install it

Fred October 22, 2022

that's great! Only one point is missing, how do I get to know the Onesignal Id of each user when prompting the request? Is something I would need to retrieve from the Onesignal db, do they provide an endpoint for that?

Fred October 22, 2022

I'm getting this response back 

 Please include a case-sensitive header of Authorization: Basic <YOUR-REST-API-KEY-HERE> or Bearer token="<YOUR-REST-API-KEY-HERE>" with a valid REST API key   

and my request Body is thisone 

{

  "message": "you are an hero",

  "playerID": "d7919d4c-eea0-49e9-af95-0fe833fb08e2",

  "appID": "deab2cc7-58a9-468d-8044-a3e7b6de656e",

  "apiKey": "ZDc1ODMzMzYtNThhNy00MDUxLWJlMDktMTBjOThjZTYyNzMx"

} 

I've double checked the ID to be valid on Onesignal

Fred October 24, 2022

I still get the same error.. it could be an error with Onesignal or Firebase setup?

Diego Iglesias Bravo team October 24, 2022

Make sure you are using the version with "Prepend Text".

Screenshot 2022-10-24 at 15.22.15.png

If you do, paste here the OneSignal response

Nour October 27, 2022

I tried the snippet today, did few modifications on it and managed to get the status 200 but for some reason one signal returns a no subscriber and I do not really get any notifcations on the app yet "triggered by xano" . I Sent to Onesignal and hopefully I can get a helpful feedback. That being said, push notifications from bravo works fine.

Fred October 28, 2022

response:

 {

headers: [

HTTP/2 400,

date: Fri, 28 Oct 2022 10:28:17 GMT,

content-type: application/json; charset=utf-8,

status: 400 Bad Request,

ratelimit-limit: 165,

access-control-allow-origin: *,

cache-control: no-cache,

vary: Origin, Accept-Encoding,

referrer-policy: strict-origin-when-cross-origin,

x-permitted-cross-domain-policies: none,
... +18 more],

result: {

errors: [

Please include a case-sensitive header of Authorization: Basic <YOUR-REST-API-KEY-HERE> or Bearer token="<YOUR-REST-API-KEY-HERE>" with a valid REST API key.],

reference: [

https://documentation.onesignal.com/docs/accounts-and-keys#section-keys-ids\]},

Wrote something in this thread and want it removed? Request removal

Still stuck?

Ask the community on Discord

This archive is read-only. New questions, office hours and product updates now happen in the Bravo Discord.

Join the Discord