Simple Custom Action Walkthrough

In the Example below, we are going to use a simple RestAPI to get and display data in your app.

Example: Getting a Daily Joke From an API

Let’s say you want your app to tell a joke when someone taps a “Make Me Laugh” button. You can do this by connecting to a public joke API.

  1. Add a Button On your screen, add a button and label it “Make Me Laugh.”

  2. Create a Custom Action Select the button, click Add Action, and choose Custom Action. Scroll down to +New Custom Action.

  3. Set Up the Request

    • Method: GET

    • URL: https://official-joke-api.appspot.com/jokes/random

    • You don’t need headers or a body for this one — it’s ready to go.

  4. Run Test Request Click Run Test Request.

  5. View Response

    • Click Show Full Response

    • You’ll see a JSON response that looks like this:

      {
        "type": "general",
        "setup": "Why don’t skeletons fight each other?",
        "punchline": "They don’t have the guts."
      }
  6. Add Outputs

    • Click +Add Item

    • Add setup and punchline as Text fields

    • Save your Custom Action

  7. Display the Joke

    • Add Input components to Display the setup and punchline

    • Add an Action on the Button following the Custom Action which Changes the Input Value for each output.

  8. Preview and Test

Now, every time someone taps Make Me Laugh, your app will fetch a brand-new joke from the API and display it instantly.

If you wish to use the output to update or create a record in your Adalo database, you can add a follow-up Update or Create action after your Custom Action. From there, use the Outputs from your Custom Action to set properties in a collection.

For example, you could create a new property in the Logged-in-User record named Daily Laugh. After running a Custom Action that returns a Joke, you could update the Logged in User Property to the Custom Action → Setup/Punchline output.

Last updated

Was this helpful?