# How to make the bot utter a response using Java

**URL:** <https://forum.rasa.com/t/how-to-make-the-bot-utter-a-response-using-java/58751>\
**Category:** Rasa Open Source\
**Created:** [June 22, 2023, 4:16pm UTC](https://forum.rasa.com/t/how-to-make-the-bot-utter-a-response-using-java/58751 "2023-06-22T16:16:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![meghnabajoria](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/meghnabajoria/32/23032_2.png) [@meghnabajoria](https://forum.rasa.com/u/meghnabajoria)\
**Post date:** [June 22, 2023, 4:16pm UTC](https://forum.rasa.com/t/how-to-make-the-bot-utter-a-response-using-java/58751/1 "2023-06-22T16:16:19Z")

</div>

Hi, I am trying to create a rasa bot using Java in Springboot application. One of the use cases is that if a user is able to log in successfully by giving a command like “login:username password” to the rasa chatbot then the bot should respond “Login successful” else “Invalid credentials”. To verify the credentials, I am calling an API in another service that returns if the login is successful or not. How do I make the bot respond according to the situation? Is there any API that I can use to make the bot utter a particular response? As far as I can see, this API has been deprecated. Do we have an alternative? [Rasa & Rasa Pro Documentation](https://rasa.com/docs/rasa/pages/http-api#operation/executeConversationAction)

Eg code

> ```
> if(feignResponse.getStatusCode().value() == 200) {
> System.out.println("YES");
> rasaClient.makeBotUtterance("Login successful");
> }
> else {
> System.out.println("NOPE");
> rasaClient.makeBotUtterance("Invalid credentials");
> }
> 
> ```

Which Rasa http api can I use inside makeBotUtterance?

---

<div class="post-metadata">

**Author:** ![stephens](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/stephens/32/1632_2.png) [@stephens](https://forum.rasa.com/u/stephens)\
**Post date:** [June 23, 2023, 3:26am UTC](https://forum.rasa.com/t/how-to-make-the-bot-utter-a-response-using-java/58751/2 "2023-06-23T03:26:33Z")

</div>

You should try the [REST endpoint](https://rasa.com/docs/rasa/connectors/your-own-website/) and invoke a slash intent (`/myintent`) which executes the action and response you want.

You could also call the action server directly as described [here](https://rasa.com/docs/action-server/pages/action-server-api).

---

<div class="post-metadata">

**Author:** ![meghnabajoria](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/meghnabajoria/32/23032_2.png) [@meghnabajoria](https://forum.rasa.com/u/meghnabajoria)\
**Post date:** [June 26, 2023, 9:43pm UTC](https://forum.rasa.com/t/how-to-make-the-bot-utter-a-response-using-java/58751/3 "2023-06-26T21:43:24Z")

</div>

Hi @stephens , thank you for the response. For the above API, do I still need to create a custom action in the actions.py file and then use the above API to call that action from my Spring boot application?

---

<div class="post-metadata">

**Author:** ![meghnabajoria](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/meghnabajoria/32/23032_2.png) [@meghnabajoria](https://forum.rasa.com/u/meghnabajoria)\
**Post date:** [June 26, 2023, 11:21pm UTC](https://forum.rasa.com/t/how-to-make-the-bot-utter-a-response-using-java/58751/4 "2023-06-26T23:21:26Z")

</div>

I have one more question. Currently, I am sending a message to rasa like “login:username password” where username is my username and password is my password using API : [http://localhost:5005/webhooks/rest/webhook](http://localhost:5005/webhooks/rest/webhook) and then using this API: [getConversationTracker](https://rasa.com/docs/rasa/pages/http-api/#operation/getConversationTracker) to get back the tracker for the message “login:username password” so that I can do further processing on the basis of intents that it was classified into and call any specific action. Is this the best way to do so or is there any better way?

---

<div class="post-metadata">

**Author:** ![stephens](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/stephens/32/1632_2.png) [@stephens](https://forum.rasa.com/u/stephens)\
**Post date:** [July 3, 2023, 4:06pm UTC](https://forum.rasa.com/t/how-to-make-the-bot-utter-a-response-using-java/58751/5 "2023-07-03T16:06:57Z")

</div>

I thought you were wanted to create a Rasa action server.

Normally, you would handle the login in your front end service and then pass a JWT token to the Rasa bot if it needs to invoke custom actions that need authentication.

---

<div class="post-metadata">

**Author:** ![meghnabajoria](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/meghnabajoria/32/23032_2.png) [@meghnabajoria](https://forum.rasa.com/u/meghnabajoria)\
**Post date:** [July 7, 2023, 5:38pm UTC](https://forum.rasa.com/t/how-to-make-the-bot-utter-a-response-using-java/58751/6 "2023-07-07T17:38:19Z")

</div>

Hi stephens,

No, I don’t want to create my own action server. I just want to understand if there’s a way to call actions/functions in actions.py file from Java and if that will be the same as calling those actions via rasa. I hope that makes some sense. I am not asking this specifically for just login but for any use case.

---

<div class="post-metadata">

**Author:** ![stephens](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/stephens/32/1632_2.png) [@stephens](https://forum.rasa.com/u/stephens)\
**Post date:** [July 8, 2023, 3:27am UTC](https://forum.rasa.com/t/how-to-make-the-bot-utter-a-response-using-java/58751/7 "2023-07-08T03:27:18Z")

</div>

You’ll find the API spec for the action server [here](https://rasa.com/docs/action-server/pages/action-server-api)
