# Passing slot to javascript

**URL:** https://forum.rasa.com/t/passing-slot-to-javascript/58945
**Category:** Rasa Open Source
**Created:** [July 10, 2023, 6:09am UTC](https://forum.rasa.com/t/passing-slot-to-javascript/58945 "2023-07-10T06:09:27Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![reza7angkasa](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/reza7angkasa/32/22593_2.png) [@reza7angkasa](https://forum.rasa.com/u/reza7angkasa)
#### Post date: [July 10, 2023, 6:09am UTC](https://forum.rasa.com/t/passing-slot-to-javascript/58945/1 "2023-07-10T06:09:27Z")

</div>

class ActionFetchData(Action): def **init** (self) → None: super(). **init** () self.sio = sio self.retrieved\_messages = None

```
def name(self) -> Text:
    return "action_fetch_data"

def run(
    self,
    dispatcher: CollectingDispatcher,
    tracker: Tracker,
    domain: Dict[Text, Any],
) -> List[Dict[Text, Any]]:
    def handle_chat_message(data):
        message = data.get("message")         
        self.retrieved_messages = message

    self.sio.on("chat message", handle_chat_message)
    handoff_value = tracker.get_slot("handoff_value")
    cek_socket_url = tracker.get_slot("socketurl")
    print("check ", cek_socket_url)    
    dispatcher.utter_message(self.retrieved_messages)
    return [
        SlotSet("handoff_value", handoff_value), 
        ActionExecuted("action_listen"),
        UserUtteranceReverted(),
    ]

```

Log print: check localhost:3001

is there any how to pass the slot of `socketurl` to my js code? !(function () { let e = document.createElement(“script”), t = document.head || document.getElementsByTagName(“head”)[0]; (e.src = “./js/index.js”), (e.async = true), (e.onload = () =\> {  
const socketurl2 = “{{ socketurl }}”;  
console.log(“socketurl:”, socketurl2); window.WebChat.default( { initPayload: “/greet”, customData: { language: “en” }, socketUrl: “[http://localhost:5007](http://localhost:5007)”, title: “HelpBot”, subtitle: “say hi and get started!”, }, null );

log: socketurl: {{ socketurl }}

it was supposed to be socketurl: localhost:3001, i’m confused how to pass slot `socketurl` from my rasa app to my js in index.html, they are all in the same directory, but i need to pass my `socketurl` slot to my js in index.html
