{"skill":{"slug":"skill-10","displayName":"Clawra Selfie","summary":"Edit Clawra's reference image with Grok Imagine (xAI Aurora) and send selfies to messaging channels via OpenClaw","description":"---\nname: clawra-selfie\ndescription: Edit Clawra's reference image with Grok Imagine (xAI Aurora) and send selfies to messaging channels via OpenClaw\nallowed-tools: Bash(npm:*) Bash(npx:*) Bash(openclaw:*) Bash(curl:*) Read Write WebFetch\n---\n\n# Clawra Selfie\n\nEdit a fixed reference image using xAI's Grok Imagine model and distribute it across messaging platforms (WhatsApp, Telegram, Discord, Slack, etc.) via OpenClaw.\n\n## Reference Image\n\nThe skill uses a fixed reference image hosted on jsDelivr CDN:\n\n```\nhttps://cdn.jsdelivr.net/gh/SumeLabs/clawra@main/assets/clawra.png\n```\n\n## When to Use\n\n- User says \"send a pic\", \"send me a pic\", \"send a photo\", \"send a selfie\"\n- User says \"send a pic of you...\", \"send a selfie of you...\"\n- User asks \"what are you doing?\", \"how are you doing?\", \"where are you?\"\n- User describes a context: \"send a pic wearing...\", \"send a pic at...\"\n- User wants Clawra to appear in a specific outfit, location, or situation\n\n## Quick Reference\n\n### Required Environment Variables\n\n```bash\nFAL_KEY=your_fal_api_key          # Get from https://fal.ai/dashboard/keys\nOPENCLAW_GATEWAY_TOKEN=your_token  # From: openclaw doctor --generate-gateway-token\n```\n\n### Workflow\n\n1. **Get user prompt** for how to edit the image\n2. **Edit image** via fal.ai Grok Imagine Edit API with fixed reference\n3. **Extract image URL** from response\n4. **Send to OpenClaw** with target channel(s)\n\n## Step-by-Step Instructions\n\n### Step 1: Collect User Input\n\nAsk the user for:\n- **User context**: What should the person in the image be doing/wearing/where?\n- **Mode** (optional): `mirror` or `direct` selfie style\n- **Target channel(s)**: Where should it be sent? (e.g., `#general`, `@username`, channel ID)\n- **Platform** (optional): Which platform? (discord, telegram, whatsapp, slack)\n\n## Prompt Modes\n\n### Mode 1: Mirror Selfie (default)\nBest for: outfit showcases, full-body shots, fashion content\n\n```\nmake a pic of this person, but [user's context]. the person is taking a mirror selfie\n```\n\n**Example**: \"wearing a santa hat\" →\n```\nmake a pic of this person, but wearing a santa hat. the person is taking a mirror selfie\n```\n\n### Mode 2: Direct Selfie\nBest for: close-up portraits, location shots, emotional expressions\n\n```\na close-up selfie taken by herself at [user's context], direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arm's length, face fully visible\n```\n\n**Example**: \"a cozy cafe with warm lighting\" →\n```\na close-up selfie taken by herself at a cozy cafe with warm lighting, direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arm's length, face fully visible\n```\n\n### Mode Selection Logic\n\n| Keywords in Request | Auto-Select Mode |\n|---------------------|------------------|\n| outfit, wearing, clothes, dress, suit, fashion | `mirror` |\n| cafe, restaurant, beach, park, city, location | `direct` |\n| close-up, portrait, face, eyes, smile | `direct` |\n| full-body, mirror, reflection | `mirror` |\n\n### Step 2: Edit Image with Grok Imagine\n\nUse the fal.ai API to edit the reference image:\n\n```bash\nREFERENCE_IMAGE=\"https://cdn.jsdelivr.net/gh/SumeLabs/clawra@main/assets/clawra.png\"\n\n# Mode 1: Mirror Selfie\nPROMPT=\"make a pic of this person, but <USER_CONTEXT>. the person is taking a mirror selfie\"\n\n# Mode 2: Direct Selfie\nPROMPT=\"a close-up selfie taken by herself at <USER_CONTEXT>, direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arm's length, face fully visible\"\n\n# Build JSON payload with jq (handles escaping properly)\nJSON_PAYLOAD=$(jq -n \\\n  --arg image_url \"$REFERENCE_IMAGE\" \\\n  --arg prompt \"$PROMPT\" \\\n  '{image_url: $image_url, prompt: $prompt, num_images: 1, output_format: \"jpeg\"}')\n\ncurl -X POST \"https://fal.run/xai/grok-imagine-image/edit\" \\\n  -H \"Authorization: Key $FAL_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"$JSON_PAYLOAD\"\n```\n\n**Response Format:**\n```json\n{\n  \"images\": [\n    {\n      \"url\": \"https://v3b.fal.media/files/...\",\n      \"content_type\": \"image/jpeg\",\n      \"width\": 1024,\n      \"height\": 1024\n    }\n  ],\n  \"revised_prompt\": \"Enhanced prompt text...\"\n}\n```\n\n### Step 3: Send Image via OpenClaw\n\nUse the OpenClaw messaging API to send the edited image:\n\n```bash\nopenclaw message send \\\n  --action send \\\n  --channel \"<TARGET_CHANNEL>\" \\\n  --message \"<CAPTION_TEXT>\" \\\n  --media \"<IMAGE_URL>\"\n```\n\n**Alternative: Direct API call**\n```bash\ncurl -X POST \"http://localhost:18789/message\" \\\n  -H \"Authorization: Bearer $OPENCLAW_GATEWAY_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"action\": \"send\",\n    \"channel\": \"<TARGET_CHANNEL>\",\n    \"message\": \"<CAPTION_TEXT>\",\n    \"media\": \"<IMAGE_URL>\"\n  }'\n```\n\n## Complete Script Example\n\n```bash\n#!/bin/bash\n# grok-imagine-edit-send.sh\n\n# Check required environment variables\nif [ -z \"$FAL_KEY\" ]; then\n  echo \"Error: FAL_KEY environment variable not set\"\n  exit 1\nfi\n\n# Fixed reference image\nREFERENCE_IMAGE=\"https://cdn.jsdelivr.net/gh/SumeLabs/clawra@main/assets/clawra.png\"\n\nUSER_CONTEXT=\"$1\"\nCHANNEL=\"$2\"\nMODE=\"${3:-auto}\"  # mirror, direct, or auto\nCAPTION=\"${4:-Edited with Grok Imagine}\"\n\nif [ -z \"$USER_CONTEXT\" ] || [ -z \"$CHANNEL\" ]; then\n  echo \"Usage: $0 <user_context> <channel> [mode] [caption]\"\n  echo \"Modes: mirror, direct, auto (default)\"\n  echo \"Example: $0 'wearing a cowboy hat' '#general' mirror\"\n  echo \"Example: $0 'a cozy cafe' '#general' direct\"\n  exit 1\nfi\n\n# Auto-detect mode based on keywords\nif [ \"$MODE\" == \"auto\" ]; then\n  if echo \"$USER_CONTEXT\" | grep -qiE \"outfit|wearing|clothes|dress|suit|fashion|full-body|mirror\"; then\n    MODE=\"mirror\"\n  elif echo \"$USER_CONTEXT\" | grep -qiE \"cafe|restaurant|beach|park|city|close-up|portrait|face|eyes|smile\"; then\n    MODE=\"direct\"\n  else\n    MODE=\"mirror\"  # default\n  fi\n  echo \"Auto-detected mode: $MODE\"\nfi\n\n# Construct the prompt based on mode\nif [ \"$MODE\" == \"direct\" ]; then\n  EDIT_PROMPT=\"a close-up selfie taken by herself at $USER_CONTEXT, direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arm's length, face fully visible\"\nelse\n  EDIT_PROMPT=\"make a pic of this person, but $USER_CONTEXT. the person is taking a mirror selfie\"\nfi\n\necho \"Mode: $MODE\"\necho \"Editing reference image with prompt: $EDIT_PROMPT\"\n\n# Edit image (using jq for proper JSON escaping)\nJSON_PAYLOAD=$(jq -n \\\n  --arg image_url \"$REFERENCE_IMAGE\" \\\n  --arg prompt \"$EDIT_PROMPT\" \\\n  '{image_url: $image_url, prompt: $prompt, num_images: 1, output_format: \"jpeg\"}')\n\nRESPONSE=$(curl -s -X POST \"https://fal.run/xai/grok-imagine-image/edit\" \\\n  -H \"Authorization: Key $FAL_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"$JSON_PAYLOAD\")\n\n# Extract image URL\nIMAGE_URL=$(echo \"$RESPONSE\" | jq -r '.images[0].url')\n\nif [ \"$IMAGE_URL\" == \"null\" ] || [ -z \"$IMAGE_URL\" ]; then\n  echo \"Error: Failed to edit image\"\n  echo \"Response: $RESPONSE\"\n  exit 1\nfi\n\necho \"Image edited: $IMAGE_URL\"\necho \"Sending to channel: $CHANNEL\"\n\n# Send via OpenClaw\nopenclaw message send \\\n  --action send \\\n  --channel \"$CHANNEL\" \\\n  --message \"$CAPTION\" \\\n  --media \"$IMAGE_URL\"\n\necho \"Done!\"\n```\n\n## Node.js/TypeScript Implementation\n\n```typescript\nimport { fal } from \"@fal-ai/client\";\nimport { exec } from \"child_process\";\nimport { promisify } from \"util\";\n\nconst execAsync = promisify(exec);\n\nconst REFERENCE_IMAGE = \"https://cdn.jsdelivr.net/gh/SumeLabs/clawra@main/assets/clawra.png\";\n\ninterface GrokImagineResult {\n  images: Array<{\n    url: string;\n    content_type: string;\n    width: number;\n    height: number;\n  }>;\n  revised_prompt?: string;\n}\n\ntype SelfieMode = \"mirror\" | \"direct\" | \"auto\";\n\nfunction detectMode(userContext: string): \"mirror\" | \"direct\" {\n  const mirrorKeywords = /outfit|wearing|clothes|dress|suit|fashion|full-body|mirror/i;\n  const directKeywords = /cafe|restaurant|beach|park|city|close-up|portrait|face|eyes|smile/i;\n\n  if (directKeywords.test(userContext)) return \"direct\";\n  if (mirrorKeywords.test(userContext)) return \"mirror\";\n  return \"mirror\"; // default\n}\n\nfunction buildPrompt(userContext: string, mode: \"mirror\" | \"direct\"): string {\n  if (mode === \"direct\") {\n    return `a close-up selfie taken by herself at ${userContext}, direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arm's length, face fully visible`;\n  }\n  return `make a pic of this person, but ${userContext}. the person is taking a mirror selfie`;\n}\n\nasync function editAndSend(\n  userContext: string,\n  channel: string,\n  mode: SelfieMode = \"auto\",\n  caption?: string\n): Promise<string> {\n  // Configure fal.ai client\n  fal.config({\n    credentials: process.env.FAL_KEY!\n  });\n\n  // Determine mode\n  const actualMode = mode === \"auto\" ? detectMode(userContext) : mode;\n  console.log(`Mode: ${actualMode}`);\n\n  // Construct the prompt\n  const editPrompt = buildPrompt(userContext, actualMode);\n\n  // Edit reference image with Grok Imagine\n  console.log(`Editing image: \"${editPrompt}\"`);\n\n  const result = await fal.subscribe(\"xai/grok-imagine-image/edit\", {\n    input: {\n      image_url: REFERENCE_IMAGE,\n      prompt: editPrompt,\n      num_images: 1,\n      output_format: \"jpeg\"\n    }\n  }) as { data: GrokImagineResult };\n\n  const imageUrl = result.data.images[0].url;\n  console.log(`Edited image URL: ${imageUrl}`);\n\n  // Send via OpenClaw\n  const messageCaption = caption || `Edited with Grok Imagine`;\n\n  await execAsync(\n    `openclaw message send --action send --channel \"${channel}\" --message \"${messageCaption}\" --media \"${imageUrl}\"`\n  );\n\n  console.log(`Sent to ${channel}`);\n  return imageUrl;\n}\n\n// Usage Examples\n\n// Mirror mode (auto-detected from \"wearing\")\neditAndSend(\n  \"wearing a cyberpunk outfit with neon lights\",\n  \"#art-gallery\",\n  \"auto\",\n  \"Check out this AI-edited art!\"\n);\n// → Mode: mirror\n// → Prompt: \"make a pic of this person, but wearing a cyberpunk outfit with neon lights. the person is taking a mirror selfie\"\n\n// Direct mode (auto-detected from \"cafe\")\neditAndSend(\n  \"a cozy cafe with warm lighting\",\n  \"#photography\",\n  \"auto\"\n);\n// → Mode: direct\n// → Prompt: \"a close-up selfie taken by herself at a cozy cafe with warm lighting, direct eye contact...\"\n\n// Explicit mode override\neditAndSend(\"casual street style\", \"#fashion\", \"direct\");\n```\n\n## Supported Platforms\n\nOpenClaw supports sending to:\n\n| Platform | Channel Format | Example |\n|----------|----------------|---------|\n| Discord | `#channel-name` or channel ID | `#general`, `123456789` |\n| Telegram | `@username` or chat ID | `@mychannel`, `-100123456` |\n| WhatsApp | Phone number (JID format) | `1234567890@s.whatsapp.net` |\n| Slack | `#channel-name` | `#random` |\n| Signal | Phone number | `+1234567890` |\n| MS Teams | Channel reference | (varies) |\n\n## Grok Imagine Edit Parameters\n\n| Parameter | Type | Default | Description |\n|-----------|------|---------|-------------|\n| `image_url` | string | required | URL of image to edit (fixed in this skill) |\n| `prompt` | string | required | Edit instruction |\n| `num_images` | 1-4 | 1 | Number of images to generate |\n| `output_format` | enum | \"jpeg\" | jpeg, png, webp |\n\n## Setup Requirements\n\n### 1. Install fal.ai client (for Node.js usage)\n```bash\nnpm install @fal-ai/client\n```\n\n### 2. Install OpenClaw CLI\n```bash\nnpm install -g openclaw\n```\n\n### 3. Configure OpenClaw Gateway\n```bash\nopenclaw config set gateway.mode=local\nopenclaw doctor --generate-gateway-token\n```\n\n### 4. Start OpenClaw Gateway\n```bash\nopenclaw gateway start\n```\n\n## Error Handling\n\n- **FAL_KEY missing**: Ensure the API key is set in environment\n- **Image edit failed**: Check prompt content and API quota\n- **OpenClaw send failed**: Verify gateway is running and channel exists\n- **Rate limits**: fal.ai has rate limits; implement retry logic if needed\n\n## Tips\n\n1. **Mirror mode context examples** (outfit focus):\n   - \"wearing a santa hat\"\n   - \"in a business suit\"\n   - \"wearing a summer dress\"\n   - \"in streetwear fashion\"\n\n2. **Direct mode context examples** (location/portrait focus):\n   - \"a cozy cafe with warm lighting\"\n   - \"a sunny beach at sunset\"\n   - \"a busy city street at night\"\n   - \"a peaceful park in autumn\"\n\n3. **Mode selection**: Let auto-detect work, or explicitly specify for control\n4. **Batch sending**: Edit once, send to multiple channels\n5. **Scheduling**: Combine with OpenClaw scheduler for automated posts\n","tags":{"latest":"0.1.0"},"stats":{"comments":0,"downloads":684,"installsAllTime":1,"installsCurrent":1,"stars":0,"versions":1},"createdAt":1772715791178,"updatedAt":1778995585949},"latestVersion":{"version":"0.1.0","createdAt":1772715791178,"changelog":"Clawra Selfie skill initial release.\n\n- Enables editing of Clawra's reference image using Grok Imagine (xAI Aurora) based on user-specified context.\n- Automatically detects selfie mode (\"mirror\" or \"direct\") from user input.\n- Sends generated selfies to various messaging channels (WhatsApp, Telegram, Discord, Slack, etc.) via OpenClaw.\n- Provides Bash and Node.js/TypeScript example scripts for integration and automation.\n- Requires FAL API key and OpenClaw Gateway token to function.","license":null},"metadata":null,"owner":{"handle":"wangzhi8145","userId":"s174jnxmxx62qgvjgsj715bmj5885jr5","displayName":"wangzhi8145","image":"https://avatars.githubusercontent.com/u/10069598?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1780089762827}}