1

My question is that I am developing an AI Powered Banking Chat-bot using RASA, Can anyone guide me how to deploy it or integrate it on an Mobile Application (Android)?

Thanks in Advance.

Afaq Khan
  • 212
  • 2
  • 9
  • 1
    Provide examples and code please. – adrisons Apr 13 '20 at 14:18
  • 1
    What sort of example? I am developing an Chatbot for my final year project and it's front end's gonna be on android. So, I need to know how will I be able to connect by bot(which is developed on python) can be integrated/deployed to my Android Application. – Afaq Khan Apr 14 '20 at 13:17

1 Answers1

0

I assume you use retrofit/Gson, if not it's easy to get the idea at first you need to retrive JWT token, for that you need to call

    @POST("api/auth/jwt")
    fun authenticateAsync(@Body authRequest: AuthRequest): Deferred<AuthResponse>

where AuthRequest is

data class AuthRequest(
    @SerializedName("conversation_id")
    @Expose
    val conversation_id: String = UUID.randomUUID().toString(),
    @SerializedName("chat_token")
    @Expose
    val chat_token: String
)

where conversation id is some random string, chat_token is the token when you share the bot, smth like 87f7d34f9aa74d51asdqwe27fac62c44

after getting jwt token you can post messages with

@POST("api/conversations/{conversation_id}/messages?environment=production")
fun postMessageAsync(
    @Header("Authorization") token: String,
    @Path("conversation_id") conversation_id: String,
    @Body messageRequest: MessageRequest
): Deferred<List<ChatMessageResponse>>

where

data class MessageRequest(
    @SerializedName("message")
    @Expose
    val message: String
)

and

data class ChatMessageResponse(
    @SerializedName("recipient_id")
    @Expose
    val recipient_id: String,
    @SerializedName("text")
    @Expose
    val text: String,
    @SerializedName("externalFields")
    @Expose
    val externalFields: List<String>,
    @SerializedName("custom")
    @Expose
    val custom: CustomResponseData? = null
)

Hope it was helpful

Hakob Hakobyan
  • 1,111
  • 8
  • 15