email-apis

My client is using hubspot to send emails manually, so we want to do automatically through apis

My requirements:

can we send emails through apis ? As of my r&d we can send emails using api. /marketing/v3/transactional/single-email/send. if wrong correct me !

  1. Can we send emails with attachments ? As per my knowledge we there was not options to send attachments using apis we can send a download like through apis , correct me if I was wrong !
  2. Can we track emails we send through apis like delivered or not , email opened or not ? As per my r&d we can not track through apis, what are the alternatives we can track emails we send, my requirement is get the email status like delivered or not opened or not should be shown in mobile app and web browser is that possible ? So what are alternatives options ?
  3. Can we see list of emails send in your account ? As per my knowledge we can see the emails we send in hubspot marketing email section , is any api was there to check automatically ? Or any other alternatives was there ? If wrong correct me

What ever the email is marketing or transitional-email we want to send emails to client !

Please give reply as soon as possible !

Its better to connect a call with me if possible that helps me at lot

skype: psasikumar997@gmail.com

Thank you

Hey @sasikumar! Thanks for reaching out!

Yes, you can for sure send emails using our APIs! Here is the documentation on the different types of API emails you can send and how to get started. There are three different types you can send all detailed in the link above. Please note that the use of these APIs requires the transactional email add-on.

To answer your other questions, although you cannot see these emails in your email dashboard within your HubSpot portal. You can however use the Marketing Statistics API to get the statistics of your emails via API. On the left-hand side of that page linked above, you can view all of the other email API available to use.

Although I cannot call you. if you have a paid subscription you can reach out to our support team for more details on the above.

if i send emails using api

/marketing/v3/transactional/single-email/send

from where i can get

email_id

to check statistics ? GET /marketing-emails/v1/emails/with-statistics/:

email_id

while sending emails i was getting this error

{

status: ‘error’,

message: ‘Could not find email -- portalId: 4740883, emailId: 12323’,

correlationId: ‘4dda2ab2-d29f-4ea9-ac7e-293da5bcde04’,

sendResult: ‘MISSING_CONTENT’

}

console.log(‘here’)

/* https://www.npmjs.com/package/@hubspot/api-client */

var request = require(“request”);

var options = {

method: ‘POST’,

url: ‘https://api.hubapi.com/marketing/v3/transactional/single-email/send’,

qs: {

hapikey: ‘xxxxxxxxxx’

},

headers: {

accept: ‘application/json’,

‘content-type’: ‘application/json’

},

body: {

message: {

from: ‘kalyan.parise@appitventures.com’,

to: ‘sasi.kumar@appitventures.com’,

sendId: ‘1232’,

},

emailId: 12323

},

json: true

};

request(options, function (error, response, body) {

if (error) throw new Error(error);

console.log(body);

});

console.log(‘here’)

/* https://www.npmjs.com/package/@hubspot/api-client */

var request = require(“request”);

console.log(emailData, url,‘sddsds’)

return new Promise((resolve) => {

let options = {

method : ‘POST’,

url : `https://api.hubapi.com/email/public/v1/singleEmail/send?hapikey=e22ee213-b9dd-49b6-8535-4caxxxxx\`,

// url : `https://api.hubapi.com/email/public/v1/singleEmail/send?hapikey=${hapiKey}\`,

body: {

emailId: 2853049635,

message: {

to: emailData.email,

from: “kalyan.parise@appitventures.com

},

customProperties: {

value: `Your account has been created, please click on below link to setup your password.<br><br>

<a class=“ulink” href=“${url}” target=“_blank”>Set your password</a> <br><br>`

}

},

json: true

};

request(options, function (error, response, body) {

if (error) throw new Error(error);

console.log(body);

resolve(body)

});

})

}

for this code I was getting

this error

{

status: ‘error’,

message: ‘Invalid input JSON on line 1, column 131: Cannot deserialize instance of `java.util.ArrayList` out of START_OBJECT token’,

correlationId: ‘e45f33d3-c140-4dbf-895c-f29f29208408’

}