
Hello,
we are developing an integration between HubSpot and Asana using NodeJs
We start the test using a trial account (one workspace). The code below was working fine and we were able to retrieve templates using API:
async getTemplates( workspaces:Array<IAsanaBaseAnswer> ): Promise<Array<IAsanaBaseAnswer>> {
let templates:Array<IAsanaBaseAnswer> = [];
for (let i=0; i<workspaces.length; i++) {
const foundTemplates = await this.getAllByGid<IAsanaBaseAnswer>(workspaces[i].gid, this.requestTemplates.bind(this));
if (foundTemplates?.length) {
templates = templates.concat(foundTemplates);
} else {
await this.teamService.setUser(this.user);
const teams: Array<IAsanaBaseAnswer> = await this.teamService.getTeamsByWorkspace(workspaces[i].gid);
for (let k=0; k<teams.length; k++) {
const templatesByTeam: Array<IAsanaBaseAnswer> = await this.getAllByGid<IAsanaBaseAnswer>(teams[i].gid, this.requestTemplatesByTeam.bind(this));
if (templatesByTeam?.length) {
templates = templates.concat(templatesByTeam);
}
}
}
}
return templates.filter((el:IAsanaBaseAnswer, index:number, self:IAsanaBaseAnswer[]) =>
self.map((v:IAsanaBaseAnswer) => v.gid).indexOf(el.gid) === index
);
}
Then we started having clients who have organizations instead of one workspace. Unfortunately, the same code is not working.
I’m Admin on my account and I have all permissions. Everything seems OK but we are getting this error message:
{"errors":[{"message":"workspace: Not a valid regular workspace. You provided an organization. Check out https://asana.com/developers/api-reference/workspaces for the difference between workspaces and organizations.","help":"For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors"}]}
Could you please help?
Thank you in advance.
Lamine