Skip to main content

Twitter search & user timeline components for Haystack

OpenSSF Best Practices

Search Twitter and fetch public user timelines in Haystack RAG pipelines. Each Xquik result becomes a Haystack Document.

Read the Xquik Haystack guide.

Components

Task Haystack Component Xquik Route Output
Search tweets for RAG XquikTweetSearch GET /x/tweets/search Matching posts as Document objects
Retrieve a user's timeline XquikUserTweetsFetcher GET /x/users/{id}/tweets Recent user posts as Document objects

Import both read-only components from the Haystack integration namespace.

from haystack_integrations.components.websearch.xquik import XquikTweetSearch, XquikUserTweetsFetcher

Both components read XQUIK_API_KEY by default and accept a Haystack Secret. They send x-api-key and xquik-api-contract: 2026-04-29 headers. Set base_url for another Xquik-compatible endpoint. Results include documents, links, has_more, and next_cursor.

Use an Xquik SDK for follower exports or posting.

Install

pip install xquik-haystack

Build a Haystack RAG pipeline with Twitter search

Search posts

from haystack import Pipeline
from haystack.utils import Secret
from haystack_integrations.components.websearch.xquik import XquikTweetSearch

search = XquikTweetSearch(api_key=Secret.from_env_var("XQUIK_API_KEY"), top_k=10)

pipeline = Pipeline()
pipeline.add_component("x_search", search)

result = pipeline.run({"x_search": {"query": "haystack ai"}})
documents = result["x_search"]["documents"]

Fetch user posts

from haystack.utils import Secret
from haystack_integrations.components.websearch.xquik import XquikUserTweetsFetcher

fetcher = XquikUserTweetsFetcher(api_key=Secret.from_env_var("XQUIK_API_KEY"))

result = fetcher.run(user_id="example_user", include_replies=False)
documents = result["documents"]

Document mapping

Each tweet becomes a Haystack Document with this mapping.

  • Document.content: tweet text, or an empty string when text is missing
  • Document.meta["endpoint"]: Xquik endpoint family used by the component
  • Document.meta: available id, url, and created_at source values
  • Document.meta["author"]: available author identity and verification data
  • Document.meta: available like, repost, reply, quote, view & bookmark counts

Development

Use Hatch for builds and environment management.

pip install hatch==1.18.0
hatch run fmt-check
hatch run test:unit
hatch build

Unit tests mock all Xquik HTTP calls.

Support & project policies

License

xquik-haystack is distributed under the terms of the Apache-2.0 license.

Xquik is an independent third-party service. Not affiliated with X Corp. "Twitter" and "X" are trademarks of X Corp.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xquik_haystack-0.1.5.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xquik_haystack-0.1.5-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file xquik_haystack-0.1.5.tar.gz.

File metadata

  • Download URL: xquik_haystack-0.1.5.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for xquik_haystack-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b83bd3cc1475f51bbad3360f5b7db3488c8e6bee0e5a4124d5b2f054d1f3a8a2
MD5 c83c72cb06dbbc57e13fb6127d308d18
BLAKE2b-256 2486a578a40c46c57cbf0ffd29cae1001bfaef52ba343df72ceff43e1096d158

See more details on using hashes here.

Provenance

The following attestation bundles were made for xquik_haystack-0.1.5.tar.gz:

Publisher: release.yml on Xquik-dev/xquik-haystack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xquik_haystack-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: xquik_haystack-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for xquik_haystack-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a09256f3bbbd05f2cf46ae857d73694699590ae6e681bd4aac6647bf6cb8e20d
MD5 68b003b49d764c6eb0dbf497edfdcc75
BLAKE2b-256 83b48c04ad67d5627944e85e827f742f48e23d7d4394138ebb8664befe7a0021

See more details on using hashes here.

Provenance

The following attestation bundles were made for xquik_haystack-0.1.5-py3-none-any.whl:

Publisher: release.yml on Xquik-dev/xquik-haystack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 files

0.1.4

2 files

0.1.3

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page