# Connection of custom data (from botfront rasa-webchat) to rasa custom action (customs.py)

**URL:** <https://forum.rasa.com/t/connection-of-custom-data-from-botfront-rasa-webchat-to-rasa-custom-action-customs-py/39249>\
**Category:** Rasa Open Source\
**Created:** [January 20, 2021, 1:27am UTC](https://forum.rasa.com/t/connection-of-custom-data-from-botfront-rasa-webchat-to-rasa-custom-action-customs-py/39249 "2021-01-20T01:27:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freddyonata](https://avatars.discourse-cdn.com/v4/letter/f/65b543/32.png) [@Freddyonata](https://forum.rasa.com/u/Freddyonata)\
**Post date:** [January 20, 2021, 1:27am UTC](https://forum.rasa.com/t/connection-of-custom-data-from-botfront-rasa-webchat-to-rasa-custom-action-customs-py/39249/1 "2021-01-20T01:27:50Z")

</div>

Hi i across googling the solution to pass the data from the js rasa webchat to the custom action. Some of the solution using the steps :

1. add this code to the credential.yml

> ```
> socketChannel.SocketIOInput:
> user_message_evt: user_uttered
> bot_message_evt: bot_uttered
> session_persistence: false
> 
> ```

1. copy paste socketChannel.py (i don’t know where to put, so i put this to the root project folder/same location with credential.yml) [socketChannel.py](https://forum.rasa.com/uploads/short-url/2zRME5VzxPDcK0ySXPdNA3j643Z.py) (6.9 KB) I already add this to the socketChannel.py :

> message = UserMessage( data[“message”], output\_channel, sender\_id, input\_channel=self.name(),metadata=data[“customData”] )

1. this is my index.html code[index.html](https://forum.rasa.com/uploads/short-url/8iMgCmbCyvdzBklomvjvCLoBEDt.html) (1.3 KB)

my custom data file code

> customData: [{“language”: “en”, “[sender\_email":"freddy.yonata@gmail.com](mailto:sender_email%22:%22freddy.yonata@gmail.com)”}]

i want to pass “sender\_email” but when i have stories like

> - story: init-webchat steps:
> - intent: greetWebchat
> - action: action\_hello\_world

in the action\_hello\_world i try to get metadata using this function

> def extract\_metadata\_from\_tracker(tracker): events = tracker.current\_state()[‘events’] user\_events = for e in events: if e[‘event’] == ‘user’: user\_events.append(e)
> 
> ```
> return user_events[-1]['metadata']
> 
> ```

but it is return the metadata by blank

could someone help me?

i already try to pass the sender\_email in initPayload like initPayload : ‘/greetWebchat{“sender\_email”:“freddy@mail.com”}’ this give me error in terminal as internal server eerror

---

<div class="post-metadata">

**Author:** ![rctatman](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/rctatman/32/6734_2.png) [@rctatman](https://forum.rasa.com/u/rctatman)\
**Post date:** [January 22, 2021, 8:08pm UTC](https://forum.rasa.com/t/connection-of-custom-data-from-botfront-rasa-webchat-to-rasa-custom-action-customs-py/39249/2 "2021-01-22T20:08:22Z")

</div>

Hi Freddy! I’m not super familiar with Botfront (it’s not built by us) so I might recommend asking in the Botfont support group instead: [Spectrum](https://spectrum.chat/botfront)

---

<div class="post-metadata">

**Author:** ![Sweksha](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@Sweksha](https://forum.rasa.com/u/Sweksha)\
**Post date:** [June 3, 2022, 7:36am UTC](https://forum.rasa.com/t/connection-of-custom-data-from-botfront-rasa-webchat-to-rasa-custom-action-customs-py/39249/3 "2022-06-03T07:36:08Z")

</div>

@Freddyonata I am stuck with something similar. Any help on how did u resolve this. ??
