Git Product home page Git Product logo

Comments (6)

mmenti avatar mmenti commented on July 3, 2024 1

@znat I think I have something working, for sending simple text messages (which is all my particular use case requires right now). But.. I'm struggling to figure out how to implement any tests (I can't actually even get the existing ones to run successfully), but the project builds, and it works at least as an embedded <script> in a test page (a temporary test page is at http://35.178.228.52/rasa-webchat). Is that sufficient to submit a PR, or would you want me to add tests also?

from rasa-webchat.

MatthieuJnon avatar MatthieuJnon commented on July 3, 2024 1

For anyone looking through this issue, the webchat react component now exposes a sendMessage(payload: string, text?: string) function through its ref. You can then call this method whenever you want from your front end.

from rasa-webchat.

znat avatar znat commented on July 3, 2024

from rasa-webchat.

mmenti avatar mmenti commented on July 3, 2024

@znat thanks, I'll take a look! Sadly not super familiar with React, but may be able to gather enough from looking through source :)

from rasa-webchat.

xkungfu avatar xkungfu commented on July 3, 2024

@znat I think I have something working, for sending simple text messages (which is all my particular use case requires right now). But.. I'm struggling to figure out how to implement any tests (I can't actually even get the existing ones to run successfully), but the project builds, and it works at least as an embedded <script> in a test page (a temporary test page is at http://35.178.228.52/rasa-webchat). Is that sufficient to submit a PR, or would you want me to add tests also?

Got error of your example code:

Uncaught TypeError: WebChat.sendMessage is not a function
    at sendMessageToWidget (test-rasawebchat:56)
    at HTMLAnchorElement.onclick

Please help: How to define the function "WebChat.sendMessage"?

thanks!

from rasa-webchat.

xkungfu avatar xkungfu commented on July 3, 2024

For anyone looking through this issue, the webchat react component now exposes a sendMessage(payload: string, text?: string) function through its ref. You can then call this method whenever you want from your front end.

dose it must send a message to rasa first? and then put the response to chatbox window?
can I directly put some text or element to the window?

from rasa-webchat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.