Skip to main content

X/Twitter Tweet Search & User Timeline Retrieval for Haystack

OpenSSF Best Practices

Retrieve public X/Twitter context through Xquik.

Choose these components when Haystack pipelines need tweet Document objects.

Read the Xquik Haystack guide.

Choose a Component

Retrieval question Haystack component Xquik route Output
How do I search tweets for RAG? XquikTweetSearch GET /x/tweets/search Matching posts as Document objects
How do I retrieve a user's timeline? XquikUserTweetsFetcher GET /x/users/{id}/tweets Recent user posts as Document objects

This package exposes 2 read-only components. Use an Xquik SDK for follower exports or posting.

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.
  • Accept haystack.utils.Secret for explicit keys.
  • Send x-api-key and xquik-api-contract: 2026-04-29.
  • Allow a custom base_url for controlled deployments.
  • Return documents, links, has_more, and next_cursor.

Install

Install from PyPI:

pip install xquik-haystack

Search Public X Data

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.

  • Document.content: tweet text, or an empty string when text is missing
  • Document.meta["endpoint"]: Xquik endpoint family used by the component
  • Document.meta["id"]: tweet ID when present
  • Document.meta["url"]: tweet URL when present
  • Document.meta["created_at"]: tweet creation time when present
  • Document.meta["author"]: author ID, username, display name, and verification status when present
  • Document.meta also includes available public metrics such as like, repost, reply, quote, view, and bookmark counts

Development

This project uses Hatch for build and environment management.

pip install hatch
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.4.tar.gz (20.2 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.4-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xquik_haystack-0.1.4.tar.gz
  • Upload date:
  • Size: 20.2 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.4.tar.gz
Algorithm Hash digest
SHA256 202769722fff12c28c0fe05f1f3ebe3771dede54d4f98f7a1fab3e572182ed51
MD5 dea055040f0eee53150cbb40f3eaea1e
BLAKE2b-256 1034f0e9fd6600ffd4badb9c6c8ca11aba703e83ad6690c2b3ae967921fc1b8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for xquik_haystack-0.1.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: xquik_haystack-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 11.1 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 706343415a5d2d542abc6e8c32154219ffde3d411eedb5437cdcc535bb0b8834
MD5 fbace10064e05f87770da6e4c4f3c8f1
BLAKE2b-256 50b194e67a765f2b9778c3f741e5ef161b238cb4a5537363cf1adc00d37d5638

See more details on using hashes here.

Provenance

The following attestation bundles were made for xquik_haystack-0.1.4-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

0.1.5

2 files

This release

0.1.4 This release

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