BlogIntegrations · November 5, 2026 · 5 min read

Contact Form 7 Slack Alerts: Keep Submitted Text from Becoming Message Markup

Format CF7 inquiry alerts for Slack without accidental mentions or misleading links. Separate trusted layout from submitted text and check fallback behavior.

A Contact Form 7 inquiry contains angle brackets, an asterisk or text resembling a Slack mention. Your adapter inserts that answer into a formatted notification, and the result looks different from the submitted message. The fix belongs at the message-formatting boundary: keep trusted layout separate from visitor-controlled text.

A green message card passes through a protective frame into a mint speech bubble, with loose symbols held outside.
Generated conceptual illustration; not a product screenshot or measured result.

This guide assumes a separately configured server-side integration. It does not claim a native CF7-to-Slack connection. Our team notification comparison covers destination selection; here the question is how one Slack message represents an inquiry accurately.

Decide what the alert actually needs

Begin with an inquiry reference, a short category and a link to the authorized record. A notification often does not need the full message, phone number, attachment list or every answer. The durable record should remain in the team’s approved lead system, where access and follow-up have clear owners.

Use a static heading for the trusted label, such as “New inquiry available.” Treat the submitted message as content, even when it resembles instructions, a link or a team mention. A visitor should not control the destination channel, the record URL or who receives a broad notification.

Keep webhook credentials in the maintained server-side adapter. The incoming-webhook guide explains the app and channel relationship. A browser listener on the public form page is not an appropriate place for the webhook URL.

Choose plain text for submitted answers

Slack’s formatting reference distinguishes its mrkdwn syntax from ordinary Markdown. For a layout-block text object containing a visitor’s answer, prefer plain_text when rich formatting serves no useful purpose. Keep optional formatted labels in a separate trusted object.

Slack documents ampersand, less-than and greater-than as control characters that need entity escaping when used literally. Encode those characters once for the Slack text boundary. Do not run an entire message through a general HTML encoder and assume every HTML entity will be decoded as you intend.

Keep the original answer in the authorized source record. The notification representation can have its own escaping and length policy. Reusing that escaped representation in an HTML email or web page would cross another formatting boundary and needs the receiving format’s own handling.

Understand what verbatim does and does not do

The text-object reference documents plain_text, mrkdwn and the verbatim option. Setting verbatim on a mrkdwn object limits automatic parsing, but manual formatting and parsing strings still work. It is not a universal switch that makes arbitrary submitted markup inert.

For example, a manual mention-like string must not become trusted just because verbatim is true. A stronger design decision is to keep the visitor’s content in a plain-text object and reserve mrkdwn for adapter-owned labels. Review every field separately rather than setting one flag and declaring the whole payload safe.

Also review how links are constructed. Build the record link from an approved application base URL and the stored opaque reference. Do not convert a visitor’s supplied website field into an internal “Open inquiry” action without checking its destination and purpose.

Build an inspectable synthetic payload

The following fragment demonstrates a short escaped answer inside a plain-text section. It is a synthetic payload example, not a request sent to Slack. The top-level fallback contains only trusted wording:

{
  "text": "New inquiry DEMO-17 is available in the lead workspace.",
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "plain_text",
        "text": "A & B asked about <sample> materials.",
        "emoji": false
      }
    }
  ]
}

Serialize the object with the runtime’s JSON serializer. Do not concatenate answers into a JSON string manually. A quotation mark or line break in a message should remain data and should not break the payload structure. JSON serialization and Slack text escaping are separate steps.

Budget length and preserve a useful fallback

The section-block reference sets different limits for section text and compact fields. A section text object supports up to 3,000 characters; individual fields have a 2,000-character limit. Check the actual object you use instead of applying one limit to every part of the message.

For long answers, send a short excerpt with an explicit indication that more content is available in the record. Do not silently cut the only copy of the inquiry. Avoid splitting a message into so many notifications that the team loses its reference or mistakes each fragment for a separate lead.

Slack’s message-posting documentation explains fallback text and accessibility behavior with blocks. Keep fallback wording meaningful for notifications and screen readers, and review it independently from the visible block layout. Do not copy unreviewed raw answers into the fallback after carefully handling the blocks.

Verify display and notification behavior separately

Use an authorized test destination with synthetic examples containing ampersands, angle brackets, quotation marks, line breaks, an asterisk, a URL and mention-like strings. Inspect the serialized payload and resulting display. Confirm that submitted text remains recognizable and does not create an unintended mention or misleading record link.

Repeat with an empty optional answer and an overlong message. Check fallback text, truncation, mobile readability and the stored record link. Record expected outcomes before the test; this article does not claim we sent test alerts or verified your workspace.

We operate CF7 Analytics. Our free Svetlik Analytics for Contact Form 7 concerns submission statistics, while the adapter owns Slack formatting and delivery evidence. A posted notification does not prove a human read it or an email reached an inbox. Official references were checked November 5, 2026.