Update a WhatsApp Protocol Profile: Handle HTTP 207 Results
To change a connected WhatsApp Protocol account’s nickname or avatar, use PATCH /v1/accounts/{account_id}/profile. The account must be online, and nickname changes require the primary device session. Send display_name, avatar_url, or both. If the response is HTTP 207, inspect each field separately: one change can be confirmed while the other is rejected. Do not turn every successful HTTP status into a single “Profile saved” badge.
Key takeaways
- This operation is documented for
whatsapp-protocol, not a universal account editor. - Changing the native profile differs from renaming an internal account label or a customer contact.
- Preserve each returned field result, including the distinction between
sentandconfirmed. - After a timeout or an unknown write outcome, verify the profile in WhatsApp before retrying.
First identify the profile you intend to change
The Update account profile reference defines the write operation. Its target is the connected account’s own nickname or avatar.
| Intended action | Correct boundary |
|---|---|
| Change the connected WhatsApp Protocol nickname or avatar | Account profile PATCH |
| Rename the account’s internal operational label | Account configuration, not this profile operation |
| Give a customer a private custom name | A separate contact-note operation |
| Display an incoming WhatsApp account-name change | A profile-event projection, not a write command |
The contact-note guide addresses customer names. The account-name synchronization guide addresses incoming profile observations for whatsapp. Neither is a replacement for this whatsapp-protocol write contract.
Before enabling Save, confirm the selected account’s provider and current connection state. Keep the workspace API key on the backend. For a nickname change, verify that the session is the primary device session; being online alone does not establish that prerequisite. The WhatsApp Protocol authorization guide describes this separate provider and its session-import setup.
Submit only the approved changes
Build the request from fields the operator actually edited. Do not submit the entire cached profile: a stale name can accompany an intended avatar-only change.
This illustrative JSON changes both fields. The image URL is an example, not a hosted test asset; use an accessible image you control and are authorized to publish.
{
"display_name": "Example Support",
"avatar_url": "https://media.example.com/account-avatar.png"
}
For a nickname-only edit, omit avatar_url. For an avatar-only edit, omit display_name. Do not invent an avatar-removal convention using null or an empty string; this guide covers setting the documented values.
The following backend JavaScript makes one attempt and preserves the response for field-level interpretation. The input checks are local safeguards, not a complete reproduction of server validation. accountId and changes are application arguments, not new API fields.
async function updateProfile({ apiKey, accountId, changes }) {
const body = {};
for (const field of ['display_name', 'avatar_url']) {
if (!Object.hasOwn(changes, field)) continue;
if (typeof changes[field] !== 'string' || !changes[field].trim()) {
throw new Error(`Review ${field} before sending`);
}
body[field] = changes[field];
}
if (!Object.keys(body).length) throw new Error('No profile change selected');
const response = await fetch(
`https://api.unifyport.ai/v1/accounts/${encodeURIComponent(accountId)}/profile`,
{
method: 'PATCH',
headers: { 'X-Api-Key': apiKey, 'Content-Type': 'application/json' },
body: JSON.stringify(body)
}
);
const result = await response.json().catch(() => null);
return {
httpStatus: response.status,
requestId: result?.request_id ?? response.headers.get('X-Request-Id'),
result
};
}
A network exception must leave the local attempt uncertain. A response that cannot be parsed also needs investigation. Neither branch should automatically repeat the PATCH.
Interpret HTTP 207 by field
The reference provides these example combinations:
| HTTP response | data.display_name | data.avatar_url | Honest UI interpretation |
|---|---|---|---|
200 | sent | confirmed | Preserve “sent” for the nickname and “confirmed” for the avatar |
207 | rejected | confirmed | Nickname rejected; avatar confirmed |
These are documented examples, not a promise that every response contains both fields or only these combinations. Evaluate the fields you requested. If a result is absent or unfamiliar, keep it unresolved rather than converting it to success.
In JavaScript, Response.ok includes 207 because it is a 2xx response. That is insufficient for an all-or-nothing success notification. Conversely, showing the entire form as failed would conceal the confirmed avatar change and could encourage an unnecessary resend.
For the mixed example, retain the confirmed avatar result. Review the nickname prerequisite and intended value before making a new nickname-only decision. Do not replay both fields simply because the original form contained both.
Reconcile before another write
Recommended application workflow:
- Record the selected account, approved fields, and local attempt time before dispatch.
- Allow only one active profile edit per account in your application. Keep newer drafts separate from the dispatched values.
- Save the HTTP status, returned field outcomes, and available request ID. Restrict access to profile data; do not log API keys or signed image URLs.
- If the result is mixed, show each field independently. If the write times out or is otherwise unknown, check the profile in WhatsApp before retrying.
- Treat another write as a new reviewed decision against the current profile, not a replay of a stale form.
These are application controls, not a documented server-side transaction or version lock. Other clients can still edit the profile. The request-tracing guide explains how to retain diagnostic IDs without mistaking them for idempotency keys.
Do not wait for account.profile.updated as a guaranteed receipt for this operation. The existing event guide documents WhatsApp name events; it does not establish that whatsapp-protocol emits the same confirmation. UnifyPort’s unofficial interface shares API conventions across providers, not identical action and event support.
Acceptance checks and FAQ
Before production, test nickname-only, avatar-only, and combined changes; the documented mixed response; a missing field result; unreadable JSON; and a timeout. Confirm that an avatar-only edit cannot submit an old nickname. These are proposed tests, not reported results.
Does HTTP 207 mean nothing changed?
No. Inspect the field results. The documented example confirms the avatar while rejecting the nickname.
Is sent the same as confirmed?
Do not present them as equivalent. Preserve the returned distinction and verify the native profile when confirmation is needed.
Can I use this on any WhatsApp account provider?
The reference scopes this action to an online WhatsApp Protocol account. Do not infer support for whatsapp, LINE, or Zalo from the shared account route pattern.
Does changing name on account configuration change this nickname?
That is a different operation. This profile endpoint uses display_name for the nickname; keep the internal account label separate.
Next step and sources
Implement the field-level result view against Update account profile before enabling writes in your support application.
First-party references checked on 2026-11-23:
Turn messaging integration into a stable product pipeline.
Start by sending through one API, then bring every inbound message back into your business system with standard events.