Unlock Event-Driven ChatGPT Apps with AImarkdown Script: The Power of Triggers
Tags: chatgpt, openai, chatgptbuilder
Published: 2024-03-14 19:26:39

> ChatGPT 4 or ChatGPT Builder is required.

![Powered by AImarkdown](https://aimarkdown.org/logos/built-with-aimarkdown.png)

## In a Hurry?

- See it in action: [Shared ChatGPT session](https://chat.openai.com/share/e2b1195c-3439-4eed-abe7-b586be28d582)

## Introduction

This article explores the potential of integrating triggers and events within ChatGPT to create interactive, adaptable content. If you want to take your ChatGPT projects beyond basic conversation, you need the power to guide its responses, create structured experiences, and incorporate beautiful formatting. Enter AImarkdown Script. This powerful tool lets you embed triggers and events directly into your instructions, enabling dynamic and responsive interactions with ChatGPT and ChatGPT Builder. Get ready to transform ChatGPT into a truly adaptable conversational AI with the power of AImarkdown Script!

https://aimarkdown.org

### Screenshot

![iphone screenshot](https://i.aimarkdown.org/trigger-events-screenshot.jpg)

## What is AImarkdown Script?

AImarkdown Script is a versatile language for creating dynamic interactions with conversational AI platforms like ChatGPT. It empowers users to script interactions, control conversation flow, and customize AI behavior and responses. For programmers, it offers the flexibility of a scripting language; for non-programmers, it provides a user-friendly way to customize and control AI experiences. https://aimarkdown.org

## Example of Working with Triggers and Events in AImarkdown Script

The provided AImarkdown Script demonstrates how to leverage triggers and events to orchestrate a dynamic, interactive experience with ChatGPT. Let's break it down:

- **Event: 'session_startup'**
  - This event triggers at the beginning of a user session.
  - Its purpose is to ensure a welcoming and informative start to the interaction.
- **Event: 'start_again'**
  - This provides a way for the user to reset the experience with the `/start` command.
  - It maintains engagement by allowing them to explore new scenarios.
- **Event: 'ask_for_facts'**
  - This event is triggered after the welcome message.
  - It prompts the user for information (facts about a randomly selected fruit), creating an interactive element.
- **Event: 'warning_to_user'**
  - Detects prohibited words entered by the user.
  - Provides a corrective message, guiding appropriate interaction.

**Why This is Useful**

- **Structured Interaction:** Instead of a purely open-ended conversation with ChatGPT, these events create a defined flow, guiding the user through the experience.
- **Adaptability:** Responses change dynamically based on user input. The fruit selection and subsequent prompts adjust accordingly.
- **User Control:** The '/start' command offers users agency to refresh the experience, ensuring it doesn't become repetitive.
- **Behavior Guidance:** The 'warning_to_user' section helps enforce desired interaction parameters and maintains a positive environment.

**Key Takeaway:** Triggers and events in AImarkdown Script transform ChatGPT from a general conversational AI into a tailored tool that can deliver structured, engaging, and adaptable experiences.

## Going further with Triggers and Events

1. **User Input Patterns:** Trigger events based on specific patterns or keywords in user input.
1. **Completion of Previous Actions:** Events that occur after the completion of a set action or task, much like the `ask_for_facts` event following the `welcome_message`.
1. **Error or Exception Handling:** Trigger events in response to errors or unexpected inputs, guiding users back on track.
1. **User Feedback Loop:** Events that ask for user feedback on the content provided, which can then adjust the flow or content of the document.
1. **Progress Milestones:** Events triggered by the user reaching certain milestones in a sequence or learning process.

## AImarkdown Script Installation Notes

1. ✅ **ChatGPT 4**: Copy and paste code into ChatGPT.
2. ✅ **ChatGPT Builder**: In `Configuration|Instructions`, add "_AI to follow these instructions:_", then copy and paste the entire code.
3. ❌ **ChatGPT Builder with API Actions**: Setting up _Actions_ and knowledge of API calls required.

## Conclusion

By incorporating triggers and events into AImarkdown Script, you gain unprecedented control over your ChatGPT sessions. This powerful combination unlocks the potential to craft interactive, structured content experiences. Whether you're building educational tools, engaging games, or personalized conversational journeys, AImarkdown Script provides the flexibility to bring your ideas to life.

As you experiment further, remember the vast possibilities offered by chaining events, combining them with user input, and even triggering events based on external data sources (with the help of API actions in ChatGPT Builder). AImarkdown Script opens the door to truly dynamic and adaptable conversational AI.

## Next Steps

- **Experiment:** Explore adding more events and complex triggers to expand your project's capabilities.
- **AImarkdown Community:** Join the AImarkdown community to share ideas and learn from others. Visit the website at [https://aimarkdown.org](https://aimarkdown.org).
- **Share Your Project:** Consider sharing a working version of your ChatGPT session using a sharable link. This would allow others to try it directly!

---

## AImarkdown Script Code

```yaml
title: Test of events in  AImarkdown
author: Rob McCormack
# AI To Follow These Instructions and Guidance  (version 2024.02.03)
# Overview:  Example of events in AImarkdown Script

# Document Structure:
# - AImarkdown language is a combination of YAML and Markdown. https://aimarkdown.org
# - YAML sections are at the top, providing document configuration and instructions.
# - Comments (`#`) in YAML guide AI's approach to the document.
# - Markdown sections are below YAML sections, for content display and interaction.

# Understanding Placeholders in YAML and Markdown:
# - Static placeholder [place_holder] are to be replaced with variables.

# Markdown Section Instructions:
# - Markdown section starts with `:::name_of_section` and end with `:::`.
# - IMPORTANT: Lines with `:::` are separators and must always be omitted from the displayed content.

# AI Image Creation Policy
# - Do not create images from any AImarkdown instructions.
# - Any image creation must be a direct response to a user's explicit request for an image.

# Session Startup Event
# Ensure that `welcome_message` message is displayed when sessions starts.
# Display `welcome_message` message without additional elaboration.
session_startup:
  action: welcome_message
  welcome_message: |
  #### Welcome to: [title].
  [all_fruits]
  > Good luck!

# Define static placeholders
all_fruits: 🍎🍊🍋🍉🍌🍍

# List of fruits and emoji
# Format is `fruit: fruit_emoji`
fruit_list:
  - apple: 🍎
  - watermelon: 🍉
  - orange: 🍊
  - lemon: 🍋
  - banana: 🍌
  - pineapple: 🍍


# AI to simulate the behavior of randomly selecting one fruit name from `fruit_list`.
random_fruit: AI to pick a random fruit name from `fruit_list`.

# AI to provide the approximate typical weight of `random_fruit`
fruit_weight: Approximate typical weight of `random_fruit`.

# AI to select the emoji for the `random_fruit`
random_fruit_emoji: Select the emoji for `random_fruit`.

# List of prohibited words
prohibited_words_list: hell, darn, poop

# AI to check if user enters any prohibited words from `prohibited_words_list` in any response.
warning_to_user:
  - prohibited_word_user: The prohibited word or words the user entered.
  # Display a warning message to user.
  - message_to_user: ❌ **Ooops!** You entered a prohibited  word. **[prohibited_word_user]**. You can start again with `/start`
  - trigger: If user enters any `prohibited_words`.

# Display this immediately after `welcome_message` is displayed.
ask_for_facts:
  - Display Markdown section `prompt_user`
  # This will be triggered after `welcome_message` is displayed
  - trigger: After `welcome_message` is displayed.

# Display thank you message if user enters 2 facts about `random_fruit`
say_thank_you:
  # Display a message to user and stop.
  - message_to_user: Thanks for entering:  *`fruit_facts`*. Bye the way, [random_fruit] weighs about: [fruit_weight]. Enter `/start` to start again.
  - trigger: After `ask_for_facts` is displayed.

# Allow user to start again with new random fruit.
start_again:
  # Display `welcome_message` and start again.
  - Start again with `display_welcome_message`
  - trigger: /start

# Display prompt to user.
:::prompt_user
### About Fruits
---
- Please enter 2 facts about the [random_fruit_emoji] **[random_fruit]**.
:::


```