# Trigger an action when App is deployed

**URL:** <https://forum.bubble.io/t/trigger-an-action-when-app-is-deployed/331744>\
**Category:** Need help\
**Created:** [July 19, 2024, 4:33pm UTC](https://forum.bubble.io/t/trigger-an-action-when-app-is-deployed/331744 "2024-07-19T16:33:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dupuymaxime.pro](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/dupuymaxime.pro/32/176239_2.png) [@dupuymaxime.pro](https://forum.bubble.io/u/dupuymaxime.pro)\
**Post date:** [July 19, 2024, 4:33pm UTC](https://forum.bubble.io/t/trigger-an-action-when-app-is-deployed/331744/1 "2024-07-19T16:33:17Z")

</div>

Hi guys,

Any idea on how I can trigger an action when I deploy my app to Live in Bubble?

My use case is to send a Slack notification to my team for each deployment in Bubble. Many thanks for your help

 ![Capture d’écran 2024-07-19 à 18.32.02](https://us1.discourse-cdn.com/bubble/original/3X/6/4/6438c51aabc6d77fcbac1cb2a431b2975f21eedd.png)

---

<div class="post-metadata">

**Author:** ![codefree](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/codefree/32/220802_2.png) [@codefree](https://forum.bubble.io/u/codefree)\
**Post date:** [July 19, 2024, 6:05pm UTC](https://forum.bubble.io/t/trigger-an-action-when-app-is-deployed/331744/2 "2024-07-19T18:05:43Z")

</div>

Hey,

As bubble do not have an out-of-the-box listener for this event exposed, You can try this given script on the page load to observe the bubble’s default notification when the app changes are deployed.

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/2/5/25701044077507c07dd2826d04f2b64ec3effec5.jpeg)

You can replace the logic of custom function set a state OR trigger a custom event using Javascript to Bubble.

To confirm if the script is running fine, you should see something like this in the console.

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/4/a/4a27fe0ba010c748ae3dd42dde795bc45f45151b.png)

Here is the script:

```auto
  function onElementVisible(entries, observer) {
    entries.forEach(entry => {
      if (entry.isIntersecting) {
      // Add your custom logic here
        console.log("Element with class 'bad-revision' is visible");
        observer.unobserve(entry.target);
      }
    });
  }

  let observer = new IntersectionObserver(onElementVisible, {
    root: null,
    rootMargin: "0px",
    threshold: 0.1
  });

  function observeElements() {
    let targetElements = document.querySelectorAll(".bad-revision:not(.observed)");
    targetElements.forEach(element => {
      observer.observe(element);
      element.classList.add("observed"); // Mark as observed
    });
  }

  // Initial observation
  observeElements();

  // Mutation observer for dynamically added elements
  const mutationObserver = new MutationObserver(observeElements);
  mutationObserver.observe(document.body, { childList: true, subtree: true });

```

Let me know if this works for you.  
Happy to connect for further discussion.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [September 27, 2024, 4:34pm UTC](https://forum.bubble.io/t/trigger-an-action-when-app-is-deployed/331744/3 "2024-09-27T16:34:00Z")

</div>

Closed on September 27, 2024, 4:34pm UTC

This topic was automatically closed after 70 days. New replies are no longer allowed.
