Articles in this section
Category / Section

Using Magic Link Module in FlowMattic

Updated:

Overview

The Magic Link module in FlowMattic allows you to trigger workflows seamlessly when a visitor or site user clicks a specific link on your WordPress site. This feature provides flexibility through customizable parameters, enabling tailored user experiences and automation triggers.

What is the Magic Link module?

The Magic Link module lets you start any FlowMattic workflow simply by letting a site user —or even an anonymous visitor—click a hyperlink. Instead of waiting for a form submission, webhook, or schedule, the workflow fires instantly when the link is visited.
Behind the scenes FlowMattic:

  • Verifies the link (using a random, unguessable workflow ID).
  • Records the click for your logs/analytics.
  • Runs the workflow in the background.
  • (Optional) Redirects the clicker to a page you choose.

Because you embed the link with a WordPress shortcode, you can drop it into posts, Elementor blocks, menu items, custom frontend dashboards that render shortcodes.

Why use a Magic Link?

Scenario How the Magic Link helps
Self-service actions—e.g. “Generate invoice” A logged-in customer clicks a link in their dashboard; your invoicing workflow runs and delivers a PDF.
Gated downloads—e.g. “Download e-book” Visitor clicks, the workflow adds them to your CRM, tags them, then redirects them to the file.
One-click campaigns Send an email blast: every click instantly triggers a personalised workflow (apply tags, start automation, etc.).

How the Magic Link Works

  • Link render – The shortcode expands to an HTML <a> tag at page load or during email rendering.
  • Click – When clicked, FlowMattic receives a secure request containing the Magic Link ID.
  • Workflow execution – The associated workflow starts immediately and logs the run.
  • Redirect – The browser is sent to the redirect URL you specified

Prerequisites

  • FlowMattic ≥ 5.1.1 installed & activated.
  • A published workflow that should run on click.
  • Proper user roles/permissions set if the workflow must only run for logged-in users.

Steps to Implement the Magic Link

  1. Generate the Magic Link Shortcode:
  • Go to FlowMattic ▸ Workflows and open or create new workflow.
  • Choose the trigger app as Magic Link and choose the event as Magic Link Clicked
  • Click Continue button and go to the Configure tab.
  • You will see the following basic shortcode template to add the Magic Link to your WordPress page:
    [fm_magic_link id="YOUR_WORKFLOW_ID" link_text="Click Here"]
    
    FlowMattic will automatically replace the YOUR_WORKFLOW_ID with the ID of the workflow you are editing.
  1. Customize the Shortcode Parameters:
    Enhance the Magic Link’s functionality by using the following parameters:
Parameter Purpose Example
id The workflow’s Magic Link ID (find it in the Magic Link tab inside the workflow editor). id="YDtUm40X6f"
link_text Anchor text shown when the visitor is logged in. link_text="Run My Report"
visitor_link_text Text shown when the visitor is not logged in. Falls back to link_text if omitted. visitor_link_text="Sign in to run"
user_redirect_url Where to send a logged-in user after the click (absolute or relative URL). user_redirect_url="/thank-you/"
visitor_redirect_url Where to send non-logged-in visitors. visitor_redirect_url="/login/"
css_class Custom class(es) added to the <a> tag. css_class="btn btn-primary"
css_id Custom ID for the <a> tag. css_id="start-workflow"
Custom Fields Any custom parameter you define (e.g., product_id, user_role, campaign_name). product_id="12345"

Using Custom Fields in Magic Links

Custom fields allow you to pass additional data from the Magic Link to your workflow. Any parameter you add to the shortcode (besides the standard parameters listed above) will be captured and made available in your workflow’s trigger data. This enables dynamic, context-aware workflows.

How Custom Fields Work

  1. Add any custom parameter to your Magic Link shortcode
  2. When the link is clicked, FlowMattic captures all custom field values
  3. Access the custom field values in your workflow using the Magic Link trigger’s output data
  4. Use these values in subsequent workflow steps for conditional logic, personalization, or data processing

Practical Use Cases for Custom Fields

