Skip to content

Latest commit

 

History

History
72 lines (51 loc) · 1.79 KB

close-chat.md

File metadata and controls

72 lines (51 loc) · 1.79 KB

Close Chat

Action to Close a Chat Session

  • URL

    REST API URL can be found on Apps Page
    image Sample Url for eg:
    http://localhost:3000/api/apps/public/783d8e4d-b06a-409a-aaf3-b37650dc0a26/incoming

  • Method:

    POST

  • Input Data Format

    JSON

  • Data Params

    Required:

    1. action=close-chat

    2. sessionId=[string]

      Note. Session Id is the same session of Dialogflow. Also note that, session Id is the same as Room Id on Rocket.Chat. Click here to know more about Dialogflow sessions.

  • Success Response:

    • Code: 200
      Content: Close chat request handled successfully
  • Error Response:

    • Code: 400 BAD REQUEST
      Content:
      { error: "Error: Session Id not present in request" } OR

    • Code: 500 Internal Server Error
      Content:
      { error : "Error!! Invalid Action type" }

    OR

    • Code: 500 Internal Server Error
      Content:
      { error : "Error occurred while processing close-chat. Details:- [Error Details]" }
  • Sample Call:

    Curl

    curl "http://localhost:3000/api/apps/public/783d8e4d-b06a-409a-aaf3-b37650dc0a26/incoming" \
    -X POST \
    -d "{\n  \"sessionId\": \"2Sfq8wXw4fYPMf6r4\"\n}" \
    -H "Content-Type: application/json" 

    HTTP

      POST /api/apps/public/783d8e4d-b06a-409a-aaf3-b37650dc0a26/incoming HTTP/1.1
      Host: localhost:3000
      Content-Type: application/json
    
      {
          "action": "close-chat",
          "sessionId": "2Sfq8wXw4fYPMf6r4"
      }