> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xquik.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Zapier Twitter result handoff & output fields

> Map X (Twitter) results in Zapier with samples and outputFields. Later Zap steps then read stable snake_case values from tweets, profiles, jobs, and events.

> For the complete documentation index, see [llms.txt](https://docs.xquik.com/llms.txt).

This guide belongs to the [Zapier Twitter integration](https://docs.xquik.com/guides/zapier.md) build.

## Result handoff

Use Zapier samples and `outputFields` so later Zap steps map stable values.
Use snake\_case storage keys when direct API responses use camelCase. Return
compact objects from actions and arrays from triggers.

> [card] Search tweets action
>
> Return `id`, `tweet_id`, `text`, `author_username`, `created_at`, and `url`. Keep `has_next_page` and `next_cursor` when a Zap loops pages.

> [card] User profile rows
>
> Return source `id` as `user_id`. Keep `username`, `name`, `followers`, `verified`, and `profile_picture`. Store the input, `has_next_page`, and `next_cursor` separately.

> [card] Follower and following rows
>
> Store `user_id`, `username`, `name`, `followers`, `following`, `verified`, and `profile_picture`. Keep the source account, page cursor, and relationship direction.

> [card] Trend rows
>
> Return each trend `name`, `rank`, `query`, and `description`. Keep response `count`, `woeid`, and the selected region with the Zap run.

> [card] Tweet or reply write
>
> Send a unique `Idempotency-Key`. Store `id`, `status`, `billing`, `result`, and `statusUrl`. Poll while `terminal` is false. Retry only when `safeToRetry` is true, using a new key.

> [card] Media attachments
>
> For tweets or replies, pass public URLs in `media` or uploaded IDs in `media_ids`. Never send both. For DMs, upload first. Pass 1 `media_id` in `media_ids`. Store `message_id` and leave `reply_to_message_id` unset.

> [card] Monitor and webhook setup
>
> Return monitor `id`, `username`, `xUserId`, `eventTypes`, `isActive`, and `nextBillingAt`. Return webhook `id`, `url`, `eventTypes`, and one-time `secret`. Map production `deliveryId` to `delivery_id` for receiver retry deduplication. Map `streamEventId` to `stream_event_id` for event deduplication across webhook changes.

> [card] REST hook trigger
>
> Return `id`, `delivery_id`, and `stream_event_id`. Use delivery IDs for endpoint retries. Use event IDs across webhook changes.

> [card] Stored event replay
>
> Call `GET /events` with `cursor` when a Zap needs replay. Map event and monitor IDs first. Then map `occurredAt`, `hasMore`, and `nextCursor` to snake\_case fields.

> [card] Receiver acceptance
>
> Zapier controls responses from its generated hook URL. Use a relay when you
> need custom acceptance or replay rules. Keep signing values, raw bodies, and
> raw signatures outside Zap history. Keep full headers outside business apps
> too.

> [card] Extraction polling trigger
>
> Return completed job `id`, `toolType`, and `status`. Store normalized IDs, status, `has_more`, and `next_cursor`. Then fetch detail rows.

Map friendly region names to WOEID values. Submit the selected value to Xquik.

This example shows a search action.

```javascript theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/bash.json","/languages/csharp.json","/languages/go.json","/languages/java.json","/languages/javascript.json","/languages/kotlin.json","/languages/php.json","/languages/python.json","/languages/ruby.json","/languages/typescript.json"]}}
async function performSearchTweets(z, bundle) {
  const response = await xquikRequest(z, {
    method: "GET",
    url: `${BASE_URL}/x/tweets/search`,
    params: {
      q: bundle.inputData.q,
      queryType: bundle.inputData.queryType || "Latest",
      limit: bundle.inputData.limit || 25,
      cursor: bundle.inputData.cursor || undefined,
    },
  });

  const page = response.data;

  return (page.tweets || []).map((tweet) => ({
    id: tweet.id,
    tweet_id: tweet.id,
    text: tweet.text,
    author_username: tweet.author?.username || null,
    created_at: tweet.createdAt || null,
    url: tweet.url || null,
    has_next_page: Boolean(page.has_next_page),
    next_cursor: page.next_cursor || null,
  }));
}

module.exports = {
  key: "search_tweets",
  noun: "Tweet",
  display: {
    label: "Search Tweets",
    description: "Find recent tweets that match a search query.",
  },
  operation: {
    inputFields: [
      { key: "q", label: "Query", required: true, type: "string" },
      {
        key: "queryType",
        label: "Order",
        required: false,
        choices: ["Latest", "Top"],
      },
      { key: "limit", label: "Limit", required: false, type: "integer" },
      { key: "cursor", label: "Cursor", required: false, type: "string" },
    ],
    perform: performSearchTweets,
    sample: {
      id: "1840000000000000000",
      tweet_id: "1840000000000000000",
      text: "Example tweet text",
      author_username: "example_user",
      created_at: "2026-08-02T12:00:00Z",
      url: "https://x.com/example_user/status/1840000000000000000",
      has_next_page: true,
      next_cursor: "DAACCgACExample",
    },
    outputFields: [
      { key: "id", label: "Tweet ID" },
      { key: "tweet_id", label: "Tweet ID for Storage" },
      { key: "text", label: "Text" },
      { key: "author_username", label: "Author Username" },
      { key: "created_at", label: "Created At" },
      { key: "url", label: "URL" },
      { key: "has_next_page", label: "Has Next Page", type: "boolean" },
      { key: "next_cursor", label: "Next Cursor" },
    ],
  },
};
```

## Next steps

* [Zapier Twitter integration](https://docs.xquik.com/guides/zapier.md)
* [Zapier error handling](https://docs.xquik.com/guides/zapier-error-handling.md)
* [Monitor event REST hook](https://docs.xquik.com/guides/zapier-monitor-rest-hook.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.