# Trigger Push Notifications

***

*Skill Level: Intermediate*

## Before You Begin

Notifications require that your app is installed on Native iOS, Android, or as a PWA.

* Notifications can only be triggered to another logged-in user, on another device.&#x20;
  * *ex: The Logged-in User triggering the notification will not be able to receive the notification they triggered within the app.*&#x20;
* Notifications only work when a user is logged in.
  * *ex: Any button or action that sends a notification works only if a user is logged in. Without a logged-in user, Adalo cannot create the required token, so the notification will not be sent.*
* The app must have the [Request Notification Permission](https://help.adalo.com/action-basics/notifications/request-notification-permission-in-your-app) set up. Please ensure this is set up correctly before continuing.&#x20;
* Target Screen is only available on Native iOS and Android. PWA will always direct to the Apps Home Navigation Screen.

***

### Add Notification Action

* Select the component that should trigger the notification, then in the left panel select 'Add Action'.
* Scroll to the bottom of the options, and click Trigger Notification.

  <figure><img src="https://3467607506-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LhGHkPsv15svPIU5I7C%2Fuploads%2FyH9hg9bVxTyvXUVEmgrk%2FCreating%20a%20Notification%20with%20Messaging%20in%20Adalo%20-%20Step%203.jpeg?alt=media&#x26;token=36b11ef8-18e6-437e-9bc6-5b68a1f80a30" alt="" width="329"><figcaption></figcaption></figure>

### Select Users to receive notification

All Users will get the notification unless filtered by available data such as Current User or by a Relationship to the User.&#x20;

* **Current User - Send a message to a single user using Available Screen Data**

  * Uses include sending a notification to a single user such as a 'New Follower' notification or 'Friend Request' when **Current User** Data is available.

  <div align="left"><figure><img src="https://3467607506-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LhGHkPsv15svPIU5I7C%2Fuploads%2FTlEfKYyQJ368nEUSvYT8%2FScreenshot%202023-11-06%20at%202.09.17%E2%80%AFPM.png?alt=media&#x26;token=2b9064f5-5068-4a18-9378-66dd5ab31020" alt="" width="124"><figcaption></figcaption></figure></div>
* **One User - Send a message to a single User through Filter**
  * Used similarly to "Current User" but when filtering through other available data such as a relation to a User. Example of this may be a Marketplace Listing sale or an Admin approval request.

    <div align="left"><figure><img src="https://3467607506-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LhGHkPsv15svPIU5I7C%2Fuploads%2F2kkB4cedq49fbM4cizgY%2FScreenshot%202023-11-06%20at%202.07.40%E2%80%AFPM.png?alt=media&#x26;token=f10f5c64-57ba-4724-8ff8-203a86f1b910" alt="" width="188"><figcaption></figcaption></figure></div>
* **Multiple Users - All Users or Users who meet criteria**

  * Used when wanting to send to all users or a specific group of users filtered through a rerelationship. Examples would include a Notification to multiple users about an event they are attending or a new message in a group chat.&#x20;

  <div align="left"><figure><img src="https://3467607506-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LhGHkPsv15svPIU5I7C%2Fuploads%2FzPXZANhA8qXRs9dVfr5P%2FScreenshot%202023-11-06%20at%202.05.36%E2%80%AFPM.png?alt=media&#x26;token=4b27c44d-5a21-4ac6-aa80-9bc7a985e0c2" alt="" width="563"><figcaption></figcaption></figure></div>
* This is also where you exclude the Logged in User from your notifications if sending to multiple Users.

  <div align="left"><figure><img src="https://3467607506-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LhGHkPsv15svPIU5I7C%2Fuploads%2F6PyEXpRPidz5AYoxFiNV%2FScreenshot%202023-11-06%20at%202.13.23%E2%80%AFPM.png?alt=media&#x26;token=ddc4db4e-4a7c-474e-bff0-991bc005b424" alt="" width="179"><figcaption></figcaption></figure></div>

{% hint style="info" %}

* Notifications will only be sent if;
  1. The user has the app installed on their device.
  2. The user is logged in.&#x20;
  3. The user has had activity in the app in the last 2 weeks to be considered active.
  4. The user has permissions allowed.
  5. The user is not the user triggering the notification.
     {% endhint %}

### Enter Notification Details

* Set the title and body text for the Notification message.
  * If using information from an Input, we recommend creating a Message or Notification Record in your Collections before using that information to fill in the Notification details.&#x20;
* Select which screen in your app the user should be taken to when the tap on the notification on Native iOS and Android builds.

  * You **must** select a Screen for notification to be triggered.&#x20;

  <div align="left"><figure><img src="https://3467607506-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LhGHkPsv15svPIU5I7C%2Fuploads%2F0CFzgcQH6JVJDQOqUnL6%2FCreating%20a%20Notification%20with%20Messaging%20in%20Adalo%20-%20Step%2017.jpeg?alt=media&#x26;token=98af7390-3aef-4e20-abd2-99a56dd36140" alt="" width="203"><figcaption></figcaption></figure></div>

{% hint style="warning" %}
**PWA will always direct to the Apps Home Navigation Screen regardless of the Target Screen selected.**
{% endhint %}

### Next Steps

Now you are ready to test your notifications!