Use Case Custom Fields Workflow Action
Product-specific downloads product_id="PRO-123" format="pdf" Check the product ID, verify user access, then deliver the requested file format
Campaign tracking campaign_name="spring-sale" source="email" Track which campaign generated the click, log to analytics, apply appropriate tags in CRM
User segmentation tier="premium" region="north-america" Run different automation paths based on user tier and region
Event registration event_id="webinar-2025" session="morning" Register user for specific event session, send confirmation email with session details
Dynamic content delivery content_type="video" language="es" Deliver content in the requested format and language based on user preference
A/B testing variant="A" test_id="homepage-cta" Track which variant was clicked, log results for analysis
Referral tracking referrer_id="USER-456" reward_type="discount" Credit the referrer, apply appropriate reward, create commission record

Examples with Custom Fields

Example 1: Product Download Link

[fm_magic_link
 id="YDtUm40X6f"
 link_text="Download Premium Template"
 product_id="TMPL-2025-PRO"
 format="sketch"
 license_type="extended"
 css_class="download-btn"]

Workflow use: The workflow can check if the user has purchased product_id, verify the license_type, and deliver the file in the requested format.

Example 2: Event Registration

[fm_magic_link
 id="ABC123XYZ"
 link_text="Register for Morning Session"
 event_id="webinar-automation-101"
 session="morning"
 timezone="EST"
 user_redirect_url="/thank-you-registration/"]

Workflow use: Register the user for the specific event_id and session, send calendar invite in their timezone, and add them to the event email sequence.

Example 3: Multi-language Support

[fm_magic_link
 id="LNG789MNO"
 link_text="Descargar Guía"
 content_id="guide-getting-started"
 language="es"
 region="latin-america"]

Workflow use: Deliver the guide (content_id) in Spanish (language), apply region-specific formatting, and track engagement by region.

Example 4: Referral Program

[fm_magic_link
 id="REF456DEF"
 link_text="Claim Your Bonus"
 referrer_id="USER-12345"
 campaign="friend-referral"
 reward_amount="50"
 css_class="referral-link"]

Workflow use: Credit the referrer_id account, apply the reward_amount as credits or discount, log the referral under the specific campaign.

Best Practices for Custom Fields

  • Use descriptive names: Choose field names that clearly indicate their purpose (e.g., product_id instead of pid)
  • Keep values simple: Avoid special characters and spaces in field values; use hyphens or underscores instead
  • Document your fields: Maintain a list of custom fields used across different Magic Links for consistency
  • Test thoroughly: Always test your Magic Links with custom fields to ensure the workflow receives and processes the data correctly
  • Use in conditions: Leverage custom field values in workflow conditional logic to create dynamic, intelligent automations
  1. Example of a Fully Customized Shortcode:
    Below is an example of a shortcode with all parameters including custom fields:

    [fm_magic_link
     id="YDtUm40X6f"
     link_text="Check your collection"
     visitor_link_text="Explore Cars"
     user_redirect_url="https://example.com/dashboard"
     visitor_redirect_url="https://example.com/signup"
     css_class="custom-class"
     css_id="magic-id"
     collection_type="premium"
     category="sports-cars"]
    

    In this example, collection_type and category are custom fields that will be passed to the workflow, allowing you to filter or process data based on these values.

  2. Add the Shortcode to Your WordPress Page:
    Copy the generated shortcode and paste it into the desired page or post on your WordPress site. The Magic Link will automatically display based on the settings you configured.

Tips for Optimizing Your Magic Link

  • Styling the Link: Use the css_class and css_id parameters to apply custom styles that align with your website’s design.
  • Testing the Workflow: Ensure the workflow ID is correct and test the Magic Link functionality across different user scenarios (logged-in users vs. visitors).
  • Redirect URLs: Use meaningful redirect URLs to guide users to the appropriate pages after they click the Magic Link.
  • Leverage Custom Fields: Use custom fields to pass contextual data (like product IDs, campaign names, user preferences) to your workflows for more intelligent and personalized automation.
  • Capture & Test Custom Fields: After adding custom fields to your shortcode, use the “Capture response” button in the workflow editor to test and verify that all custom field data is being received correctly.

By integrating the Magic Link module into your WordPress site, you can create a seamless and automated experience for your users and visitors.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Access denied
Access denied