title: botfront rasa-webchat get/use bot message
body: <p>I'm using the Botfront/rasa-webchat component on a webpage. I want to send the message returned by the bot to a bot libre avatar. TBH I'm not a javascript programmer, most of my work is in python, but I cannot figure out how I can get the result returned by rasa so I can pass it to the avatar SDK. I believe the onSocketEvent may hold the key, but I haven't been able to make that work. Please help. Here's my current (dysfunctional) code.</p>
  <pre><code>&lt;html&gt;
  &lt;body&gt;
      &lt;p&gt;welcome to the class chatbot&lt;/p&gt;
    &lt;script type='text/javascript' src=&quot;https://www.botlibre.com/scripts/sdk.js&quot;&gt;&lt;/script&gt;
    &lt;script type='text/javascript'&gt;
      !(function () {
      let e = document.createElement(&quot;script&quot;),
        t = document.head || document.getElementsByTagName(&quot;head&quot;)[0];
      (e.src =
        &quot;https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js&quot;),
        (e.async = !0),
        (e.onload = () =&gt; {
          window.WebChat.default(
            {
              customData: { language: &quot;en&quot; },
              socketUrl: &quot;http://localhost:5005&quot;,
              onSocketEvent: onSocketEvent,
              // add other props here
            },
            null
          );
        }),
        t.insertBefore(e, t.firstChild);
    })();
  
    SDK.applicationId = &quot;1591399486198011154&quot;;
    var sdk = new SDKConnection();
    var web = new WebAvatar();
    web.version = 8.5;
    web.connection = sdk;
    web.avatar = &quot;37788053&quot;;
    web.voice = &quot;cmu-slt&quot;;
    web.voiceMod = &quot;default&quot;;
    web.width = &quot;300&quot;;
    web.height = &quot;300&quot;;
    web.createBox();
    web.addMessage(&quot;Hello, I am Tuesday. The class chatbot&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;);
    web.processMessages();
    onSocketEvent={
      'bot_uttered': function(e) {console.log(e.bot_uttered)
      },
      'connect': () =&gt; console.log('connection established'),
      'disconnect': () =&gt; doSomeCleanup(),
    };
    &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>