Overview
Add passes cookies to the application's cookie-import and validation path. A successful response includes imported account names and a count of failed items. The default maximum is 25 cookies per request, and each cookie is limited to 4,096 characters.
Usage
Add <cookie> [cookie2 ...]
With password protection enabled, send AUTH <password> | Add <cookie> [cookie2 ...].
Complete Python example
import asyncio
import websockets
import json
URI = "ws://localhost:8765"
async def main():
async with websockets.connect(URI) as ws:
print("Connected to WebSocket server")
await ws.send("Add |_WARNING:-DO-NOT-SHARE-THIS...")
response = await ws.recv()
print(json.loads(response))
if __name__ == "__main__":
asyncio.run(main())
Example response
{
"ok": true,
"result": {
"action": "Add",
"imported": ["ExampleAccount"],
"imported_count": 1,
"failed_count": 1
},
"failed": [
{"index": 1, "error": "Cookie validation failed", "code": "INVALID_COOKIE"}
]
}