Automation of Tags on Tasks

Automation of Tags on Tasks

I have written a deluge custom function

  1. endPoint = "https://projects.zoho.com/api/v3/portal/";
  2. tagsParam = Map();
  3. tagsParam.put("tag_id","2342963000000148480");
  4. tagsParam.put("entity_id",taskid);
  5. tagsParam.put("entityType",5);
  6. url1 = endPoint + portalId + "/projects/" + projectId + "/tags/associate";
  7. response = invokeurl
  8. [
  9. url :url1
  10. type :POST
  11. parameters:tagsParam
  12. connection:"cdzohoprojectstasks"
  13. ];
  14. return response;
When I run the custom function and provide the task ID. 

I get this

  1. {"error":{"status_code":"401","instance":"/api/v3/portal/858012919/projects/2342963000000148005/tags/associate","title":"INVALID_OAUTHSCOPE","error_type":"FIELDS_VALIDATION_ERROR","details":[{"message":"Invalid OAuth scope."}]}}
As this is my first custom function I understand what it is saying I think. I suspect that one of my mapped params is wrong. Any direction can be helpful.