<?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 Hubspot make use of pop-up email in contacts in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-make-use-of-pop-up-email-in-contacts/m-p/1001267#M74780</link>
    <description>&lt;P&gt;Can anyone help me here? I have been stuck with this problem for 3 days. I joined the Slack community for help, but no one has responded.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an issue with the pop-up email in contacts. I asked if this is possible, and I was told it is, but I keep getting error codes that I can't resolve. I am creating a customized CRM card using the existing template from the command "hs project create." What I really want is a button that, when clicked, will open the pop-up email interaction/email editor in HubSpot contacts and copy the subject and body that I want to send in the email.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot from 2024-07-03 10-32-08.png" style="width: 999px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/121177i5CFFBA631E3109D6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot from 2024-07-03 10-32-08.png" alt="Screenshot from 2024-07-03 10-32-08.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here is what i did so far:&lt;BR /&gt;i have this file : Example.jsx&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import React, { useState, useEffect } from "react";
import {
  Button,
  hubspot,
} from "@hubspot/ui-extensions";

// Define the extension to be run within the Hubspot CRM
hubspot.extend(({ context, runServerlessFunction, actions }) =&amp;gt; (
  &amp;lt;Extension
    context={context}
    runServerless={runServerlessFunction}
    sendAlert={actions.addAlert}
  /&amp;gt;
));


const Extension = ({ context, runServerless, sendAlert }) =&amp;gt; {
  const [loginState, setLoginState] = useState({
    token: null,
    personId: null,
    workEmail: null,
  });

  const handleSendEmail = async (email) =&amp;gt; {
    try {
      const { response } = await runServerless({
        name: "emailEditor",
        parameters: {
          subject: "test subject",
          body: "test body",
          to: [{ email: email }],
        },
      });
    } catch (error) {
      console.error("Error opening email editor:", error);
    }
  };

  return (
    &amp;lt;Button
      type="submit"
      onClick={() =&amp;gt; handleSendEmail(email)}
      variant="destructive"
    &amp;gt;
      Send Email
    &amp;lt;/Button&amp;gt;
  );
};

export default Extension;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then i have a file on the app.functions:&lt;/P&gt;&lt;P&gt;open-email-editor.js:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;const hubspot = require("@hubspot/api-client");
require("dotenv").config();

