# WhatsApp 131060 on coexistence: the real message may follow

> A 131060 unsupported webhook on a coexistence number can share its wamid with the real message. Why id-only dedupe drops it, and an upsert that keeps it.

Published 2026-11-24. Z-API Omni team.

On a coexistence number, Meta can send an `unsupported` message webhook with error 131060 when a user writes to the business for the first time. Meta says the error "typically resolves within a few seconds". A Chatwoot bug report shows the real message then arriving under the same message `id`, sometimes minutes later and once before the placeholder. If you deduplicate on the `id` alone and the placeholder comes first, the placeholder wins and the real message is dropped.

The fix is to never treat an `unsupported` event as processed. Store it as a placeholder, and let a later event with content under the same `id` replace it. The Postgres upsert below does that in one statement, whichever order the two events arrive in.

How coexistence works is in [use the WhatsApp Business app and the Cloud API on one number](/academy/articles/whatsapp-business-app-coexistence-cloud-api/).

## What Meta documents about 131060

Meta covers 131060 on two pages. The [unsupported messages reference](https://developers.facebook.com/documentation/business-messaging/whatsapp/webhooks/reference/messages/unsupported) (accessed 2026-11-24) says it means the message is currently unavailable, with the title "This message is currently unavailable." The payload has the same structure as for 131051. Only the error values differ.

The [coexistence onboarding page](https://developers.facebook.com/documentation/business-messaging/whatsapp/embedded-signup/onboarding-business-app-users) (accessed 2026-11-24) calls the webhook "expected" and lists two scenarios:

- "First-time messaging: A WhatsApp user messages your business for the first time." Meta adds that this "is especially common when users tap one of your ads that click to WhatsApp and immediately send a message." Then: "The error typically resolves within a few seconds, after which WhatsApp delivers messages normally."
- "Unsupported companion device: A WhatsApp user with an unsupported companion device sends or receives a message to or from your business."

Meta's advice for both is the same: "instruct the business to check the WhatsApp Business app for the message."

The fields you will read sit at these paths:

| Path | Value on a placeholder |
| --- | --- |
| `messages[].type` | `unsupported` |
| `messages[].errors[].code` | `131060` |
| `messages[].errors[].title`, `.message`, `.error_data.details` | Error text |
| `messages[].unsupported.type` | The unsupported type |
| `messages[].id`, `from`, `from_user_id`, `timestamp` | Same fields as any message |

The reference recommends identifying users by `user_id` and `from_user_id`, because `wa_id` and `from` can be omitted. Meta never says the real message is redelivered with the same `id`, or how long that takes. And 131060 is missing from the main [error codes](https://developers.facebook.com/documentation/business-messaging/whatsapp/support/error-codes) table (accessed 2026-11-24), which lists only 131051, "Unsupported message type." Other onboarding codes are in [WhatsApp coexistence onboarding errors](/academy/articles/whatsapp-coexistence-onboarding-errors/).

## What the Chatwoot report shows

The evidence for the shared `id` is one detailed report plus one confirmation, both in [chatwoot#16680](https://github.com/chatwoot/chatwoot/issues/16680) (opened 2026-11-16, open, accessed 2026-11-24). A GitHub search for 131060 with coexistence or wamid returned no other relevant issue. It is a strong signal, but Meta has not documented the behavior.

The reporter logged 10 days on one coexistence inbox:

- 20 placeholders arrived, and 18 of them had real content under the same wamid. Of the 18, 16 carried an ad referral.
- In 17 cases the real message came after the placeholder. Of those, 16 came within 0 to 8 seconds, and one about 8 minutes later. All 17 ended with only the placeholder stored.
- In 1 case the real message came first, and it was stored correctly.

The placeholder in the report differs from Meta's docs. Its title and message read "This message is unavailable.", while `error_data.details` reads "This message is currently unavailable." `unsupported.type` and an `unsupported.raw_type` field are both `"unknown"`. Neither that value nor `raw_type` appears in Meta's field list, so do not match on them.

The real payload had `type: "text"` and a `referral` with `source_type: "ad"`, `media_type: "image"`, a `ctwa_clid` and a `welcome_message`. Losing it means losing the ad attribution as well. Why that referral matters is in [click-to-WhatsApp ads](/academy/articles/whatsapp-click-to-whatsapp-ads-free-entry-point/).

A second user confirmed it on 2026-11-19. In about 7 hours of logs they saw 5 events with 131060. Of these, four were redelivered with content, three with a click-to-WhatsApp referral, between 3 seconds and 9 minutes later. Two events with 131051 were never redelivered. They estimated that about 16% of their ad-originated contacts lost their first message over 24 days.

## Why id-only dedupe drops the real message

The common pattern inserts the message `id` with `ON CONFLICT DO NOTHING` and continues only when a row comes back. That is the design in [duplicate WhatsApp webhooks in n8n](/academy/articles/n8n-duplicate-webhooks-idempotency/), and it is right for Meta's retries. It fails here because the placeholder claims the `id` first. The real message then looks like a retry and goes to the discard branch.

The timing rules out a simple wait. A gap of a few seconds covers most cases in the report, but both users saw gaps of 8 and 9 minutes. The single reversed case rules out "always replace the stored row" as well, since a late placeholder would overwrite real content. The fix has to be order-independent.

## Store placeholders, then let content replace them

One table holds every inbound message, with a flag for placeholders:

```sql
CREATE TABLE inbound_messages (
  wamid          text PRIMARY KEY,
  is_placeholder boolean NOT NULL,
  payload        jsonb   NOT NULL,
  received_at    timestamptz NOT NULL DEFAULT now()
);
```

Each message goes through this upsert. `$1` is `messages[].id`, `$2` is whether `type` equals `unsupported`, and `$3` is the message object.

```sql
INSERT INTO inbound_messages (wamid, is_placeholder, payload)
VALUES ($1, $2, $3)
ON CONFLICT (wamid) DO UPDATE
  SET is_placeholder = false, payload = EXCLUDED.payload, received_at = now()
  WHERE inbound_messages.is_placeholder AND NOT EXCLUDED.is_placeholder
RETURNING wamid, is_placeholder;
```

A conflict updates the row only when the stored row is a placeholder and the new event is not. PostgreSQL returns only rows that were inserted or updated ([INSERT](https://www.postgresql.org/docs/current/sql-insert.html), accessed 2026-11-24). Every other conflict returns nothing.

| Arrival | Rows returned | What the handler does |
| --- | --- | --- |
| First real message for this `id` | 1, `is_placeholder = false` | Process it |
| Real message after a placeholder | 1, `is_placeholder = false` | Process it |
| First placeholder for this `id` | 1, `is_placeholder = true` | Hold; no reply, no automation |
| Placeholder after the real message | 0 | Stop |
| Retry of either | 0 | Stop |

### A Node handler around the upsert

This Express handler answers 200 first, then runs each message through the upsert. It needs `npm install express pg` and a `DATABASE_URL` environment variable.

```js
const express = require("express");
const { Pool } = require("pg");

const pool = new Pool({ connectionString: process.env.DATABASE_URL });

const UPSERT = `
INSERT INTO inbound_messages (wamid, is_placeholder, payload)
VALUES ($1, $2, $3)
ON CONFLICT (wamid) DO UPDATE
  SET is_placeholder = false, payload = EXCLUDED.payload, received_at = now()
  WHERE inbound_messages.is_placeholder AND NOT EXCLUDED.is_placeholder
RETURNING wamid, is_placeholder`;

const app = express();
app.use(express.json());

app.post("/webhook", async (req, res) => {
  res.sendStatus(200);

  for (const entry of req.body.entry ?? []) {
    for (const change of entry.changes ?? []) {
      if (change.field !== "messages") continue;

      for (const m of change.value?.messages ?? []) {
        const placeholder = m.type === "unsupported";
        try {
          const { rows } = await pool.query(UPSERT, [m.id, placeholder, JSON.stringify(m)]);
          if (rows.length === 0) continue; // retry, or a placeholder after the real message
          if (rows[0].is_placeholder) {
            console.log("placeholder held", m.id, m.errors?.[0]?.code);
            continue; // wait for the real content
          }
          await handleMessage(m); // first real content for this id
        } catch (err) {
          console.error("inbound failed", m.id, err);
        }
      }
    }
  }
});

async function handleMessage(m) {
  console.log("process", m.id, m.type, m.from_user_id ?? m.from);
}

app.listen(3000);
```

Replace `handleMessage` with your CRM write and reply. Status events are a different stream: keep the `id` plus status key from the n8n article for them. The sketch skips signature checks, so add one from [verify X-Hub-Signature-256 on WhatsApp webhooks](/academy/articles/whatsapp-webhook-signature-verification-x-hub-signature-256/) before production.

The same caveat as any mark-then-process design applies. The handler has already answered 200 and written the row when `handleMessage` runs. If it crashes, Meta does not resend, and a redelivery would be dropped as a duplicate. A `status` column updated at the end of processing lets you re-queue those rows.

### The same change in n8n

In the n8n pattern, create the `inbound_messages` table and swap the Postgres query for the upsert above. Pass three query parameters: the id, the boolean and the message object as JSON text. Then give the If node two conditions joined by AND: `{{ $json.wamid }}` is not empty, and `{{ $json.is_placeholder }}` is false. The false output then carries retries, late placeholders and held placeholders.

This n8n variant is untested. If your Postgres node splits Query Parameters on commas, the JSON text breaks, so pass the message JSON through an expression instead.

## Find placeholders that never resolved

Some placeholders stay placeholders. In the report, 2 of 20 never got content, and the 131051 events in the confirming comment were never redelivered. This query lists placeholders older than a threshold you pass in:

```sql
SELECT wamid,
       payload->'errors'->0->>'code' AS error_code,
       payload->>'from_user_id'      AS from_user_id,
       received_at
FROM inbound_messages
WHERE is_placeholder
  AND received_at < now() - $1::interval
ORDER BY received_at;
```

Pick the threshold from your own logs, above the longest gap you have seen. The two users saw gaps of 8 and 9 minutes, so a threshold of a few seconds would raise false alerts. Treat a 131051 placeholder as final when it appears. For a 131060 placeholder past the threshold, follow Meta's advice and ask the business to check the WhatsApp Business app.

## Why not key on wamid plus type

A key of `wamid + ':' + type` also lets the real message through, because `unsupported` and `text` produce different keys. It works only if nothing ever acts on the placeholder row. Any automation that fires on the first key, such as an auto-reply to an empty message, runs before the content exists. The upsert keeps one row per message and makes the hold explicit.

If you sequence messages in a buffer, the same hole exists there. The buffer in [WhatsApp webhooks arrive out of order](/academy/articles/whatsapp-webhooks-out-of-order-message-sequencing/) keeps the first event per `id`, so let a non-`unsupported` event replace a stored `unsupported` one.

## If you run Chatwoot

The report traces the bug to PR #14547, released in v4.15.0. An early return in `incoming_message_base_service.rb` stops processing when `find_message_by_source_id` finds the stored placeholder. The reporter ran v4.19.0. The confirming comment reproduced it on v4.19.1 and notes that v4.20.0 does not change that file. It also points to a 1-day `MessageDedupLock` on the wamid that a redelivery would have to bypass. The issue was open with no fix merged as of 2026-11-24.

## What is still unknown

Meta has not documented that the real message reuses the placeholder's `id`, or how long redelivery can take. It also has not explained why the error title in the report differs from the reference. The `unknown` type and the `raw_type` field are not in Meta's field list. The evidence comes from two Chatwoot users on coexistence inboxes. Log every placeholder with its error code and the gap until content arrives, so your own data replaces these numbers.

*Z-API Omni team*
