This example walks you through setting up a Function API that automatically creates a task in Zoho Connect whenever a ticket is created in Zoho Desk. Function API acts as a bridge between the two applications, transforming the data sent by Zoho Desk into a format that Zoho Connect can process.
Click the gear icon [] from the right menu, then select Settings.
Under Developer Space, click Function API.
On the Function API page, click Configure.
Click Save & edit code.

Click the gear icon [] from the right menu, select Settings.
Under Developer Space, click Connections.
Click New Connection.
Select Zoho Connect as the service.
Select the required scopes and authorize the connection.
Click Create And Connect.
Repeat the same steps to create a connection for Zoho Desk.
The connection name you enter must match the connection name used in the custom function code. In this example, the connection name is zconnect.Click Expand next to Handlers.
Click Write function under Get Request Handler.
In the function editor, enter the following code:
- returnMap = Map();
return returnMap;
Click Write function under Post Request Handler.
In the function editor, enter the following code:
- payloadArray = list(body);
- ticket = payloadArray.get(0);
- ticketPayload = ticket.get("payload");
- desc = ticketPayload.get("description");
- subject = ticketPayload.get("subject");
- response = invokeurl
- [
- url :"https://connect.zoho.in/pulse/api/addTask"
- type :POST
- parameters:{"scopeID":22***740*******028,"boardId":228174000000075004,"title":subject,"desc":desc,"sectionId":228174000000075009,"position":1}
- connection:"zconnect"
- ];
- info response;
- return {"statusCode":"201","response":"Task Created Successfully"};
Click Save.

Click Expand next to API endpoint.
Click Generate URL.
Copy the generated URL.
Log in to Zoho Desk, then click the gear icon.
Under Developer Space, click Webhooks.
Enter the required details:
Name - Enter a name for the webhook.
URL to notify - Paste the API endpoint URL copied from Zoho Connect.
Event - Select Tickets and choose Add as the trigger.
Click Save
The Function API setup is now ready. Whenever a ticket is created in Zoho Desk, a new task will be created in Zoho Connect.
If you have any questions related to function API, write to us at support@zohoconnect.com. We're happy to help!