Send Push Notifications via API

Use the Adalo API to send push notifications to Users of your app using iOS or Android.

Skill Level: Expert

Before You Begin

  • Triggering Notifications through the API is available on the Team or Business Plan.

  • It is not possible to send notifications to multiple users directly through the Adalo API.

  • Currently it is not possible to set which screen the user will be taken to. For now, they will be taken to the app's home screen.

  • If your app is using a Xano back end, then you must use the User ID to target a specific user.

    • GET ALL Endpoint for Users must be returned "As Self".

Setting up the Request

cURL

If you want a quick way to test this endpoint, run this curl from your command line. Make sure the replace the data with your app's data!

curl --location 'https://api.adalo.com/notifications' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {Your App API Key}' \
--data-raw '{
  "appId": "{your-app-id}}",
  "audience": { "id": {userID} },
  "notification": {
    "titleText": "Hello There",
    "bodyText": "This is just a test..."
  }
}'

Request Headers

The base URL for the API request should be:

https://api.adalo.com/notifications

You will need to include the following headers:

Authorization: Bearer [Your App's API Key]
Content-Type: application/json

Request Body

You will need to specify the following in the API request

  • App ID (you can find your App ID in the url when you are editing your app in Adalo)

  • Recipient Email or User ID

  • Push Notification Title Text

  • Push Notification Body Text

Targeting by Email Address

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

Targeting by User ID

// Example request body (User ID)
{
  "appId": "2bc38ea8-2eb1-4db0-974c-e9e031f2c0e0",
  "audience": { "id": "123" },
  "notification": {
    "titleText": "Hello There",
    "bodyText": "This is just a test..."
  }
}

Server Response

A successful request will return two parameters:

  • successful: [count]

  • failed: [count]

"Successful" means the notifications was delivered to your user's device. "Failed" means that the user no longer grants your app permission to send push notifications. If both are 0, then the user that the notification was sent to does not have your app installed on their device yet.

Here is a video tutorial for how to use the Adalo API to send a Scheduled Push Notification:

Troubleshooting Notifications

We have a few requirements that we recommend you check to troubleshoot any notification issues.

A notification will only be sent if;

  1. The audience to send to exists (The users set to be the "recipient")

A notification will only be received if;

  1. The recipient has the app installed on their device.

  2. The recipient is logged in or has had activity in the app in the last two weeks to be considered active.

  3. The recipient has permissions allowed (notification permission).

  4. The recipient is not the user triggering the notification. I.e. the Logged in User is not triggering a notification to themselves.

If notifications are failing in iOS Native but not in Android, please delete your notifications Key in your Apple Developer account and push a new build.

Help

If you need additional help with this article, you can always ask in our community forum! Be sure to paste the link to this article in your post as well!

Do you have a tutorial or help doc request? Let us know!

Last updated