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!