I referred link Get started with serverless functions - HubSpot docs to create serverless function.
This is my hubspot.config.yml:
defaultPortal: HubSpot_Assignment
portals:
- name: HubSpot_Assignment
portalId: 8943172
authType: personalaccesskey
auth:
tokenInfo:
accessToken: >-
XXX
expiresAt: '2021-06-07T10:19:46.023Z'
personalAccessKey: >-
XXX
My congratulation.js file is as follows:
exports.main = (context, sendResponse) => {
// your code called when the function is executed
const functionResponse = "Congrats! You've just deployed a Serverless Function."
// sendResponse is a callback function you call to send your response.
sendResponse({body: functionResponse, statusCode: 200});
};
I tried to access this url https://api.hubapi.com/_hcms/api/congratulation
But I am getting
Page Not Found Error
on Browser
@DKachhawaha ,
You are loading the wrong address. It will be available under whatever domain your portal is using.
If your portal domain was example.com, it would be https://www.example.com>/_hcms/api/congratulation
Thanks for the solution.I am new to this platform.
Could you please tell me where can I find my domain name for my account.
And also the files which i created like javascript files or yml files are they to be created in IDE like VScode or in Design Manager of HubSpot Account
@DKachhawaha ,
This kb should get you to where your domain is located. If you haven’t set a domain up yet, when you get to the domains settings, it will be empty. Click on language settings and you will see it there.
As for the second question, I recommend using a local web development workflow when possible which I believe was advised in that doc that you referenced above. Here is another doc that explores it in more detail.
Good luck!