Document objects.
Prerequisites
- Python 3.10+
- A Twexapi API key
- Haystack installed in your retrieval pipeline
Install
MCP collection step
- Call Twexapi MCP with a focused task, such as searching tweets or loading a thread.
- Convert returned rows into
Documentobjects. - Add metadata fields like
tweet_id,author_username,created_at,route_used, andnext_cursor. - Write documents into your Haystack store.
Example handoff shape
Convert to documents
Tweet search
Use MCP for endpoint discovery and collection, then hand the normalized JSON into your Haystack pipeline.User timeline
For timeline retrieval, ask the agent to preserve a stable user identity and cursor.Pagination
Storehas_more and next_cursor separately from the embedded documents. Do not embed cursors into vector content; keep them in pipeline state so the next run can resume without changing indexed text.