Skip to content

fix(recruiter): make greet actually greet — call real chat/start, support custom first message#29

Open
chengyixu wants to merge 13 commits into
jackwener:mainfrom
chengyixu:fix/greet-actually-sends
Open

fix(recruiter): make greet actually greet — call real chat/start, support custom first message#29
chengyixu wants to merge 13 commits into
jackwener:mainfrom
chengyixu:fix/greet-actually-sends

Conversation

@chengyixu

Copy link
Copy Markdown
Contributor

Problem

boss recruiter greet doesn't actually greet — it only calls view_geek (with broken params: encryptGeekId + encryptJobId returns code=2 未知的非法参数; BOSS wants securityId alone) and prints the candidate name. No chat/start POST is ever made, so no conversation is initiated.

Root cause

The BOSS recruiter web "打招呼" button fires POST /wapi/zpjob/chat/start with a 9-param body:

gid=<encryptGeekId>&suid=&jid=<encryptJobId>&expectId=<num>&lid=<reco-link-id>&greet=<optional message>&from=&securityId=<sid>&customGreetingGuide=-1

With a non-empty greet field, BOSS delivers it as the chat's first message — saves a separate sendReplyMsg round-trip.

Schema discovered by hooking XMLHttpRequest.prototype.send in a logged-in BOSS recruiter session and clicking the real "打招呼" button.

Changes

  • Add BOSS_CHAT_START_URL constant + Referer mapping
  • Add boss_chat_start(encrypt_geek_id, encrypt_job_id, security_id, expect_id?, lid?, greet?) to client
  • Rewire recruiter greet command: required --job + --security-id, optional --expect-id, --lid, -m/--message
  • Fix get_boss_view_geek: accept security_id alone (prefer it), reject the broken encGid+encJid combo via ValueError when securityId missing

Test plan

  • boss recruiter greet --help shows the new flags
  • Live test against an active recruiter account: returned code:0 Success, candidate received chat invitation + custom first message (verified via inbox: "[送达]你好,我是 Wilson...")
  • CLI works against same account that prior `greet` command silently no-op'd on
  • Reviewer to verify the captured POST body shape (customGreetingGuide=-1, empty suid/from/greet) hasn't changed since 2026-05-12

🤖 Generated with Claude Code

chengyixu and others added 13 commits April 2, 2026 15:16
Adds employer-side functionality for BOSS直聘 recruiters:

- `boss recruiter-jobs` — list posted jobs
- `boss recruiter-inbox` — view candidate chat list with last messages
- `boss recruiter-geek <id>` — view detailed candidate profile
- `boss recruiter-chat <friendId>` — view chat history with candidate
- `boss recruiter-labels` — list candidate tags
- `boss recruiter-export` — export candidates to CSV/JSON

All commands support --json/--yaml structured output and follow the
existing CLI patterns (rate limiting, session handling, rich tables).

Closes jackwener#10

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add usage examples, workflow guide, and Chinese docs for the
6 new recruiter commands. Update project structure and badges.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…group

Restructure recruiter commands from 6 flat commands to a proper Click
subcommand group with 12 commands matching issue jackwener#10 spec:

New commands:
- `boss recruiter search` — search candidates with city/exp/degree/salary
- `boss recruiter recommend` — recommended candidates (greetRecSortList)
- `boss recruiter greet` — initiate conversation with candidate
- `boss recruiter batch-greet` — batch greet with --dry-run support
- `boss recruiter reply` — send message to candidate (with confirmation)
- `boss recruiter resume` — full resume view (work, education, projects)

Preserved from v1:
- `boss recruiter jobs/inbox/geek/chat/labels/export`

New BossClient methods: search_geeks, get_boss_recommend_geeks,
get_boss_view_geek, boss_send_message. Resume auto-fetches securityId
from friend list when not provided.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add -p/--page to recommend and inbox commands for scrolling
- Add --job filter to recommend for switching between 岗位
- Add resume-download command: exports resume as Markdown file
- Add job-close/job-reopen commands for job lifecycle management
- Add pagination hints and job switching hints to command output
- get_boss_friend_list now accepts page parameter