exports.main = async (context = {}) =&amp;gt; {
  const { subject, body, to } = context.parameters;
  const hubspotToken = process.env.PRIVATE_APP_ACCESS_TOKEN;

  const hubspotClient = new hubspot.Client({
    accessToken: hubspotToken,
  });

  console.log(hubspotClient);

  try {
    await context.actions.openEmailEditor({
      subject,
      body,
      to,
    });

    return {
      statusCode: 200,
    };
  } catch (error) {
    console.error("Error opening email editor", error);

    return {
      statusCode: error,
    };
  }
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error opening email editor TypeError: Cannot read properties of undefined (reading 'openEmailEditor')&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;I really ran out of idea on how to do this. I am hoping to someone who could help to find a solution with my problem.&lt;BR /&gt;&lt;BR /&gt;Here is my serverless.json:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "appFunctions": {
    "myFunc": {
      "file": "example-function.js",
      "secrets": []
    },    
    "emailEditor": {
      "file": "open-email-editor.js",
      "secrets": []
    },
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Jul 2024 08:18:03 GMT</pubDate>
    <dc:creator>JMacasero</dc:creator>
    <dc:date>2024-07-05T08:18:03Z</dc:date>
    <item>
      <title>Hubspot make use of pop-up email in contacts</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-make-use-of-pop-up-email-in-contacts/m-p/1001267#M74780</link>
      <description>&lt;P&gt;Can anyone help me here? I have been stuck with this problem for 3 days. I joined the Slack community for help, but no one has responded.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an issue with the pop-up email in contacts. I asked if this is possible, and I was told it is, but I keep getting error codes that I can't resolve. I am creating a customized CRM card using the existing template from the command "hs project create." What I really want is a button that, when clicked, will open the pop-up email interaction/email editor in HubSpot contacts and copy the subject and body that I want to send in the email.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot from 2024-07-03 10-32-08.png" style="width: 999px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/121177i5CFFBA631E3109D6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot from 2024-07-03 10-32-08.png" alt="Screenshot from 2024-07-03 10-32-08.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here is what i did so far:&lt;BR /&gt;i have this file : Example.jsx&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import React, { useState, useEffect } from "react";
import {
  Button,
  hubspot,
} from "@hubspot/ui-extensions";

// Define the extension to be run within the Hubspot CRM
hubspot.extend(({ context, runServerlessFunction, actions }) =&amp;gt; (
  &amp;lt;Extension
    context={context}
    runServerless={runServerlessFunction}
    sendAlert={actions.addAlert}
  /&amp;gt;
));


const Extension = ({ context, runServerless, sendAlert }) =&amp;gt; {
  const [loginState, setLoginState] = useState({
    token: null,
    personId: null,
    workEmail: null,
  });

  const handleSendEmail = async (email) =&amp;gt; {
    try {
      const { response } = await runServerless({
        name: "emailEditor",
        parameters: {
          subject: "test subject",
          body: "test body",
          to: [{ email: email }],
        },
      });
    } catch (error) {
      console.error("Error opening email editor:", error);
    }
  };

  return (
    &amp;lt;Button
      type="submit"
      onClick={() =&amp;gt; handleSendEmail(email)}
      variant="destructive"
    &amp;gt;
      Send Email
    &amp;lt;/Button&amp;gt;
  );
};

export default Extension;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then i have a file on the app.functions:&lt;/P&gt;&lt;P&gt;open-email-editor.js:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;const hubspot = require("@hubspot/api-client");
require("dotenv").config();

exports.main = async (context = {}) =&amp;gt; {
  const { subject, body, to } = context.parameters;
  const hubspotToken = process.env.PRIVATE_APP_ACCESS_TOKEN;

  const hubspotClient = new hubspot.Client({
    accessToken: hubspotToken,
  });

  console.log(hubspotClient);

  try {
    await context.actions.openEmailEditor({
      subject,
      body,
      to,
    });

    return {
      statusCode: 200,
    };
  } catch (error) {
    console.error("Error opening email editor", error);

    return {
      statusCode: error,
    };
  }
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error opening email editor TypeError: Cannot read properties of undefined (reading 'openEmailEditor')&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;I really ran out of idea on how to do this. I am hoping to someone who could help to find a solution with my problem.&lt;BR /&gt;&lt;BR /&gt;Here is my serverless.json:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "appFunctions": {
    "myFunc": {
      "file": "example-function.js",
      "secrets": []
    },    
    "emailEditor": {
      "file": "open-email-editor.js",
      "secrets": []
    },
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2024 08:18:03 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-make-use-of-pop-up-email-in-contacts/m-p/1001267#M74780</guid>
      <dc:creator>JMacasero</dc:creator>
      <dc:date>2024-07-05T08:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot make use of pop-up email in contacts</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-make-use-of-pop-up-email-in-contacts/m-p/1001503#M74788</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/779645"&gt;@JMacasero&lt;/a&gt;, &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for your question! Let's consult our experts to see if they have any suggestions for you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/166093"&gt;@miljkovicmisa&lt;/a&gt;&lt;SPAN&gt;, &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/241684"&gt;@ChrisoKlepke&lt;/a&gt;&amp;nbsp;, &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/133"&gt;@stefen&lt;/a&gt;, do you happen to have any ideas that could help &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/779645"&gt;@JMacasero&lt;/a&gt;&amp;nbsp;with their goal?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you all for contributing.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Noémi&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 14:22:17 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-make-use-of-pop-up-email-in-contacts/m-p/1001503#M74788</guid>
      <dc:creator>NOlah</dc:creator>
      <dc:date>2024-07-08T14:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot make use of pop-up email in contacts</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-make-use-of-pop-up-email-in-contacts/m-p/1001889#M74803</link>
      <description>&lt;P&gt;Thank you for your response, &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/318167"&gt;@NOlah&lt;/a&gt;. I hope the tagged persons can help me.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2024 01:36:19 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-make-use-of-pop-up-email-in-contacts/m-p/1001889#M74803</guid>
      <dc:creator>JMacasero</dc:creator>
      <dc:date>2024-07-08T01:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Hubspot make use of pop-up email in contacts</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-make-use-of-pop-up-email-in-contacts/m-p/1139377#M81709</link>
      <description>&lt;P&gt;Has there been an answer for this? I'm needing to do the very same thing. I've been going between chatgpt, claude and others but they are all are hallucinating quite badly and it seems like this would be a pretty standard use case (opening the email editor and providing pre-populated subject and body content).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 02:48:38 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Hubspot-make-use-of-pop-up-email-in-contacts/m-p/1139377#M81709</guid>
      <dc:creator>dmp</dc:creator>
      <dc:date>2025-04-23T02:48:38Z</dc:date>
    </item>
  </channel>
</rss>

