APIs & Integrations

Yannick_Lange
Member

sending email using custom code workflow action on developer account

SOLVE

I am trying to send an email using a custom code action in a workflow, because I want to add a cc to the email. The request seems correct, but I get a forbidden message. I am on a developer account and I am not really sure if the developer account supports doing this or is my code incorrect?

 

  const emailData = {
    emailId: 104023995106,
    message: {
      to: "myemail@gmail.com",
    },
    contactProperties: {},
    customProperties: {}
  }

  const response = await hsClient.apiRequest({
      method: 'POST',
      path: '/marketing/v3/transactional/single-email/send',
      body: emailData,
      headers: {
        'Content-Type': 'application/json'
      },
      defaultJson: true
  });

 

response:

 

{
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]: {
    body: Gunzip {
      _writeState: [Uint32Array],
      _events: [Object],
      _readableState: [ReadableState],
      _writableState: [WritableState],
      allowHalfOpen: true,
      _maxListeners: undefined,
      _eventsCount: 5,
      bytesWritten: 0,
      _handle: [Zlib],
      _outBuffer: <Buffer bb 28 00 00 00 49 bc 40 da 28 af 09 56 00 00 41 ff 95 50 4c 00 00 50 50 4c 8b 45 f8 49 8b 40 2f 49 3b 85 98 01 00 00 0f 85 24 00 00 00 48 8b 75 f8 49 ... 16334 more bytes>,
      _outOffset: 0,
      _chunkSize: 16384,
      _defaultFlushFlag: 2,
      _finishFlushFlag: 2,
      _defaultFullFlushFlag: 3,
      _info: undefined,
      _maxOutputLength: 4294967296,
      _level: -1,
      _strategy: 0,
      [Symbol(shapeMode)]: true,
      [Symbol(kCapture)]: false,
      [Symbol(kCallback)]: null,
      [Symbol(kError)]: null
    },
    disturbed: false,
    error: null
  },
  [Symbol(Response internals)]: {
    url: 'https://api.hubapi.com/marketing/v3/transactional/single-email/send',
    status: 403,
    statusText: 'Forbidden',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
}

 

Thanks in advance!

0 Upvotes
2 Accepted solutions
Teun
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

sending email using custom code workflow action on developer account

SOLVE

Hi @Yannick_Lange ,

 

The 403 error indicates that there is something wrong with the authorization. That can either mean that your authorization token is expired, has the incorrect scope or that your current account has no access to the transactional email add-on.

Based on the docs, it should be possible to add a CC to the single-send API. You can add it to the message object in your example.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


View solution in original post

0 Upvotes
ABeian
Solution
Contributor

sending email using custom code workflow action on developer account

SOLVE

Hello,

 

I don't have first hand experience with this exact case, so please take my message with a grain of salt!

If the code itself has no faults, then the exact account(s) setup might be the issue.
Based on the documentation about the different HubSpot account types, it seems that:

(1) Any app (a custom code bit) that you build inside a "Developer Account" can then be deployed in either a "Standard Account" or a "Developer TEST Account"

(2) If you wish to deploy your custom code as a workflow action in a "Standard Account", then you need to be sure the transactional email add-on is enabled
   * this setup should allow you to test the custom code on any given Contact entry that has an email address

(3) You can opt to instead test your custom code in a "Developer TEST Account", but there are some limitations such as needing to ask support to enabled the add-on and also only being able to target email addressed that are added as users into that account

Hope this will help at least a little bit!

View solution in original post

0 Upvotes
3 Replies 3
ABeian
Solution
Contributor

sending email using custom code workflow action on developer account

SOLVE

Hello,

 

I don't have first hand experience with this exact case, so please take my message with a grain of salt!

If the code itself has no faults, then the exact account(s) setup might be the issue.
Based on the documentation about the different HubSpot account types, it seems that:

(1) Any app (a custom code bit) that you build inside a "Developer Account" can then be deployed in either a "Standard Account" or a "Developer TEST Account"

(2) If you wish to deploy your custom code as a workflow action in a "Standard Account", then you need to be sure the transactional email add-on is enabled
   * this setup should allow you to test the custom code on any given Contact entry that has an email address

(3) You can opt to instead test your custom code in a "Developer TEST Account", but there are some limitations such as needing to ask support to enabled the add-on and also only being able to target email addressed that are added as users into that account

Hope this will help at least a little bit!

0 Upvotes
Teun
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

sending email using custom code workflow action on developer account

SOLVE

Hi @Yannick_Lange ,

 

The 403 error indicates that there is something wrong with the authorization. That can either mean that your authorization token is expired, has the incorrect scope or that your current account has no access to the transactional email add-on.

Based on the docs, it should be possible to add a CC to the single-send API. You can add it to the message object in your example.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
BérangèreL
Community Manager
Community Manager

sending email using custom code workflow action on developer account

SOLVE

Hi @Yannick_Lange,

Thank you for asking the Community!

I'd like to put you in touch with some of our Top Experts and Community Members: Hi @ChrisChiha, @ABeian, @JenBergren and @jgranados do you have suggestions to help @Yannick_Lange, please?

Thank you so much and have a lovely day!

Best,
Bérangère


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!


0 Upvotes