Using Magic Link Module in FlowMattic
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
- 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 asMagic 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:
FlowMattic will automatically replace the[fm_magic_link id="YOUR_WORKFLOW_ID" link_text="Click Here"]
YOUR_WORKFLOW_ID
with the ID of the workflow you are editing.
- 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" |
-
Example of a Fully Customized Shortcode:
Below is an example of a shortcode with all parameters:[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"]
-
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
andcss_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.
By integrating the Magic Link module into your WordPress site, you can create a seamless and automated experience for your users and visitors.