<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Add a redirect after booking a Meeting in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Add-a-redirect-after-booking-a-Meeting/m-p/868527#M68456</link>
    <description>&lt;P&gt;I am using HubSpot meetings as an iframe in a modal on my website. I want to be able to auto-close the modal once the booking has been made successfully.&lt;BR /&gt;&lt;BR /&gt;Here is the iframe and modal&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;export const HubSpotIFrameInitializer = ({
	hubspotMeetingUrl,
	prefill,
}: IHubSpotMeetingIframeProps) =&amp;gt; {
	React.useEffect(() =&amp;gt; {
		const script = document.createElement('script');

		script.src='https://static.hsappstatic.net/MeetingsEmbed/ex/MeetingsEmbedCode.js';
		script.onload = function () {
			const meetingsEmbedCode = (window as ICustomWindow).hsMeetingEmbed;

			if (meetingsEmbedCode) {
				meetingsEmbedCode.initialize({
					widgetPosition: 'inline',
					targetSelector: '.meetings-iframe-container',
				});
			}
		};
		script.onerror = function (ev) {
			logger.log(`script failed to load.${ev}`);
		};
		document.body.appendChild(script);
	}, [hubspotMeetingUrl]);

	// Construct hubspot url with prefill details
	const preFilledHubSpotMeetingUrl = `${hubspotMeetingUrl}&amp;amp;email=${prefill?.email}&amp;amp;firstName=${prefill?.firstName}&amp;amp;lastName=${prefill?.lastName}`;

	return prefill != null ? (
		&amp;lt;div
			className="meetings-iframe-container"
			data-src={preFilledHubSpotMeetingUrl}
		/&amp;gt;
	) : (
		&amp;lt;div
			className="meetings-iframe-container"
			data-src={`${hubspotMeetingUrl}`}
		/&amp;gt;
	);
};