15 total commands under `boss recruiter` subgroup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ume download

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…e-interview, mark-unsuitable

5 new commands matching BOSS直聘 recruiter chat page actions:
- `boss recruiter request-resume` — 求简历
- `boss recruiter exchange-phone` — 换电话
- `boss recruiter exchange-wechat` — 换微信
- `boss recruiter invite-interview` — 约面试
- `boss recruiter mark-unsuitable` — 不合适

All require --yes or confirmation prompt. Include __zp_stoken__
hint when anti-bot protection blocks the action.

20 total commands under `boss recruiter`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ected endpoints

- Add X-Requested-With and zp_token (from bst cookie) to all requests
- Handle code 121/122 (warlock anti-bot) with clear error message
- Protected actions (exchange, interview, mark) now explain the limitation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The recommend (greetRecSortList) and inbox (filterByLabel) APIs return
ALL results in a single call — the page parameter is ignored server-side.
Replace -p/--page with -n/--limit for client-side display limiting.
Update hints to show label filtering and job switching instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… 404 gracefully

- boss_interview_invite now sends JSON body (not form-encoded) to match API
- boss_exchange_request includes gid=uid param required by the API
- _request handles 404 responses that contain JSON (anti-bot responses)
- _post supports json_body=True parameter for JSON POST requests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ing pagination

`recruiter recommend` previously called `/wapi/zprelation/friend/greetRecSortList`
("greet rec sort list"), which re-sorts the recruiter's already-greeted candidates
and ignores the `page` param. Result: users saw only ~10 candidates and `-p N`
returned the same list reshuffled.

The actual "推荐牛人" feed on the BOSS recruiter web page calls
`/wapi/zpjob/rec/geek/list` (XHR fired on infinite scroll), which:
  - returns 15 candidates per page
  - paginates via `page=N`
  - includes `hasMore` for the end-of-feed signal
  - requires a `Referer: /web/frame/recommend/` header

Changes:
  - Add `BOSS_REC_GEEK_LIST_URL` constant + Referer mapping
  - Repoint `get_boss_recommend_geeks` at the real endpoint with the full
    filter param set the page sends (age/school/activation/etc., zeroed)
  - `--job` is now required (the endpoint is job-scoped)
  - Render the richer `geekCard` payload: name / age / exp / degree / city /
    salary / activeTime / encryptGeekId, plus next-page hint when hasMore
  - Update README examples

Smoke-tested against an active recruiter account: page 1 returned 15
distinct candidates with `hasMore: true`; `-p 2`, `-p 3`, ... return
fresh batches as the browser does on scroll.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…upport custom first message

`recruiter greet` previously did NOT send a greeting — it just called
`view_geek` (with broken params: `encryptGeekId + encryptJobId` returns
`code=2 未知的非法参数`; BOSS prefers `securityId` alone) and printed the
candidate name. No `chat/start` POST. No actual conversation initiation.

Now `greet` calls the real `/wapi/zpjob/chat/start` (the same endpoint the
web UI fires when the recruiter clicks "打招呼"). With `-m/--message`,
the message is delivered as the chat's first line — saves the extra
`sendReplyMsg` round-trip.

Also fix `get_boss_view_geek` to accept `security_id` alone (the form
BOSS actually wants).

Changes:
- Add `BOSS_CHAT_START_URL` constant + Referer mapping
- Add `boss_chat_start(encrypt_geek_id, encrypt_job_id, security_id, expect_id?, lid?, greet?)` to client
- Rewire `recruiter greet` command: required `--job` + `--security-id`,
  optional `--expect-id`, `--lid`, `-m/--message`
- Fix `get_boss_view_geek`: accept `security_id` alone (prefer it),
  reject the broken `encGid+encJid` combo via ValueError when securityId missing

Schema discovered by hooking XMLHttpRequest in a logged-in BOSS recruiter
session and clicking the real "打招呼" button — captured the full POST
body (gid, suid, jid, expectId, lid, greet, from, securityId,
customGreetingGuide). All 9 params required; tested against live account.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant