Dynamic Messaging

Prev Next

Show a contextual warning or ask for an acknowledgement during a protected website flow. For example, a transfer page can remind a customer to check an unfamiliar recipient and record whether they chose to proceed.

The package injects a dialog into an HTML response. Use it where Darwinium proxies the page through your CDN integration. It can record a browser response, but does not by itself block the underlying transaction or verify the customer's identity.

Choose the interaction

Install Dynamic Messaging, import dynamicmessage.snippet, and choose a template:

Template Visitor interaction Recorded value
show_dynamic_message_confirm_deny Confirm and deny buttons agree or deny
show_dynamic_messasage_force_confirm Type a required phrase, then confirm The entered text

Use the supplied internal names exactly when writing a reference; the second contains messasage.

Configure a warning on a page

Add Show dynamic message to the page step's HTML response mappings. The template inserts the SweetAlert2 library in the head and the dialog script in the body.

An example configuration is:

Argument Example
Icon warning
Title Check the recipient
Subtitle Confirm that you know who will receive this transfer.
Confirm Button Text I have checked
Deny Button Text I need to review
Show when… custom.general_purpose['show_transfer_warning'] = true
Record User Response As Event true

The condition assumes your workflow explicitly sets that example attribute before response injection. Replace it with your own available condition and establish the dependency on the operation producing it. Use controlled message text: the package inserts its arguments into JavaScript strings, so arbitrary quotes or untrusted text require an appropriately escaped custom template.

For typed confirmation, provide Text to force user to input, User Input Label and Error message when text not matched instead of the two button labels. Matching is case-insensitive; the recorded value is the text entered, not a boolean.

Capture the visitor's response

With recording enabled, the script sends a form-encoded POST to:

/__darwinium/dynamic_messaging

The confirm/deny request body is user_response=agree or user_response=deny. Create a journey step matching that host, method and path, and map the user_response form field to an attribute you choose, such as custom.general_purpose['warning_response'].

Configure a deliberate response for that endpoint in your deployment. Associate the event with the relevant session or journey before using it in a later decision. The supplied payload contains no transfer ID or message ID, so add those to a custom template and callback mapping if you need to distinguish multiple warnings or transactions.

The client-provided acknowledgement is a record of interaction. Enforce any requirement to pause or reject a transfer separately in the application or Darwinium action.

Verify display, capture and behavior

Deploy to a test target and visit a page that meets the display condition. Check both buttons and inspect the callback event. Then visit a page where the condition is false and confirm no dialog is injected. For typed confirmation, try incorrect text and the expected phrase.

The template loads SweetAlert2 from jsDelivr and executes inline JavaScript. Ensure the page's Content Security Policy permits the required resources. Test the dialog on mobile and desktop, including revisiting the page: without your own state or condition, the warning may appear again on another matching page load.

For reusable HTML injections or a richer callback, continue with Snippet references and arguments.