Use a WebSocket endpoint leading to
wss://app.readpartner.com/api/v1/monitoring.Establish an active WebSocket connection passing your desired search filters in the URL. (You can expirement with URL params here: https://app.readpartner.com/api-dashboard/playground)
The backend will send an event with
event=statusandmessage=Task started.The next event with
event=resultwill contain the result items for selected platforms in thedatafield. The results will be sorted by newest and are limited to 20 entries.
python
import asyncio
import json
import websockets
URL = "wss://app.readpartner.com/api/v1/monitoring?q=search_keyword" API_KEY = "your_api_key"
async def process(api_items):
for item in api_items:
print(item)
async def listen():
async with websockets.connect(URL, additional_headers={"X-API-Key": API_KEY}) as ws:
async for message in ws:
data = json.loads(message)
if data["event"] == "status":
print(data["message"])
if data["event"] == "result":
await process(data["data"])
asyncio.run(listen())
Questions? Feel free to reach out to your account manager or via support chat.