Advance Pipedrive deal stage
WP calls this endpoint for two stage-change events.
Event: demo_complete
Fired the first time a candidate views their demo results page.
email is the candidate’s email (no WP user). If the demo_user
post has company and website data, those are included.
No stored Pipedrive IDs are passed (no WP user to look them up from).
Event: trial_complete Fired when a council completes Stripe checkout to convert from trial to paid. Looks up the council_admin user. Stored PD IDs are read from user meta and council post meta and passed as top-level fields.
Authorizations
Secret key appended by WP as ?k=<secret>.
Account-created uses ss_pipedrive_sync_secret.
Quote-sync uses ss_pipedrive_quote_sync_secret.
Body
Primary lookup key for the Pipedrive person record
"john@example.com"
"John"
Pipedrive deal stage to advance to
demo_complete, trial_complete "demo_complete"
"Doe"
Included on demo_complete if available from the demo signup form
"555-1234"
demo_complete: value of company field from the demo_user post.
trial_complete: council name from get_the_title($council_post_id).
"ACME Corp"
demo_complete only: includes wp_website when the demo signup
form had a URL. Omitted on trial_complete.
trial_complete only: stored Pipedrive person ID from
user_meta.pipedrive_contact_id on the council_admin user.
Omitted if not yet stored or on demo_complete.
1234
trial_complete only: stored Pipedrive org ID from
post_meta.pipedrive_company_id on the ss_council post.
4001
trial_complete only: stored Pipedrive deal ID from
post_meta.pipedrive_deal_id on the ss_council post.
5001
Response
Stage change result
true on success. WP uses the same guard as account-created:
checks ok === true AND pd_contact_id before persisting IDs.
true
Pipedrive person ID resolved during stage change
1234
Pipedrive org ID resolved during stage change
4001
Pipedrive deal ID advanced to new stage
5001
Human-readable error when ok is false
"Unauthorized"