V3 API sending email

I’m using the API to send email but it throw error “This app hasn’t been granted all required scopes to make this call. Read more about required scopes here”

hubspotClient.marketing.transactional.defaultApi.sendEmail({

  emailId: 'xxx',

  message: {

    from: 'xxx@gmail.com',

    to: 'aaa@gmail.com',

  },

});

Then, I followed this GitHub - HubSpot/hubspot-api-nodejs: HubSpot API NodeJS Client Libraries for V3 version of the API · GitHub and added

this API but it alerts ‘missing or unknown auth code’,

const clientId = ‘xxxx-xxxx-xxxx’;

const redirectUri = ‘www.xxx.com’;

const scope = ‘contacts’;

const uri = await hubspotClient.oauth.getAuthorizationUrl(

clientId,

redirectUri,

scope

);

hubspotClient.oauth.defaultApi

  .createToken(

    'authorization\_code',

    uri, // the code you received from the oauth flow

    redirectUri,

    clientId,

    'aaa-aaa-aaa'

  )

  .then((val) => console.log(val));

hubspotClient.marketing.transactional.defaultApi.sendEmail({

  emailId: 'xxx',

  message: {

    from: 'xxx@gmail.com',

    to: 'aaa@gmail.com',

  },

});

The OAuth is so confusing to implement

can anyone from Hubspot help me? Is there any example that I can use sendEmail API without using OAuth? It’s confusing to implement

@JNguyen3 , You will need to purchase the transactional email add on to send emails. Here is a link to get in touch with a HubSpot representative