Protocols/WebAPI/Reference/Methods/Chat

From NINA Wiki
Jump to navigation Jump to search
WebAPI Protocol
Basic
Introduction
Clients
Whimsicals
Host Interaction
Flow
Authentication
Client
WebApp
Other Services
Foodgroups

This page is about WebAPI chat methods, in a series for the WebAPI reference manual.

This is a NINA-created service and wasn't present in the original WebAPI.

To use chats you must subscribe to the "chats" Event Type. Chat events are sent through there to announce chat specific events (message, user joins, user depatures, et cetera).

createAndJoinChat

Creates (if it doesn't exist) and joins a chat.

URL: GET http://api.nina.chat/chat/createAndJoinChat

Input Parameters

NOTE: You must either pass in roomId or roomName, not both.

Type Field Description
Format f [Required] The format of the data returned
String c JSONP callback
String r Request id
String aimsid [Required] Use an AIM Session Id from the startSession call for authentication
String roomId Room ID as returned by the API
String roomName Room name

Common Status Codes

Status Code Description
200 Success
460 Missing required parameter
462 Parameter error

Output Fields

Type Field Description
String chatsid ID that identifies this chat room session, not to be confused with the roomID
ChatRoom room Chat room information

Sample JSON Output

{
  "response": {
    "statusCode": 200,
    "statusText": "Ok",
    "data": {
      "chatsid": "1352330044",
      "room": {
        "roomName": "Last Call",
        "roomId": "aol://2719:10-4-lastcall",
        "instanceId": 0,
        "roomType": "userCreated",
        "categoryId": "131245"
      }
    }
  }
}

Sample XML Output

<?xml version="1.0" encoding="UTF-8"?>
<response xmlns="http://developer.aim.com/xsd/chat.xsd">
    <statusCode>200</statusCode>
    <statusText>Ok</statusText>
    <data/>
</response>


sendMessage

Sends a message to a chat room

URL: GET http://api.nina.chat/chat/sendMessage

Input Parameters

Type Field Description
Format f [Required] The format of the data returned
String c JSONP callback
String r Request id
String aimsid [Required] Use an AIM Session Id from the startSession call for authentication
String chatsid [Required] Chat session ID as returned by the API on createAndJoinChat
String message [Required] Message to send to the chat room
String whisperTarget Whisper target if the message is a whisper; do not send if not a whisper

Common Status Codes

Status Code Description
200 Success
460 Missing required parameter
462 Parameter error

Sample JSON Output

{
  "response": {
    "statusCode": 200,
    "statusText": "Ok",
    "data": {
    }
  }
}

Sample XML Output

<?xml version="1.0" encoding="UTF-8"?>
<response xmlns="http://developer.aim.com/xsd/chat.xsd">
    <statusCode>200</statusCode>
    <statusText>Ok</statusText>
    </data>
</response>

setTyping

Sets typing status for a chat room

URL: GET http://api.nina.chat/chat/setTyping

Input Parameters

Type Field Description
Format f [Required] The format of the data returned
String c JSONP callback
String r Request id
String aimsid [Required] Use an AIM Session Id from the startSession call for authentication
String chatsid [Required] Chat session ID as returned by the API on createAndJoinChat
Typing Status typingStatus [Required] The new typing status

Common Status Codes

Status Code Description
200 Success
460 Missing required parameter
462 Parameter error

Sample JSON Output

{
  "response": {
    "statusCode": 200,
    "statusText": "Ok",
    "data": {
    }
  }
}

Sample XML Output

<?xml version="1.0" encoding="UTF-8"?>
<response xmlns="http://developer.aim.com/xsd/chat.xsd">
    <statusCode>200</statusCode>
    <statusText>Ok</statusText>
    </data>
</response>

leaveChat

Leaves current chat room

URL: GET http://api.nina.chat/chat/leaveChat

Input Parameters

Type Field Description
Format f [Required] The format of the data returned
String c JSONP callback
String r Request id
String aimsid [Required] Use an AIM Session Id from the startSession call for authentication
String chatsid [Required] Chat session ID as returned by the API on createAndJoinChat

Common Status Codes

Status Code Description
200 Success
460 Missing required parameter
462 Parameter error

Sample JSON Output

{
  "response": {
    "statusCode": 200,
    "statusText": "Ok",
    "data": {
    }
  }
}

Sample XML Output

<?xml version="1.0" encoding="UTF-8"?>
<response xmlns="http://developer.aim.com/xsd/chat.xsd">
    <statusCode>200</statusCode>
    <statusText>Ok</statusText>
    </data>
</response>