From bf2b07643215590637f66927bad813816a919a12 Mon Sep 17 00:00:00 2001 From: kriptoburak Date: Thu, 18 Jun 2026 04:09:31 +0300 Subject: [PATCH 1/3] Add TweetClaw flow input recipe --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README.md b/README.md index 0208c4b..5915e86 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,45 @@ output = client.run_flow( print(output) ``` +## Run a Flow with Tweet Data + +Gumloop flow inputs can include lists and nested objects. This example loads a +[TweetClaw](https://github.com/Xquik-dev/tweetclaw) JSON export and passes the +tweet text into a flow for enrichment, routing, or review: + +```python +import json +from pathlib import Path + +from gumloop import GumloopClient + + +def load_tweet_text(path: str) -> list[str]: + records = json.loads(Path(path).read_text(encoding="utf-8")) + tweets = records.get("tweets", records) if isinstance(records, dict) else records + return [ + item["text"] + for item in tweets + if isinstance(item, dict) and isinstance(item.get("text"), str) + ] + + +client = GumloopClient( + api_key="your_api_key", + user_id="your_user_id", +) + +output = client.run_flow( + flow_id="your_flow_id", + inputs={ + "tweets": load_tweet_text("tweetclaw-export.json"), + "source": "TweetClaw", + }, +) + +print(output) +``` + ## Chat with an agent (streaming) ```python From e4fc6457205018eaa4356a2ca9a9c7da6b57408b Mon Sep 17 00:00:00 2001 From: kriptoburak Date: Thu, 18 Jun 2026 04:12:51 +0300 Subject: [PATCH 2/3] Handle dict TweetClaw exports --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5915e86..12a5709 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,14 @@ from gumloop import GumloopClient def load_tweet_text(path: str) -> list[str]: records = json.loads(Path(path).read_text(encoding="utf-8")) - tweets = records.get("tweets", records) if isinstance(records, dict) else records + if isinstance(records, dict): + tweets = records.get("tweets") or records.get("data") or records.get("results") or [records] + else: + tweets = records + + if not isinstance(tweets, list): + return [] + return [ item["text"] for item in tweets From fea53ea8ed5205319f5d30c9db4620a34b8477fe Mon Sep 17 00:00:00 2001 From: kriptoburak Date: Thu, 18 Jun 2026 04:16:16 +0300 Subject: [PATCH 3/3] Respect empty TweetClaw arrays --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 12a5709..fba0e8c 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,14 @@ from gumloop import GumloopClient def load_tweet_text(path: str) -> list[str]: records = json.loads(Path(path).read_text(encoding="utf-8")) if isinstance(records, dict): - tweets = records.get("tweets") or records.get("data") or records.get("results") or [records] + if "tweets" in records: + tweets = records["tweets"] + elif "data" in records: + tweets = records["data"] + elif "results" in records: + tweets = records["results"] + else: + tweets = [records] else: tweets = records