Jun 2, 2021 1:05 PM
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?
Jun 10, 2021 9:56 AM
Yes, I have a workaround for the meeting time in emails. However it does require access to the new Code action.
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);
});
}
Dec 15, 2021 1:47 AM
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
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?
Jan 12, 2022 2:38 PM
For the Data outputs field it should be "meeting" vs "meetingFormatted"
Data type: String
Name: meeting
Jul 23, 2021 6:39 PM
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!
Jan 12, 2022 2:19 PM
@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.
Jun 10, 2021 11:41 AM
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.
Jun 3, 2021 4:43 AM
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 ! |
Mar 18, 2022 2:27 PM
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.