Outcome
Set or clear (null) a contact's phone. The number is normalised to E.164: spaces, dots, dashes and brackets are removed and a leading 00 becomes +; it must then be + followed by 8 to 15 digits with no leading zero (422 invalid_phone otherwise; there is no default country). Changing or clearing the phone means the previous WhatsApp opt-in no longer applies. Archived contacts return 409 state_conflict. Nothing is sent.
Before you start
- Verify the intended environment, signed-in credential, authorized organization and the action permission workspace:write.
- Discover and select an authorized canonical Engage workspace. Pass resourceType=workspace and resourceId separately from action input.
- Review the exact effects and obtain approval before CLI --confirm or MCP confirm:true. A local capture does not authorize a live mutation.
Discover the target
topolo whoami --json
topolo actions get app_topolo_engage.contacts.phone.set --json
topolo workspaces list topolo-engage --json
Set ENGAGE_WORKSPACE_ID to the identifier of the selected authorized workspace.
Input contract
| Field | Required | Declared constraints |
|---|---|---|
id | Yes | {"type":"string","minLength":1,"maxLength":128} |
phone | Yes | {"anyOf":[{"type":"string","minLength":5,"maxLength":40},{"type":"null"}]} |
Validate, plan and execute
Build payload.json from the current schema and discovered identifiers. The action description above defines its behavior, limits, side effects and declared errors.
: "${ENGAGE_WORKSPACE_ID:?Set ENGAGE_WORKSPACE_ID to your selected workspace identifier}"
topolo actions validate app_topolo_engage.contacts.phone.set --data @payload.json --json
topolo actions plan app_topolo_engage.contacts.phone.set --resource-type workspace --resource-id "$ENGAGE_WORKSPACE_ID" --data @payload.json --confirm --json
Review the plan and approve its exact effects before executing the unchanged request.
: "${ENGAGE_WORKSPACE_ID:?Set ENGAGE_WORKSPACE_ID to your selected workspace identifier}"
topolo actions call app_topolo_engage.contacts.phone.set --resource-type workspace --resource-id "$ENGAGE_WORKSPACE_ID" --data @payload.json --confirm --json
For MCP, use topolo_get_action, topolo_validate_action, topolo_plan_action and topolo_call_action. Pass resource context separately where required; confirm:true is required for mutations.
Captured successful requests and responses
Captured HTTP 200 · the runner on a WhatsApp template step > holds a reservation that expired under this key and retries under a fresh one
Action input
{
"id": "contact_1",
"phone": "+44 7700 900123"
}
Actual local response
{
"whatsapp": {
"contactId": "contact_1",
"phone": "+447700900123",
"optIn": {
"status": "none",
"source": null,
"evidence": null,
"recordedAt": null,
"recordedBy": null
}
}
}
Source test: the runner on a WhatsApp template step > holds a reservation that expired under this key and retries under a fresh one. Actual route handlers with SQLite repositories; synthetic identity/workspace grants and provider ports.
Captured HTTP 200 · contact phone and WhatsApp opt-in > normalises and stores the phone with its salted hash, refusing non-E.164 numbers
Action input
{
"id": "contact_1",
"phone": "0044 7700 900123"
}
Actual local response
{
"whatsapp": {
"contactId": "contact_1",
"phone": "+447700900123",
"optIn": {
"status": "none",
"source": null,
"evidence": null,
"recordedAt": null,
"recordedBy": null
}
}
}
Source test: contact phone and WhatsApp opt-in > normalises and stores the phone with its salted hash, refusing non-E.164 numbers. Actual route handlers with SQLite repositories; synthetic identity/workspace grants and provider ports.
Captured HTTP 200 · contact phone and WhatsApp opt-in > normalises and stores the phone with its salted hash, refusing non-E.164 numbers
Action input
{
"id": "contact_1",
"phone": null
}
Actual local response
{
"whatsapp": {
"contactId": "contact_1",
"phone": null,
"optIn": {
"status": "none",
"source": null,
"evidence": null,
"recordedAt": null,
"recordedBy": null
}
}
}
Source test: contact phone and WhatsApp opt-in > normalises and stores the phone with its salted hash, refusing non-E.164 numbers. Actual route handlers with SQLite repositories; synthetic identity/workspace grants and provider ports.
Captured HTTP 200 · contact phone and WhatsApp opt-in > records and revokes an opt-in as consent evidence for the current phone
Action input
{
"id": "contact_1",
"phone": "+1 415 555 0100"
}
Actual local response
{
"whatsapp": {
"contactId": "contact_1",
"phone": "+14155550100",
"optIn": {
"status": "none",
"source": null,
"evidence": null,
"recordedAt": null,
"recordedBy": null
}
}
}
Source test: contact phone and WhatsApp opt-in > records and revokes an opt-in as consent evidence for the current phone. Actual route handlers with SQLite repositories; synthetic identity/workspace grants and provider ports.
Captured HTTP 200 · contact phone and WhatsApp opt-in > erasure deletes the phone and consent evidence; the export includes them
Action input
{
"id": "contact_1",
"phone": "+447700900123"
}
Actual local response
{
"whatsapp": {
"contactId": "contact_1",
"phone": "+447700900123",
"optIn": {
"status": "none",
"source": null,
"evidence": null,
"recordedAt": null,
"recordedBy": null
}
}
}
Source test: contact phone and WhatsApp opt-in > erasure deletes the phone and consent evidence; the export includes them. Actual route handlers with SQLite repositories; synthetic identity/workspace grants and provider ports.
Effects and response meaning
- Set or clear (null) a contact's phone. The number is normalised to E.164: spaces, dots, dashes and brackets are removed and a leading 00 becomes +; it must then be + followed by 8 to 15 digits with no leading zero (422 invalid_phone otherwise; there is no default country). Changing or clearing the phone means the previous WhatsApp opt-in no longer applies. Archived contacts return 409 state_conflict. Nothing is sent.
Verify the outcome
- Check the response against the declared output schema and the requested operation. For mutations, use the action-specific read described in the action description before any dependent operation.
Recover
For an uncertain result, inspect current retained state with a read action before retrying. Do not replay a mutation unless its contract explicitly guarantees idempotency.
Refused requests
Captured HTTP 422 · contact phone and WhatsApp opt-in > normalises and stores the phone with its salted hash, refusing non-E.164 numbers
Action input
{
"id": "contact_1",
"phone": "07700 900123"
}
Actual local response
{
"error": {
"code": "invalid_phone",
"message": "Enter the phone in international format: + and the country code, then the number."
}
}
Source test: contact phone and WhatsApp opt-in > normalises and stores the phone with its salted hash, refusing non-E.164 numbers. Actual route handlers with SQLite repositories; synthetic identity/workspace grants and provider ports.
Captured HTTP 422 · contact phone and WhatsApp opt-in > normalises and stores the phone with its salted hash, refusing non-E.164 numbers
Refused input; do not execute
{
"phone": "1",
"id": "contact_1"
}
Actual local response
{
"error": {
"code": "invalid_action_input",
"message": "Input for contacts.phone.set is invalid.",
"details": [
{
"origin": "string",
"code": "too_small",
"minimum": 5,
"inclusive": true,
"path": [
"phone"
],
"message": "Too small: expected string to have >=5 characters"
}
]
}
}
Source test: contact phone and WhatsApp opt-in > normalises and stores the phone with its salted hash, refusing non-E.164 numbers. Actual route handlers with SQLite repositories; synthetic identity/workspace grants and provider ports.
Captured HTTP 403 · contact phone and WhatsApp opt-in > refuses readers, other organizations, unknown and archived contacts
Action input
{
"id": "contact_1",
"phone": "+447700900123"
}
Actual local response
{
"error": {
"code": "permission_denied",
"message": "The credential lacks workspace:write.",
"details": {
"requiredPermission": "workspace:write"
}
}
}
Source test: contact phone and WhatsApp opt-in > refuses readers, other organizations, unknown and archived contacts. Actual route handlers with SQLite repositories; synthetic identity/workspace grants and provider ports.
Captured HTTP 409 · contact phone and WhatsApp opt-in > refuses readers, other organizations, unknown and archived contacts
Action input
{
"id": "contact_1",
"phone": "+447700900123"
}
Actual local response
{
"error": {
"code": "state_conflict",
"message": "Archived contacts cannot be changed."
}
}
Source test: contact phone and WhatsApp opt-in > refuses readers, other organizations, unknown and archived contacts. Actual route handlers with SQLite repositories; synthetic identity/workspace grants and provider ports.
Error recovery
- HTTP 422
invalid_phone: Read the refusal details and current action contract, correct the stated cause, then validate and plan again. Do not retry unchanged or infer success. - HTTP 422
invalid_action_input: Correct the request against the current action input schema, then validate it again before planning. - HTTP 403
permission_denied: Stop and inspect the current credential and selected resource. It needs workspace:write; do not broaden access or switch organization automatically. - HTTP 409
state_conflict: Read the current retained state and reconcile the requested transition before retrying. Do not blindly replay a non-idempotent mutation.
Related actions
- List prospect contacts
- Create prospect contact
- Resolve prospect contact id
- Get prospect contact
- Update prospect contact
- Archive prospect contact
- Qualify contacts with AI
- Get contact qualification
- Get contact WhatsApp state
- Record WhatsApp opt-in
- Revoke WhatsApp opt-in
- Import contacts from TopoloCRM
- Export contact data
- Erase contact data
Evidence and limits
-
/api/contacts/{id}/phone -
Actual route handlers with SQLite repositories; synthetic identity/workspace grants and provider ports.
-
Widget/bootstrap use actual app handler but mocked worker runtime and app identity.
-
No gateway execution, live permissions, external delivery or deployed proof.
These are local route captures with synthetic identity and simulated dependencies. They do not prove live authorization, gateway execution, production state, or external delivery.