⚙ Operations Hub

ChrisChiha
Colaborador líder

Can I trigger an email through custom code action inside my workflow ?

Hello,
 
My current scenario requires triggering an email through my custom code. The normal "Send Email" action is not applicable in my scenario as this is a deal based workflow and i am fetching an email address from the deal so i can send him an email.
 
Noting : I have to use deal-based workflow as my email contains personalized tokens from the Deal object.
 
So far my custom code is working great. I am able to fetch the email addresses from the enrolled deals and i am storing them in variables in the code.
My question is, is there a way or a specific hubspot API that i can call in my code to trigger a "send email" action from my custom code to the fetched contact ?

(Ideally if contact-based workflow accepted emails with personalized tokens from deals, my scenario would be simple, but i need a workaround for this to work.)
 
I read about the Single Send API, but how is it possible to pass the to email address and email template id as parameters to this API ?
 
Thank you in advance !

4 Respuestas 4
ABeian
Participante

Can I trigger an email through custom code action inside my workflow ?

Hi! Are there any updates on this topic?

 

We too are interested in this feature. In our case using the associations labels is not viable because this feature is not "fluid" enough.

When creating a new contact there is no way to automatically add the association label, you must return to the Company / Deal page and add the label there.

As well, if you label one Contact-Deal association, the Contact-Company is not automatically assigned as well. So handling all this adds a lot of manual work.

 

Having a "label property" under the contact simplifies this and also makes report building smoother.

 

The final misisng piece is this thread's topic: how to send automated emails to specific contacts via custom code.

 

Any insight would be greatly appreciated!

0 Me gusta
ChrisChiha
Colaborador líder

Can I trigger an email through custom code action inside my workflow ?

hubspotClient.apiRequest({
method: 'POST',
path: `/email/public/v1/singleEmail/send?hapikey=${process.env.HAPIKEY}`,
body:
{
"emailId": 19597989,
"message": {
"to": `${customerEmail}`,
},
 
"customProperties": [
{
"name": "Bank",
"value": "Bank Name"
}
]
}
});
   
   
 
I would like to know specifically if i pass the properties this way, will the email body populate the personalization tokens. 
I would like to know if this works before finalizing any purchace on the transac addon. I don't have any access to test if my case works or not.
  
Scenario:
Deal has a property "country"
I can fetch this property to my custom code.
I need to pass this property in the body of my single send API, so that it will populate the country personalization token inside my email.
0 Me gusta
JenBergren
Guía

Can I trigger an email through custom code action inside my workflow ?

Thanks for the tag @JenWeiss ! A few of my team members have been digging into APIs recently so I'll tag them in to see if they have advice:
@jamesle @jspencerdav 


Thanks!
Jen Bergren
Human-Centered Operations Leader, HubSpot SuperFan, Instructional Design and Lifelong Learning Advocate
Connect with me on Linkedin
JenWeiss
HubSpot Employee
HubSpot Employee

Can I trigger an email through custom code action inside my workflow ?

Hi @ChrisChiha

 

Thank you so much for reaching out to us! 

 

I would like to tag some of our experts into this since they would be able to provide further insight @JenBergren , @warrendavey , and @Drew_Cohen

 

Best,

@JenWeiss 

Whether you're a student or a lifelong learner. Join StudentSpot to be inspired.