Creating an Android Studio application with Rasa

Hi @zaidalvi In local host as mentioned the endpoint is http://localhost:/webhooks/rest/webhook

But things change a lot when you deploy on GCP, Before you use it you have to get an bearer access token by following method:

Your endpoint is :
 http://<your_ip>/api/auth

with Json Body as POST request: 

{
	"username": "your usename, usually its me",
	"password": "your password"
}

It will return something like this:

{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1c2VybmFtZSI6Im1lIiwiZXhwIjoxNTg2MTE1MDMxLCJ1c2VyIjp7InVzZXJuYW1lIjoibWUiLCJyb2xlcyI6WyJhZG1pbiJdLCJkYXRhIjpudWxsLCJhcGlfdG9rZW4iOiI2MjkzYWU5MDcxMmIyYjEwNzJjNTBmNmFkNTE2YjJlMmUzNTc1ZjE4In0sInNjb3BlcyI6WyJhY3R
---really long access token
pb25QcmVkaWN0aW9uOmNyZWF0ZSIsImFjdGlvblByZWRpY3Rpb246Z2V0IiwiYWN0aW9uczpjcmVhdGUiLCJhY3Rpb25zOmRlbGV0ZSIsImFjdGlvbnM6Z2V0IiwiYWN0aW9uczp1cGRhdGUiLCJhbGxFd
9tWCLbQtPGe8jDfxExLwLdcxvkF7s5DQail8gtt_60mLPAlNRKbWeR3zpJ8RFf_KOAqxXDcg9rrZO-g_hXRng1ePOFOyrOFlQLMp0IN4YwRgHhdbqIlypdw"
}

authentication curl request will be like this:

curl --location --request POST 'http://your_ip/api/auth' \
--header 'Content-Type: application/json' \
--data-raw '{
	"username": "your username",
	"password": "your password"
}'

Now use this bearer token as authentication to chat endpoint:

The endpoints to chat is

http://<your_ip>/api/chat

with body in Json as POST request:

{
      "message" : <your input string here>
}

with bearer token.

Your curl request will be like this:

curl --location --request POST 'http://your ip/api/chat' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1c2VybmFtZSI6Im1lIiwiZXhwIjoxNTg2MTE1MDMxLCJ1c2VyIjp7InVzZXJuYW1lIjoibWUiLCJyb2xlcyI6WyJhZG1pbiJdLCJkYXRhIjpudWxsLCJhcGlfdG9rZW4iOiI2MjkzYWU5MDcxMmIyYjEwNzJjNTBmNmFkNTE2YjJlMmUzNTc1ZjE4In0sInNjb3BlcyI6WyJhY3R
---really long access token
pb25QcmVkaWN0aW9uOmNyZWF0ZSIsImFjdGlvblByZWRpY3Rpb246Z2V0IiwiYWN0aW9uczpjcmVhdGUiLCJhY3Rpb25zOmRlbGV0ZSIsImFjdGlvbnM6Z2V0IiwiYWN0aW9uczp1cGRhdGUiLCJhbGxFd
9tWCLbQtPGe8jDfxExLwLdcxvkF7s5DQail8gtt_60mLPAlNRKbWeR3zpJ8RFf_KOAqxXDcg9rrZO-g_hXRng1ePOFOyrOFlQLMp0IN4YwRgHhdbqIlypdw' \
--header 'Content-Type: application/json' \
--data-raw '{
	"message": "hi"
}'

Refer to this for more documentation HTTP API.

1 Like