{"id":41,"date":"2026-09-09T04:25:56","date_gmt":"2026-09-09T04:25:56","guid":{"rendered":"https:\/\/nirohelp.com\/docs\/41\/embedding-the-ticket-ui\/"},"modified":"2026-09-09T04:25:56","modified_gmt":"2026-09-09T04:25:56","slug":"embedding-the-ticket-ui","status":"publish","type":"nirohelp_doc","link":"https:\/\/nirohelp.com\/docs\/developers\/embedding-the-ticket-ui\/","title":{"rendered":"Embedding the ticket form on another site"},"content":{"rendered":"<p>NiroHelp serves a self-contained &#8220;Need Help?&#8221; ticket widget from<br \/>\n<code>\/nirohelp\/tickets\/embed\/<\/code>. It is a <strong>JavaScript file, not a page<\/strong> \u2014 the<br \/>\nendpoint responds with <code>Content-Type: application\/javascript<\/code>, so you load it<br \/>\nwith a <code>&lt;script&gt;<\/code> tag, not an iframe.<\/p>\n<p>The widget adds a floating launcher to the host page and opens a new-ticket<br \/>\nform. It is a submission surface only: there is no login, no ticket list and no<br \/>\nconversation thread inside it. For those, use the shortcodes on your own site.<\/p>\n<h2>The snippet<\/h2>\n<pre><code class=\"language-html\">&lt;script src=&quot;https:\/\/help.example.com\/nirohelp\/tickets\/embed\/&quot; defer&gt;&lt;\/script&gt;\n<\/code><\/pre>\n<p>The trailing slash matters \u2014 <code>\/nirohelp\/tickets\/embed<\/code> (no slash) answers with<br \/>\na 301 to the slashed form, which a <code>&lt;script src&gt;<\/code> does follow, but the rewrite<br \/>\nrule the plugin registers is <code>^nirohelp\/tickets\/embed\/?$<\/code>, so link the canonical<br \/>\nURL.<\/p>\n<p>Drop it on any page on any site, WordPress or not.<\/p>\n<h2>What the visitor sees<\/h2>\n<p>A pill-shaped <strong>Need Help?<\/strong> button pinned to the bottom-right of the page.<br \/>\nClicking it opens a panel containing:<\/p>\n<table>\n<thead>\n<tr>\n<th>Field<\/th>\n<th>Required<\/th>\n<th>Notes<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Your Name<\/td>\n<td>yes<\/td>\n<td>Used for the client account and for <code>##client_name##<\/code>.<\/td>\n<\/tr>\n<tr>\n<td>Your Email<\/td>\n<td>yes<\/td>\n<td>Resolves to an existing account, or creates one.<\/td>\n<\/tr>\n<tr>\n<td>Subject<\/td>\n<td>yes<\/td>\n<td>Becomes the ticket title.<\/td>\n<\/tr>\n<tr>\n<td>Description<\/td>\n<td>yes<\/td>\n<td>Becomes the ticket body.<\/td>\n<\/tr>\n<tr>\n<td>Product<\/td>\n<td>no<\/td>\n<td>Populated from <code>GET \/tickets\/products\/<\/code>.<\/td>\n<\/tr>\n<tr>\n<td>Reason<\/td>\n<td>no<\/td>\n<td>Populated from <code>GET \/tickets\/reasons\/<\/code>.<\/td>\n<\/tr>\n<tr>\n<td>Urgency<\/td>\n<td>no<\/td>\n<td>Populated from <code>GET \/tickets\/urgencies\/<\/code>.<\/td>\n<\/tr>\n<tr>\n<td>Order ID<\/td>\n<td>no<\/td>\n<td>Stored as the <code>order<\/code> post meta.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Submitting posts to <code>POST \/wp-json\/nirohelp\/v1\/tickets\/<\/code> on the site that<br \/>\nserved the script. That route is deliberately open to anonymous callers \u2014 the<br \/>\nwidget runs cross-origin and cannot carry a <code>wp_rest<\/code> nonce \u2014 and hardened<br \/>\ninside the callback instead: an anonymous caller can never set <code>user_id<\/code>, so a<br \/>\nticket is always filed against the account resolved from the submitted email.<\/p>\n<h2>Where the site URL comes from<\/h2>\n<p>The endpoint prints one line ahead of the static file:<\/p>\n<pre><code class=\"language-js\">var NIROHELP_HOME_URL = &quot;https:\/\/help.example.com&quot;;\n<\/code><\/pre>\n<p>That is what the widget calls. If you serve the script some other way (copying<br \/>\n<code>assets\/tickets\/js\/embed.js<\/code> to a CDN, say), the script falls back to slicing<br \/>\nits own <code>src<\/code> at <code>\/wp-content\/<\/code> or <code>\/nirohelp\/tickets\/embed<\/code>, and finally to<br \/>\n<code>window.location.origin<\/code>. Loading it from a third host without either marker in<br \/>\nthe path will point it at the wrong site.<\/p>\n<h2>Account creation is a prerequisite<\/h2>\n<p>A submission from an email with no matching WordPress user only succeeds when<br \/>\naccount creation is allowed \u2014 core&#8217;s <strong>Anyone can register<\/strong>, or <strong>NiroHelp -&gt;<br \/>\nSettings -&gt; Tickets -&gt; Submission -&gt; Create accounts for new clients<\/strong>. With<br \/>\nboth off, the widget can only accept tickets from people who already have an<br \/>\naccount on the help site.<\/p>\n<h2>How it differs from the shortcodes<\/h2>\n<table>\n<thead>\n<tr>\n<th><\/th>\n<th>Embed widget<\/th>\n<th><code>[nirohelp_new_ticket]<\/code><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Runs on<\/td>\n<td>any site<\/td>\n<td>the WordPress site hosting NiroHelp<\/td>\n<\/tr>\n<tr>\n<td>Rendering<\/td>\n<td>injected by JS, ignores your theme<\/td>\n<td>inside your theme<\/td>\n<\/tr>\n<tr>\n<td>Fields<\/td>\n<td>fixed set above<\/td>\n<td>driven by <strong>Settings -&gt; Tickets -&gt; Form fields<\/strong>, custom fields included<\/td>\n<\/tr>\n<tr>\n<td>Login<\/td>\n<td>none; identifies by email<\/td>\n<td>login required, honours the configured login method<\/td>\n<\/tr>\n<tr>\n<td>Reading replies<\/td>\n<td>not possible<\/td>\n<td>via <code>[nirohelp_tickets]<\/code> and the emailed login link<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The widget is the &#8220;let people file a ticket from our marketing site&#8221; surface.<br \/>\nClients still read and answer their tickets on the help site, through the link<br \/>\nin the notification email.<\/p>\n<h2>Styling it<\/h2>\n<p>The widget writes inline styles and has no configuration attributes. To change<br \/>\nits appearance, copy <code>assets\/tickets\/js\/embed.js<\/code> into your own theme or<br \/>\nplugin, edit it there, and enqueue your copy instead of the endpoint. Keep<br \/>\n<code>NIROHELP_HOME_URL<\/code> defined ahead of it, or leave the file at a path containing<br \/>\n<code>\/wp-content\/<\/code> so the fallback resolves.<\/p>\n<h2>Disabling the endpoint<\/h2>\n<p>The rewrite rule is registered unconditionally. To take the endpoint offline<br \/>\nwithout editing the plugin, short-circuit it before <code>template_include<\/code> runs:<\/p>\n<pre><code class=\"language-php\">add_action( 'template_redirect', function () {\n    if ( get_query_var( 'nirohelp_tickets_embed' ) ) {\n        status_header( 404 );\n        exit;\n    }\n}, 5 );\n<\/code><\/pre>\n","protected":false},"author":1,"featured_media":0,"template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}}},"nirohelp_product":[],"nirohelp_topic":[12],"class_list":["post-41","nirohelp_doc","type-nirohelp_doc","status-publish","hentry","nirohelp_topic-developers"],"_links":{"self":[{"href":"https:\/\/nirohelp.com\/docs\/wp-json\/wp\/v2\/nirohelp_doc\/41","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nirohelp.com\/docs\/wp-json\/wp\/v2\/nirohelp_doc"}],"about":[{"href":"https:\/\/nirohelp.com\/docs\/wp-json\/wp\/v2\/types\/nirohelp_doc"}],"author":[{"embeddable":true,"href":"https:\/\/nirohelp.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"wp:attachment":[{"href":"https:\/\/nirohelp.com\/docs\/wp-json\/wp\/v2\/media?parent=41"}],"wp:term":[{"taxonomy":"nirohelp_product","embeddable":true,"href":"https:\/\/nirohelp.com\/docs\/wp-json\/wp\/v2\/nirohelp_product?post=41"},{"taxonomy":"nirohelp_topic","embeddable":true,"href":"https:\/\/nirohelp.com\/docs\/wp-json\/wp\/v2\/nirohelp_topic?post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}