# How to trigger events from custom actions

**URL:** <https://forum.rasa.com/t/how-to-trigger-events-from-custom-actions/49685>\
**Category:** Rasa Open Source\
**Created:** [December 2, 2021, 4:58am UTC](https://forum.rasa.com/t/how-to-trigger-events-from-custom-actions/49685 "2021-12-02T04:58:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![NIkhilBhaskar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nikhilbhaskar/32/18420_2.png) [@NIkhilBhaskar](https://forum.rasa.com/u/NIkhilBhaskar)\
**Post date:** [December 2, 2021, 4:58am UTC](https://forum.rasa.com/t/how-to-trigger-events-from-custom-actions/49685/1 "2021-12-02T04:58:38Z")

</div>

Hello,

I am using rasa version 2.8

I have a 2 part question

1. Can we still trigger UserUttered event from custom actions/forms in rasa 2 ?
2. If yes, then how can we do it?

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [December 2, 2021, 7:05am UTC](https://forum.rasa.com/t/how-to-trigger-events-from-custom-actions/49685/2 "2021-12-02T07:05:12Z")

</div>

Welcome to the forum 🙂

As per [the docs](https://rasa.com/docs/action-server/2.8.0/sdk-events#useruttered), you can use that event in 2.x and 3.x.

You use it like any other event, by returning it in a list from a custom action.

* * *

```python
UserUttered(
    text: Text, # Text of the message
    parse_data: Dict[Text, Any] # Parsed data of user message ordinarily filled by NLU
    timestamp: float, # Optional timestamp of the event
    input_channel: Text # The channel on which the message was received
)

```

---

<div class="post-metadata">

**Author:** ![NIkhilBhaskar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nikhilbhaskar/32/18420_2.png) [@NIkhilBhaskar](https://forum.rasa.com/u/NIkhilBhaskar)\
**Post date:** [December 2, 2021, 11:21am UTC](https://forum.rasa.com/t/how-to-trigger-events-from-custom-actions/49685/3 "2021-12-02T11:21:43Z")

</div>

@ChrisRahme Thankyou for your reply!

I saw this in docs, can you give me an example on how to implement this using all four fields

Thanks

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [December 2, 2021, 11:44am UTC](https://forum.rasa.com/t/how-to-trigger-events-from-custom-actions/49685/4 "2021-12-02T11:44:56Z")

</div>

@NIkhilBhaskar

Demo example:

```auto
UserUttered(text, parse_data["intent"], parse_data["entities"],
                           parse_data, timestamp, input_channel)

```

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [December 2, 2021, 1:07pm UTC](https://forum.rasa.com/t/how-to-trigger-events-from-custom-actions/49685/5 "2021-12-02T13:07:44Z")

</div>

```auto
UserUttered(
    text = 'Hello',
    parse_data = {
        'id': 123456789,
        'name': 'greet',
        'confidence': 1
    },
    timestamp = int(time.time()),
    input_channel = tracker.get_latest_input_channel()
)

```

---

<div class="post-metadata">

**Author:** ![NIkhilBhaskar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nikhilbhaskar/32/18420_2.png) [@NIkhilBhaskar](https://forum.rasa.com/u/NIkhilBhaskar)\
**Post date:** [December 2, 2021, 1:13pm UTC](https://forum.rasa.com/t/how-to-trigger-events-from-custom-actions/49685/6 "2021-12-02T13:13:10Z")

</div>

@ChrisRahme Thankyou so much this is reallly helpful!!! in parse\_data can I get id from tracker? or can I give any value to it? and name is intent name which I want? right?

Thanks

---

<div class="post-metadata">

**Author:** ![NIkhilBhaskar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nikhilbhaskar/32/18420_2.png) [@NIkhilBhaskar](https://forum.rasa.com/u/NIkhilBhaskar)\
**Post date:** [December 2, 2021, 1:13pm UTC](https://forum.rasa.com/t/how-to-trigger-events-from-custom-actions/49685/7 "2021-12-02T13:13:28Z")

</div>

thanks @nik202

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [December 2, 2021, 1:24pm UTC](https://forum.rasa.com/t/how-to-trigger-events-from-custom-actions/49685/8 "2021-12-02T13:24:26Z")

</div>

> [@NIkhilBhaskar](#):
>
> in parse\_data can I get id from tracker? or can I give any value to it?

It should just be a unique value. You can use `int(time.time() * 1000)` for example.

> [@NIkhilBhaskar](#):
>
> and name is intent name which I want? right?

Yup!

---

<div class="post-metadata">

**Author:** ![NIkhilBhaskar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nikhilbhaskar/32/18420_2.png) [@NIkhilBhaskar](https://forum.rasa.com/u/NIkhilBhaskar)\
**Post date:** [December 3, 2021, 7:16am UTC](https://forum.rasa.com/t/how-to-trigger-events-from-custom-actions/49685/9 "2021-12-03T07:16:39Z")

</div>

Thanks @ChrisRahme

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [December 3, 2021, 8:12am UTC](https://forum.rasa.com/t/how-to-trigger-events-from-custom-actions/49685/10 "2021-12-03T08:12:51Z")

</div>

No problem 🙂 Please mark the answer that helped you as solution
