Push Notifications from External Server

Hi Guys,

I want to send push notifications to my adalo app. The point is the push notifications will be sent from the external server. I have an adalo app which is full of external collections and custom actions.

I want to trigger a push notification to my adalo app once the certain even occurs on my server code. I am trying to do search on it and i do find only doc which suggests me how to do it but i am not sure it explains all.

The notifications API makes it possible to send push notifications (iOS & Android) to specific users, by ID, email, or username. In most cases, you will not have the user’s ID (unless you’re receiving it from Zapier), so email or username are usually preferred.

POST https://api.adalo.com/notifications - Trigger a notification

Post Body (JSON):

{
  "appId": "2bc38ea8-2eb1-4db0-974c-e9e031f2c0e0",
  "audience": { "email": "user@example.com" },
  "notification": {
    "titleText": "Hello There",
    "bodyText": "This is just a test..."
  }
}

this is just which they explain. No code snippets nothing more.

Have anyone done it before and to get adalo apis what should be done. I need to get this done asap.

@Flawless any help in this regard please

Best

Quick question: do you authenticate your user using Adalo’s login/sign up or do you use an external auth system?

yes indeed i do. The login is done via external users authentication. The token is then stored in adalo to get all the data regarding that user

I don’t think push notification will be possible, because as i recall Auth should be done by adalo for notification (limitation)…

Adalo has external user authentication function. I am using this one.

Yeah, but the user auth is not done by Adalo, so i don’t think you can use notifications

so that means the i have to use external tools like firebase ?

also the notification code will be on Server side not in adalo

You may want to look into using something like OneSignal. They have an API that you can tap into.

I haven’t used it yet and I know others have been asking how. I’ll put this on my roadmap for next week.

1 Like

Thank you yes this is very important thing which needs to be done.

was just trying the adalo api doc. I tried to test it via Postman to see if the notifcaiton is sending or not by API. my code is as follows

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

    $headers = array(
       "Content-Type: application/json",
        "Authorization: Bearer mytoken",
    );
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    
    $data = '{"app_id":"appid","audience": {"email": "myemail"},"notification": {"titleText": "Hello There","bodyText": "This is just a test..."}}';
    
    
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    
    // //for debug only!
    // curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    // curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    
    $resp = curl_exec($curl);
    curl_close($curl);

but it is throwing error

“error”: “Access token / app mismatch”

Any Ideas what i am doing wrong?

@Flawless @njimmy10

okay so this error means that the provided appID and the apikey from adalo are not from the same app/editor

it is the same. Confirmed it again and again. Even if we look our external collection apis it is using the same app id and same Bearer Token

Why are you using an external collection api to test it?

This is the api key. Which other api key should be used ??

as per adalo docs it is

What is this?

may be my term of explanation is not correct. What i mean was if i follow this step

it shows me the same bearer token and app id

Oh okay

Can you run the test in Postman? And show me what you did (cover your token)