# Recurring Notifications

## Before You Start:

{% hint style="info" %}
For this stack, Adastacks must store your your Adalo app ID and API key to complete each recurring notification. By using this endpoint, you are giving Adastacks permission to do this.
{% endhint %}

{% hint style="info" %}
Your app **must** be published to the app stores in order for this stack to function. PWA's and web applications built in Adalo do not support native mobile push notifications.
{% endhint %}

## Walkthrough

### Setting Up the Actions

**1.** Login to [Adastacks.com](https://adastacks.com) and navigate to your dashboard. (we'll need this for your API Key in a minute).

**2.** Open a new tab in your browser and open up your Adalo app in the Adalo editor

**3.** Once open, place a test button on a screen of your choosing

**4.** Under the "Click Actions" for the button, select  **+Add Actions**, then choose **Custom Action**

**5.** Give your action a name, such as "Create Recurring Notification"

**6.** Select the **Create** option from the dropdown below the Title field, then click **Next**

**7.**  The **Base URL** will be determined by what you want to accomplish - you can either Create recurring notifications or you can Delete them. Updating recurring notifications is not currently supported.  First you must setup the Create Recurring Notifications action:

<mark style="color:green;">**Create**</mark>**&#x20;Recurring Notification URL**

```
https://adastacks.app.n8n.cloud/webhook/create-recurring?app_id=APPID&adalo_key=ADALOKEY&to_email=TOUSEREMAIL&title=TITLE&body=BODY&starting_datetime=DATETIME&freq=FREQUENCY
```

**8.** Set the "Method" dropdown to **POST**

**9.** Add a query parameter called **Content-Type** with the value **application/json**

![](/files/-MaZ7zEwCloG89ck9zcf)

**10.** Add another query parameter called **api\_key** with your Adastacks API Key as the value

![](/files/-MaZwnVzXtyllh_lmNuA)

**11.** Add **Inputs** to hold your data for the new Custom Action (*You can name these whatever you like, but below are some suggestions*).

<mark style="color:green;">**Create**</mark> **Recurring Notification Inputs**

| Suggested Input Name   | Input Type | Suggested Input Value                                                                                                                                                                                                         |
| ---------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Adalo App ID**       | Text       | *For testing, you can make this anything you like, but should ideally be your* [*Adalo app ID*](https://docs.adastacks.com/appendix#finding-your-adalo-app-id)                                                                |
| **Adalo API Key**      | Text       | *For testing, you can make this anything you like, but should ideally be your Adalo app's* [*API Key*](https://docs.adastacks.com/appendix#finding-your-adalo-api-key)                                                        |
| **To User Email**      | Text       | *For testing, you can make this anything you like*                                                                                                                                                                            |
| **Notification Title** | Text       | *For testing, you can make this whatever you like*                                                                                                                                                                            |
| **Notification Body**  | Text       | *For testing, you can make this whatever you like*                                                                                                                                                                            |
| **Starting Datetime**  | Text       | <p><strong>2022-12-19T23:24:30Z</strong> </p><p><em>Note that the date formatting when sending in the custom action should be No Formatting.</em></p>                                                                         |
| **Frequency**          | Text       | <p>Allowed values are:</p><p></p><p><strong>D</strong> for daily recurrence</p><p><strong>W</strong> for weekly recurrence</p><p><strong>M</strong> for monthly recurrence</p><p><strong>Y</strong> for yearly recurrence</p> |

**12.** Replace the **capitalized text** in the URL with the **Inputs** you just made using the **Magic Text** button in the top right of the URL field.

![](/files/ZRGEhHF671TjHXGan85P)

**13.** Run the test request and copy the returned ID so you can setup the Delete action. (See the success screenshot below)

{% hint style="info" %}
Even test actions that fail return a "Test Successful" message so be sure to click **Show Full Response** to ensure the action succeeded. This is by design so that you can still save the action and return to continue setting it up later if you wish.
{% endhint %}

![](/files/ESdPi6BZQdOmMvnw1Zsq)

{% hint style="info" %}
Note that you should copy the returned ID from the Create Action when setting up the action. This is so that you can setup the Delete action using the generated ID.
{% endhint %}

**14.** Save the Custom Action.  See below for an example custom action setup:

![](/files/l97VODIXKoUACsxr1qkH)

**15**.  IMPORTANT! Don't forget to format the scheduled date to **No Formatting** by clicking the pencil icon. If you fail to do this, the notifications will not be sent.

![](/files/KKx7bNbVrPPQGVM8sLgC)

**16.** Now let's create the Delete Recurring Notification action so that you can delete notifications when a user turns them of&#x66;**.** Select the same test button you created in **Step 3**. This button is only for setting up the custom actions. Once the actions have been created and saved, you can delete this button.

**17.** Under the "Click Actions" for the button, select + **Add Actions**, then choose **Custom Action**

**18.** Give your action a name, such as "Delete Recurring Notification"

**19.** Select the **Delete** option from the dropdown below the Title field, then click **Next**

**20.**  In the **Base URL** field of the custom action, copy and paste the following URL:

<mark style="color:purple;">**Delete**</mark>**&#x20;Recurring Notification URL:**

```
https://adastacks.app.n8n.cloud/webhook/delete-recurring?id=NOTIFICATIONID
```

**21.** Set the "Method" dropdown to **POST**

**22.** Add a query parameter called **Content-Type** with the value **application/json**

![](/files/-MaZ7zEwCloG89ck9zcf)

**23.** Add another query parameter called **api\_key** with your Adastacks API Key as the value

![](/files/-MaZwnVzXtyllh_lmNuA)

**24.** Add the **Input** to hold your data for the new Custom Action (*You can name this whatever you like, but below is a suggestion*).

<mark style="color:purple;">**Delete**</mark> **Recurring Notifications Input**

| Suggested Input Name | Input Type | Suggested Input Value                                                         |
| -------------------- | ---------- | ----------------------------------------------------------------------------- |
| **Notification ID**  | Text       | Use the generated ID from the Create Recurring Notification action you setup. |

**25.** Replace the **capitalized text** in the URL with the **Input** you just made using the **Magic Text** button in the top right of the URL field.

![](/files/QYa98sOChnirC7EiogC6)

**26.** Run the test request, then click Save Custom Action.&#x20;

{% hint style="info" %}
Even test actions that fail sometimes return a "Test Successful" message so be sure to click **Show Full Response** to ensure the action succeeded. This is by design so that you can still save the action and return to continue setting it up later if you wish.
{% endhint %}

![](/files/jXryfGd0Ywettl75cKlY)

### Setting Up the Database Collection

Anytime you create a recurring notification, an ID is returned. You should save this ID to a collection in your Adalo database so that you can delete the notification if you need to. You can name this collection whatever you like - Notifications, Reminders, Events, etc.&#x20;

{% hint style="info" %}
All created notifications are stored outside of Adalo and will run indefinitely until you delete them with the Delete endpoint. You must maintain a collection of notification IDs in order to delete notifications.
{% endhint %}

Anytime you create a recurring notification with the Custom Action, you should also Create a notification in your Notifications collection. At the very least, you should have these properties in your collection:

<table><thead><tr><th>Property Name</th><th width="195.66666666666666">Property Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>ID</strong></td><td>Text</td><td>The is the ID returned by the Create Recurring Notification action.</td></tr><tr><td><strong>Creator</strong></td><td>Relationship - One User to Many Notifications</td><td>This is the creator of the notification. </td></tr><tr><td><strong>Notification Title</strong></td><td>Text</td><td>This is the title of the saved notification</td></tr><tr><td><strong>Notification Body</strong></td><td>Text</td><td>This is the body of the saved notification</td></tr></tbody></table>

![](/files/E3jzMVgezgzUHkLdYR8f)

### Action Setup

Your Create actions might look something like this:&#x20;

![](/files/Gu3vwBJpBbBonwSu3RIb)

## Example App

If you still need help, you can always check out [this cloneable app](https://previewer.adalo.com/02085dd7-4567-4a1e-b698-3621141e7a44) to see how you might build out your screens, database, and actions. If you need additional help, please see one of the many [support](https://www.adastacks.com/support) channels Adastacks has available.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.adastacks.com/stacks/recurring-notifications.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