const HubSpotWidget = ({
	title,
	openhubSpotDialog,
	setOpenhubSpotDialog,
	prefill,
	extraComponent,
}: IProps) =&amp;gt; {
	const theme = useTheme();
	const PrimaryContrastColorHex = theme?.palette?.primary?.contrastText;
	const fullScreen = useMediaQuery(theme.breakpoints.down('md'));

	// Initialize hubspotMeetingUrl with the default URL
	const hubspotMeetingUrl = HubSpotUtils.getHubSpotMeetingUrl(
		prefill?.sparkAdvisorId || '',
		'quick-meeting'
	);

	const handleClose = () =&amp;gt; {
		setOpenhubSpotDialog(false);
	};

	return (
		&amp;lt;&amp;gt;
			&amp;lt;Dialog
				maxWidth="lg"
				fullWidth
				open={openhubSpotDialog}
				onClose={handleClose}
				TransitionComponent={Transition}
				fullScreen={fullScreen}
				keepMounted
			&amp;gt;
				&amp;lt;DialogTitle sx={{ backgroundColor: 'secondary.main' }}&amp;gt;
					&amp;lt;Box
						sx={{
							display: 'flex',
							justifyContent: 'space-between',
							alignItems: 'center',
						}}
					&amp;gt;
						&amp;lt;Typography
							sx={{
								fontWeight: 'bold',

								color: PrimaryContrastColorHex,
							}}
							variant="h5"
						&amp;gt;
							{title ||
								'Book a call with one of our experienced Energy Advisors'}
						&amp;lt;/Typography&amp;gt;

						&amp;lt;IconButton onClick={handleClose}&amp;gt;
							&amp;lt;Close htmlColor={PrimaryContrastColorHex} /&amp;gt;
						&amp;lt;/IconButton&amp;gt;
					&amp;lt;/Box&amp;gt;
				&amp;lt;/DialogTitle&amp;gt;
				&amp;lt;Helmet&amp;gt;
					&amp;lt;script
						type="text/javascript"
						src="https://static.hsappstatic.net/MeetingsEmbed/ex/MeetingsEmbedCode.js"
					/&amp;gt;
				&amp;lt;/Helmet&amp;gt;
				&amp;lt;DialogContent sx={{ height: '100%' }}&amp;gt;
					&amp;lt;HubSpotIFrameInitializer
						hubspotMeetingUrl={hubspotMeetingUrl}
						prefill={prefill}
					/&amp;gt;
				&amp;lt;/DialogContent&amp;gt;
			&amp;lt;/Dialog&amp;gt;
			{extraComponent}
		&amp;lt;/&amp;gt;
	);
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Oct 2023 10:54:53 GMT</pubDate>
    <dc:creator>kinara</dc:creator>
    <dc:date>2023-10-23T10:54:53Z</dc:date>
    <item>
      <title>Add a redirect after booking a Meeting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Add-a-redirect-after-booking-a-Meeting/m-p/868527#M68456</link>
      <description>&lt;P&gt;I am using HubSpot meetings as an iframe in a modal on my website. I want to be able to auto-close the modal once the booking has been made successfully.&lt;BR /&gt;&lt;BR /&gt;Here is the iframe and modal&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;export const HubSpotIFrameInitializer = ({
	hubspotMeetingUrl,
	prefill,
}: IHubSpotMeetingIframeProps) =&amp;gt; {
	React.useEffect(() =&amp;gt; {
		const script = document.createElement('script');

		script.src='https://static.hsappstatic.net/MeetingsEmbed/ex/MeetingsEmbedCode.js';
		script.onload = function () {
			const meetingsEmbedCode = (window as ICustomWindow).hsMeetingEmbed;

			if (meetingsEmbedCode) {
				meetingsEmbedCode.initialize({
					widgetPosition: 'inline',
					targetSelector: '.meetings-iframe-container',
				});
			}
		};
		script.onerror = function (ev) {
			logger.log(`script failed to load.${ev}`);
		};
		document.body.appendChild(script);
	}, [hubspotMeetingUrl]);

	// Construct hubspot url with prefill details
	const preFilledHubSpotMeetingUrl = `${hubspotMeetingUrl}&amp;amp;email=${prefill?.email}&amp;amp;firstName=${prefill?.firstName}&amp;amp;lastName=${prefill?.lastName}`;

	return prefill != null ? (
		&amp;lt;div
			className="meetings-iframe-container"
			data-src={preFilledHubSpotMeetingUrl}
		/&amp;gt;
	) : (
		&amp;lt;div
			className="meetings-iframe-container"
			data-src={`${hubspotMeetingUrl}`}
		/&amp;gt;
	);
};

const HubSpotWidget = ({
	title,
	openhubSpotDialog,
	setOpenhubSpotDialog,
	prefill,
	extraComponent,
}: IProps) =&amp;gt; {
	const theme = useTheme();
	const PrimaryContrastColorHex = theme?.palette?.primary?.contrastText;
	const fullScreen = useMediaQuery(theme.breakpoints.down('md'));

	// Initialize hubspotMeetingUrl with the default URL
	const hubspotMeetingUrl = HubSpotUtils.getHubSpotMeetingUrl(
		prefill?.sparkAdvisorId || '',
		'quick-meeting'
	);

	const handleClose = () =&amp;gt; {
		setOpenhubSpotDialog(false);
	};

	return (
		&amp;lt;&amp;gt;
			&amp;lt;Dialog
				maxWidth="lg"
				fullWidth
				open={openhubSpotDialog}
				onClose={handleClose}
				TransitionComponent={Transition}
				fullScreen={fullScreen}
				keepMounted
			&amp;gt;
				&amp;lt;DialogTitle sx={{ backgroundColor: 'secondary.main' }}&amp;gt;
					&amp;lt;Box
						sx={{
							display: 'flex',
							justifyContent: 'space-between',
							alignItems: 'center',
						}}
					&amp;gt;
						&amp;lt;Typography
							sx={{
								fontWeight: 'bold',

								color: PrimaryContrastColorHex,
							}}
							variant="h5"
						&amp;gt;
							{title ||
								'Book a call with one of our experienced Energy Advisors'}
						&amp;lt;/Typography&amp;gt;

						&amp;lt;IconButton onClick={handleClose}&amp;gt;
							&amp;lt;Close htmlColor={PrimaryContrastColorHex} /&amp;gt;
						&amp;lt;/IconButton&amp;gt;
					&amp;lt;/Box&amp;gt;
				&amp;lt;/DialogTitle&amp;gt;
				&amp;lt;Helmet&amp;gt;
					&amp;lt;script
						type="text/javascript"
						src="https://static.hsappstatic.net/MeetingsEmbed/ex/MeetingsEmbedCode.js"
					/&amp;gt;
				&amp;lt;/Helmet&amp;gt;
				&amp;lt;DialogContent sx={{ height: '100%' }}&amp;gt;
					&amp;lt;HubSpotIFrameInitializer
						hubspotMeetingUrl={hubspotMeetingUrl}
						prefill={prefill}
					/&amp;gt;
				&amp;lt;/DialogContent&amp;gt;
			&amp;lt;/Dialog&amp;gt;
			{extraComponent}
		&amp;lt;/&amp;gt;
	);
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 10:54:53 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Add-a-redirect-after-booking-a-Meeting/m-p/868527#M68456</guid>
      <dc:creator>kinara</dc:creator>
      <dc:date>2023-10-23T10:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Add a redirect after booking a Meeting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Add-a-redirect-after-booking-a-Meeting/m-p/868922#M68478</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/651900"&gt;@kinara&lt;/a&gt;&amp;nbsp;thank you for posting in our Community!&lt;/P&gt;
&lt;P&gt;I want to share this conversation&lt;A href="https://community.hubspot.com/t5/APIs-Integrations/Book-a-meeting-redirection-on-form-submission/m-p/366610#M36128" target="_blank" rel="noopener"&gt; in our Community here&amp;nbsp;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Is this what you are looking for? If not, to our top experts&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/17186"&gt;@Anton&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/148115"&gt;@dbeau79&lt;/a&gt;&amp;nbsp;any recommendations to&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/651900"&gt;@kinara&lt;/a&gt;&amp;nbsp;?&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Pam&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 22:07:13 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Add-a-redirect-after-booking-a-Meeting/m-p/868922#M68478</guid>
      <dc:creator>PamCotton</dc:creator>
      <dc:date>2023-10-23T22:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Add a redirect after booking a Meeting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Add-a-redirect-after-booking-a-Meeting/m-p/869003#M68480</link>
      <description>&lt;P&gt;Hi Pam, yes I am looking for something almost similar but I want to be able to dynamically redirect to different pages&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 05:13:09 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Add-a-redirect-after-booking-a-Meeting/m-p/869003#M68480</guid>
      <dc:creator>kinara</dc:creator>
      <dc:date>2023-10-24T05:13:09Z</dc:date>
    </item>
  </channel>
</rss>

