Grab and set Follow up Email from Hubspot API


#1

Hello,

I am trying get follow up emails in a form working from a .net website.

First how do I get the list of the emails to display on my website. and second how do I submit the form with it.
We call the workflow API to get the List of the Workflows, but I don’t see anything similar to the workflow api for the emails.

below is javascript we use create and submit the form.

hbspt.forms.create({
sfdcCampaignId: ‘<% = this.SfdcCampaignId %>’,
portalId: ‘<% = this.PortalId %>’,
formId: ‘<% = this.FormId %>’,
submitButtonClass: ‘hbspt-submit-button’,
inlineMessage: ‘<% = this.InlineMessage %>’,
redirectUrl: ‘<% = this.RedirectUrl %>’,
onFormReady($form, ctx) {

            var json = document.createElement('input');
            json.type = 'hidden';
            json.name = "jsonValues";
            json.value = '<%= this.GetJsonValues() %>';
            $form.children('form').append(json);
            //$('input.hs-input[value]').val('');
        },
        onFormSubmit: function ($form) {
            var f = $('.hbspt-form form');
            var jsonData = $form[0].lastChild;
            $.ajax({
                url: '/api/integration/HubSpotPost',
                type: 'POST',
                contentType: 'application/x-www-form-urlencoded',
                data: $(jsonData).serializeArray()
            });
        }

thanks

John


#2

Hi @Zheng_Li,

Follow-up emails can only be created in the UI for a specific landing page. It’s not possible to select/send a follow up email by customizing the embed code. If you have access to workflows, you can create a workflow in-app to send an email based on the form submission:


#3

I'm also looking for a solution to this, I've got to the point where I can get a follow up email to work but as well as getting the follow up email ID (through the follow up email field in custom modules) I need the "Internal HubSpot ID" (found on the email performance page in the "See Details" popout

The following code therefore works:

hbspt.forms.create({
portalId: '',
formId: '',
followUpEmailId: ,
followUpEmailCampaignId: ,
inlineMessage: "",
target: '#myID',
});

What I want however is to get the the Internal Hubspot ID of the selected email automatically