- Configurable per instance and comes disabled by default.
- For it to work, the instance needs to be an admin of the group.
1. Enable / disable via API (new endpoint)
In Anti-Scam Protection for Announcement Groups, the feature can also be enabled or disabled via API using the dedicated configuration endpoint. For more details on how to use the endpoint, refer to the documentation below. 🔗 https://developer.z-api.io/instance/update-announcement-guard2. Check the current state (existing /me endpoint)
After configuring the Anti-Scam Protection, you can check the current state of the feature directly via the API. This lookup lets you verify the settings applied to the instance and confirm whether the protection is properly enabled.3. Enable via dashboard
In the instance dashboard, under the “Announcement group security” section, the “Anti-scam protection in announcement groups” option is available. Turning this switch on or off has the same effect as using the endpoint described above, letting you manage the feature directly from the dashboard. After making the change, just use the screen’s standard save button to apply the new setting.4. What you receive when the protection acts (webhook)
When the Anti-Scam Protection removes a message identified as a scam attempt, an event is sent as usual through the receiving webhook (ReceivedCallback), using the existing “message revoked/deleted” event. To identify that the message was removed specifically by the protection, just check the notificationParameters field present in the webhook payload. How to identify it:- notificationParameters: [“ANNOUNCEMENT_GUARD”] → the scammer’s message was successfully deleted by the protection.
- notificationParameters: [“ANNOUNCEMENT_GUARD_FAILED”, “[REASON]”] → the protection attempted to delete it but failed (the message may still be visible). Possible reasons:
Webhook return
Return attributes
All returns from this webhook have the following attributes:string
Indicates the type of notification received. For deleted messages, the value will be
"REVOKE".string
Identifies that the message removal was performed by the Anti-Scam Protection.
string
Identifies the group where the message removal occurred.
string
Name of the group where the removal occurred.
string
Identifier of the message that was deleted.
string
Phone number of the author of the removed message.
string
LID identifier of the message’s author.
string
Name of the message’s author, when available.
boolean
Indicates whether the message belonged to the instance itself. In this case, the value will be
false.boolean
Indicates that the action was performed by the platform. In this case, the value will be
true.5. What to do with the event
Using the participantPhone (or participantLid) received in the event, you can call the group participant removal endpoint, already available in the API, to remove the message’s author. The Anti-Scam Protection does not remove the participant automatically. The decision to remove the author or not is up to you, allowing you to define your application’s behavior according to your needs.6. Notes
- The protection only acts while the instance is connected and has admin privileges in the group.
- The feature applies exclusively to community announcement groups, where only admins can send messages. It does not act in regular groups or individual chats.
- Messages sent by admins are not affected by the protection.
- Each message is processed individually. Therefore, each revocation generates its own webhook event. If the same author sends multiple messages, each message will be revoked and will generate a new event.
- The message’s author is not automatically removed from the group. As long as they remain in the group, they can send new messages. Each new attempt identified by the protection will be handled individually, generating a new revocation and a new webhook event.