闲鱼卖家最痛苦的是什么?是每天几百条消息要回复,是半夜三更还有人问"在吗",是发货要手动填写快递单号。我用OpenClaw搭建了一套完整的自动化系统,让闲鱼运营变得轻松。
做闲鱼半年,我深刻体会到几个痛点:
1. 消息回复量大
2. 夜间无法及时响应
3. 发货流程繁琐
4. 多账号管理困难
基于OpenClaw,我设计了一套完整的自动化方案:
闲鱼App
↓ (消息推送)
OpenClaw核心
├─ 意图识别
├─ 自动回复
├─ 订单管理
└─ 发货触发
↓
快递API (自动下单)
↓
快递发货
选择腾讯云Lighthouse部署,稳定且性价比高:
配置:2核4G,SSD 40GB,月成本85元
OpenClaw提供了xianyu-auto-reply技能,安装即可:
# 通过WebUI安装
openclaw skill install xianyu-auto-reply
# 或者手动安装
git clone https://github.com/openclaw/skills/xianyu-auto-reply
cd xianyu-auto-reply
python setup.py install
配置闲鱼账号Cookie:
# config.yaml
accounts:
- account_id: "account_1"
cookie: "your_cookie_here"
auto_reply: true
auto_ship: true
- account_id: "account_2"
cookie: "your_cookie_2"
auto_reply: true
auto_ship: true
配置闲鱼常见问题的自动回复:
# auto_reply_rules.yaml
rules:
- pattern: "在吗|在不在|在吗在吗"
reply: "在的亲,有什么可以帮您?"
- pattern: "多少钱|价格|怎么卖"
reply: "亲,这个商品{price}元,支持同城自提或快递发货"
- pattern: "能便宜吗|便宜点|打折"
reply: "亲已经是低价了,不过可以给您包邮~"
- pattern: "发货吗|什么时候发货"
reply: "拍下付款后48小时内发货,默认发顺丰"
- pattern: "能看图吗|能拍视频吗"
reply: "可以哦,您想看哪里?我给您拍"
- pattern: "能自提吗|自提"
reply: "可以自提,地址:{address},电话:{phone}"
- pattern: "能开发票吗|发票"
reply: "抱歉,个人卖家无法开具发票"
- pattern: "全新吗|是新的吗"
reply: "这个商品是{condition},{description}"
自动识别购买意图并记录订单:
# order_manager.py
class OrderManager:
def detect_order(self, message):
# 检测购买意向
buy_keywords = ["我要了", "拍下", "下单", "购买"]
for keyword in buy_keywords:
if keyword in message:
return True
return False
def create_order(self, user_id, product_id):
order = {
"order_id": self.generate_order_id(),
"user_id": user_id,
"product_id": product_id,
"status": "pending_payment",
"created_at": datetime.now()
}
self.save_order(order)
return order
def confirm_payment(self, order_id):
# 检测到付款
order = self.get_order(order_id)
if order["status"] == "pending_payment":
order["status"] = "paid"
self.save_order(order)
# 触发自动发货
self.trigger_shipment(order_id)
return True
return False
配置自动发货:
# shipping.yaml
shipping:
provider: "shunfeng" # 顺丰
api_key: "your_api_key"
sender:
name: "张三"
phone: "13800138000"
address: "广东省深圳市南山区xxx"
auto_ship: true
ship_delay: 30 # 收到付款30分钟后发货
自动发货逻辑:
# auto_shipper.py
class AutoShipper:
def ship_order(self, order):
# 从订单获取收货信息
receiver = order["receiver"]
# 调用快递API下单
waybill = self.sf_api.create_order(
sender=self.sender,
receiver={
"name": receiver["name"],
"phone": receiver["phone"],
"address": receiver["address"]
},
goods=order["goods"]
)
# 更新订单状态
order["waybill_no"] = waybill["no"]
order["status"] = "shipped"
order["shipped_at"] = datetime.now()
self.save_order(order)
# 通知买家
self.send_shipping_notification(order)
return waybill
根据时间和库存动态调整价格:
def dynamic_price(product_id):
stock = get_stock(product_id)
hour = datetime.now().hour
base_price = get_base_price(product_id)
# 库存少的时候涨价
if stock < 5:
price = base_price * 1.1
# 晚上调价
elif 20 <= hour <= 23:
price = base_price * 1.05
else:
price = base_price
return price
设置定时任务自动上架商品:
# scheduler.py
from apscheduler.schedulers.background import BackgroundScheduler
scheduler = BackgroundScheduler()
def auto_list_product():
# 每天上午10点自动上架
products = get_delisted_products()
for product in products:
xianyu_api.list_product(product)
scheduler.add_job(auto_list_product, 'cron', hour=10, minute=0)
scheduler.start()
自动监控竞品价格:
def monitor_competitors():
my_products = get_my_products()
for product in my_products:
competitors = xianyu_api.search_similar(product["title"])
for competitor in competitors:
if competitor["price"] < product["price"]:
# 发送降价提醒
send_notification(f"竞品降价了: {competitor['title']} 现价{competitor['price']}")
卖完自动下架:
def auto_delist(product_id):
stock = get_stock(product_id)
if stock <= 0:
xianyu_api.delist_product(product_id)
log(f"商品{product_id}已自动下架")
系统上线1个月后的数据:
效率提升:
业务提升:
成本节约:
1. Cookie有效期
闲鱼Cookie有效期通常7-30天,需要定期更新:
def check_cookie_valid():
response = xianyu_api.test_connection()
if response["status"] == "invalid":
send_alert("Cookie失效,请重新获取")
2. 人工介入
有些情况需要人工处理:
配置智能分流:
def should_handoff(message):
# 大额订单
if "1000" in message or "千" in message:
return True
# 复杂砍价
if "再便宜点" in message and get_conversation_rounds() > 5:
return True
return False
3. 合规性
遵守闲鱼规则,避免违规:
自动给关注的人发新品通知:
def broadcast_new_product():
followers = get_my_followers()
product = get_latest_product()
for follower in followers:
send_message(follower["id"], f"上新了! {product['title']} 只要{product['price']}元")
交易完成后自动评价:
def auto_evaluate(order_id):
order = get_order(order_id)
if order["status"] == "completed":
xianyu_api.evaluate(
order_id=order_id,
content="感谢购买,期待下次合作!",
score=5
)
分析销售数据优化策略:
def analyze_sales():
orders = get_recent_orders(days=30)
# 计算各商品转化率
conversion = {}
for order in orders:
product_id = order["product_id"]
views = get_product_views(product_id)
conversion[product_id] = len(orders) / views
# 找出转化率低的商品
low_conversion = [p for p, rate in conversion.items() if rate < 0.05]
# 优化建议
for product_id in low_conversion:
suggest = generate_suggestion(product_id)
send_notification(f"商品{product_id}转化率低,建议:{suggest}")
再次强调部署步骤:
配置建议:
闲鱼自动化运营不是"黑科技",而是把重复性工作交给AI,让自己专注于选品、拍照、文案等更有价值的工作。
有了OpenClaw,你可以:
从每天忙到半夜,到每天花1小时管理,这才是做闲鱼的正确姿势。
现在就开始自动化你的闲鱼运营吧!