Sales Email

matteomont
Participant

token to display meeting scheduled (day + time)

Hi there, 

 

I'd like to add a token to the email template to display date and time of meeting scheduled by sales agent. 

 

I only found  the token "Contact: Date of last meeting booked in meetings tool" , but it works only for the meeting scheduled through the meeting tool. It doesn't work when the meeting is manually scheduled by a sales agent. 

Morevoer it doesn't display the time of the meeting, the date only. 

 

Any solution?

ndwilliams3
Key Advisor

token to display meeting scheduled (day + time)

Yes, I have a workaround for the meeting time in emails. However it does require access to the new Code action.

  1. Create a new "single line text property "Meeting Time"
  2. Create a Workflow "Meeting Time Formatter"
    • Trigger: Date of last meeting is known and enable re-enrollment 
    • Action: Code
      • const hubspot = require('@hubspot/api-client');
        
        exports.main = (event, callback) => {
          const hubspotClient = new hubspot.Client({
            apiKey: process.env.HAPIKEY
          });
          hubspotClient.crm.contacts.basicApi.getById(event.object.objectId, ["email", "engagements_last_meeting_booked"])
            .then(results => {
              let email = results.body.properties.email;
              let meeting = results.body.properties.engagements_last_meeting_booked;
              let meetingDate = new Date(meeting);
              let meetingFormatted = meetingDate.toLocaleString('en-us', { weekday: 'long', year: 'numeric', month: 'long', day: '2-digit', hour: 'numeric', minute: 'numeric', hour12: 'true', timeZone: 'America/Chicago', timeZoneName : 'short'  });
              callback({
                outputFields: {
                  email: email,
                  meeting: meetingFormatted,
                }
              });
            })
            .catch(err => {
              console.error(err);
            });
        }
        
      • Change the timeZone parameter (America/Chicago) in the code to the time zone to your preferred location. 
      • Under the data outputs, define a new output Data Type = String, Name = meetingFormatted
    • Action: Copy Property Value
      • Property or value to copy from = custom code, meetingFormatted
      • Target property type = Contact
      • Property to copy "meetingFormatted" to = Meeting Time
  3. Use "Meeting Time" property in your email. Keep in mind it does default to the set timezone set in the code and not the contacts timezone. The formatted time does include the timezone for reference, ie Thursday, June 10, 2021, 2:00 PM CDT
SCheong
Participant

token to display meeting scheduled (day + time)

Hi Noel, 

 

This is a great workaround and I'm trying to implement it. However, I've got this error which is basically "Unable to update property" even after following your steps. 

 

For property to use in the code, I've selected: 

engagements_last_meeting_booked

email

 

For output: 

Data type: String

Name: meetingFormatted

 

Here's the code that I've inserted: 

 

const hubspot = require('@hubspot/api-client');

exports.main = (event, callback) => {
  const hubspotClient = new hubspot.Client({
    apiKey: process.env.HAPIKEY
  });
  hubspotClient.crm.contacts.basicApi.getById(event.object.objectId, ["email", "engagements_last_meeting_booked"])
    .then(results => {
      let email = results.body.properties.email;
      let meeting = results.body.properties.engagements_last_meeting_booked;
      let meetingDate = new Date(meeting);
      let meetingFormatted = meetingDate.toLocaleString('en-us', { weekday: 'long', year: 'numeric', month: 'long', day: '2-digit', hour: 'numeric', minute: 'numeric', hour12: 'true', timeZone: 'Australia/Melbourne', timeZoneName : 'short'  });
      callback({
        outputFields: {
          email: email,
          meeting: meetingFormatted,
        }
      });
    })
    .catch(err => {
      console.error(err);
    });
}

 

Wonder if there's anything I've missed?

0 Upvotes
ndwilliams3
Key Advisor

token to display meeting scheduled (day + time)

For the Data outputs field it should be "meeting" vs "meetingFormatted"

 

Data type: String

Name: meeting

 

0 Upvotes
sweas
Participant

token to display meeting scheduled (day + time)

This is amazing @ndwilliams3 !

 

I was thinking about how one might convert the meeting time to the contact's local time using the 'IP timezone' property.

 

I am admittedly out of my depth when it comes to modifying the brilliant snippit you dropped in up there, but thought I woukd mention it incase you wanted to noodle on cacluating the output based on that Contact property.

 

Much appreciated!

0 Upvotes
ndwilliams3
Key Advisor

token to display meeting scheduled (day + time)

@sweas, It has potential! The format of IP timezone doesn't match the required format, but it's close enough that you could format america_slash_chicago to America/Chicago. There are some challenges to this method where it might not be correct. 1) VPN's 2) ISP location.

0 Upvotes
matteomont
Participant

token to display meeting scheduled (day + time)

Thanks for sharing this @ndwilliams3 

 

Unfortunately, my license doesn't include operation hub at the moment. 

Anyway, I hope your code will help somebody else. 

Just one thing for a better understanding, when you say "Trigger: Date of last meeting is known and enable re-enrollment" do you mean the "Date of last meeting booked in the meetings tool" property?  If no, can you please clarify where I can find the property you mentioned? 

Thanks in advance.

0 Upvotes
TiphaineCuisset
Community Manager
Community Manager

token to display meeting scheduled (day + time)

Hi @matteomont 

 

Thank you for reaching out. 

 

I don't see a HubSpot-out-of-the-box solution for this but I want to tag some of our experts on this - @Josh @GeorgeBThomas @ndwilliams3  do you have any workarounds you can think of for @matteomont on this? 

 

Thank you!

Best

Tiphaine


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


tobiasn
Participant

token to display meeting scheduled (day + time)

Hi! I'm searching for an out of the box solution to this problem myself - it seems a bit mad that inserting a timestamp in an email needs extra subscriptions and custom code. Grateful if you know about any solutions. 

0 Upvotes