Start a new topic

I can't create a custom chatbot system


I am an android developer. I'm developing apps for Pepper.

I need help with something on android side.

I'm developing a custom chatbot over the BaseChatbot class. 
But I never get the listened text. phrase.getText() in the replyTo function is always empty. I tried the language in English and Turkish, the result did not change.
The GreetingChatbot example on the following page is not working

1 person has this problem

Hello saidbicer, 

I can have a look into your issues. Can you indicate to me : 

- the Hardware and Software version of the Pepper you are using ? 

- do you have a nao-diagnosis available ? 

- do you have the logs of whenever the issue is happening ? 

- If possible, can you share your code so we can look into it ? 

Hello, Thank you for your help.

Naoqi version : 2.9.5

Pepper 1.8a


public class GreetingChatbot extends BaseChatbot {

    private static final String TAG = "GreetingChatbot";

    static private List<String> greetings = Arrays.asList( "hello", "hi", "good morning", "good afternoon", "good evening" );

    public GreetingChatbot(QiContext context) {

    public StandardReplyReaction replyTo(@NonNull Phrase phrase, Locale locale) {
        Log.e("text", phrase.getText());
        if (greetings.contains(phrase.getText())) {
            return new StandardReplyReaction(
                    new MyChatbotReaction(getQiContext(), "Hello you"),
        } else {
            return new StandardReplyReaction(
                    new MyChatbotReaction(getQiContext(), ""),

    public void acknowledgeHeard(Phrase phrase, Locale locale) {
        Log.i(TAG, "Last phrase heard by the robot and whose chosen answer is not mine: " + phrase.getText());

    public void acknowledgeSaid(Phrase phrase, Locale locale) {
        Log.i(TAG, "Another chatbot answered: " + phrase.getText());

    class MyChatbotReaction extends BaseChatbotReaction {

        private String answer;
        private Future<Void> fSay;

        MyChatbotReaction(final QiContext context, String answer) {
            this.answer = answer;

        public void runWith(SpeechEngine speechEngine) {

            Say say = SayBuilder.with(speechEngine)
            fSay = say.async().run();

            try {
                fSay.get(); // Do not leave the method before the actions are done
            } catch (ExecutionException e) {
                Log.e(TAG, "Error during Say", e);
            } catch (CancellationException e) {
                Log.i(TAG, "Interruption during Say");

        public void stop() {
            if (fSay != null) {



  Log.e("text", phrase.getText());

 This line never gets any text.

Actually this  

Log.e("text", phrase.getText()); 

isn't in the example from

What are you trying to achieve with this line ? 

The code I sent is the same example as the one in the link you gave. Java version.


if (greetings.contains(phrase.getText()))

The incoming text in the expression is compared with the string. But the problem is that phrase.getText() always returns null.

I want to send the text that will come here to a web service and return a response via the smart assistant.

But I can't see the sentence heard by the robot as text.

The dialog created as a .top file is fine. I want to capture the dialogs that I did not write in the .top file on the code side.

I believe you are trying it live on your Pepper. Can you describe or maybe take a picture of the blue speech bar when you are talking to pepper ? 

A custom chatbot requires an available remote speech recognition : if the speech bar always returns "?" or "<>", it might be that your remote speech recognition is not active, which you should request to Softbank. 

Thank you for the answer.

Yes, I am working with a real robot.

I didn't know that an option called remote speech recognition needed to be enabled. This is definitely my problem.

I searched the internet for the phrase "remote speech recognition".

The problem here is the same as mine.

Those who contacted Softbank could not get any results.

Here are the marks I got in the blue area:

In wildcards = "<>"

In remote chatbot recognition = "?"

I hesitate to email Softbank. I have a new robot, I emailed it to be added to the command center. It's been a week and they still haven't responded.

1 person likes this

Yes I understand, Softbank has undergone a restructuration lately and their support has been overwhelmed since. 

If you have bought the robots from Softbank, they will be the only ones able to activate the remote speech recognition service for you. 

You can contact them through the ticket platform :

If you don't get an answer in the next days, I'll try to see what I can do to help you.

Thank you for your answer. See you soon, bye

1 person likes this

Hello @saidbicer ,

I'm facing the same problem, were you able to solve it after contacting the support, please give me any kind of assistance, I been rolling out with problem for days now, how can I add google speech to api or any other remote speech module.

1 person likes this

Dear @saidbicer,

 I meet the same problem, and  guess it's caused by  the remote speech recognition service which is not  activated. Did you finally solve the problem ? Could you please share the way to solve this problem.

 Hey wanted to ask around about your idea, have some idea for local gpt maybe in the future, if the bosses allow that xD. Kind regards and at Service, T.B

Hey wanted to ask again. Kind regards and at Service, T.B from NCT

Thanks for update. Hope we can have positive feedback before long . 

1 person likes this
Login or Signup to post a comment