# Simple Custom Action Walkthrough

#### 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.”**

   <figure><img src="/files/Dt0Bz0SP47E4EAXRwQN7" alt="" width="563"><figcaption></figcaption></figure>

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

   <figure><img src="/files/VPbNeioy7Dm5bLPAtcAs" alt="" width="299"><figcaption></figcaption></figure>

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.**&#x20;

   <figure><img src="/files/nkKnU9S0jrRWd4Kucs9f" alt="" width="563"><figcaption></figcaption></figure>

5. **View Response**
   * Click **Show Full Response**
   * You’ll see a JSON response that looks like this:

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

6. **Add Outputs**

   * Click **+Add Item**

     <figure><img src="/files/Je5zFmeoypdclwUJLIYK" alt="" width="563"><figcaption></figcaption></figure>
   * Add `setup` and `punchline` as Text fields

   <figure><img src="/files/ZrLPxsEs4iL5mFIv98Co" alt="" width="375"><figcaption></figcaption></figure>

   * 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.&#x20;

     <figure><img src="/files/M9BtW5dvfOY2sTXvTSIs" alt="" width="375"><figcaption></figcaption></figure>

     <figure><img src="/files/swuruLgbYnXoypbsdOhj" alt="" width="375"><figcaption></figcaption></figure>

8. **Preview and Test**<br>

   <figure><img src="/files/C41qF931qtfzIKYHhkvi" alt="" width="563"><figcaption></figcaption></figure>

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.


---

# 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://help.adalo.com/integrations/custom-actions/simple-custom-action-walkthrough.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.
