Discord Create Message adds enforce_nonce to stop duplicate posts
What changed
On February 12, 2024 Discord added an enforce_nonce parameter to the Create Message endpoint. When true, the message is deduplicated for the same sender within a few minutes: if a message was already created with the same nonce, no new message is created and the previous one is returned. Discord says this will become the default in a future API version, without a date. The nonce can be up to 25 characters.
What it means
A tool that retries a failed send can avoid posting the same message twice: Discord returns the earlier message instead of creating a new one.
Who is affected
Scheduling tools and bots that post to Discord channels and retry after timeouts or network errors.
What to do by 12 Feb 2024
Send a unique nonce with enforce_nonce: true on Create Message, and reuse the same nonce when retrying the same post.
What this means for you
Sometimes a tool sends a post, the connection drops, and the tool tries again. That can make the same post appear twice. Discord now lets a tool attach a tag to each post. If the same tag arrives again within a few minutes, Discord keeps just the first post.
The details
- Endpoint:
POST /channels/{channel.id}/messages(Create Message). - Parameters:
nonce(integer or string, up to 25 characters) andenforce_nonce(boolean). - Behavior: with
enforce_nonce: true, the nonce is "checked for uniqueness in the past few minutes"; a repeat from the same author returns the existing message and creates nothing. - Window: "a few minutes"; Discord gives no exact number.
- Future default: "This behavior will become the default for this endpoint in a future API version." No version or date is stated.
- Scope: documented for Create Message. The changelog does not mention webhook execution.
What to do next
- Business owners: Nothing.
- Marketers and agencies: If you have seen double posts in Discord from a scheduler, ask whether it uses
enforce_nonce. - Developers: Generate one nonce per scheduled post, store it, and resend it with
enforce_nonce: trueon every retry of that post.
Primary sources
- Discord Developer change log: Enforced Nonces on Create Message Endpoint (February 12, 2024)
- Discord Developer docs: Create Message
Get an email when a new API change is added
Follow new entries with the RSS feed. Each platform also has its own feed, for example X or Meta.