Sometimes you don't want to rely on Smartify native assignment logic, that is a round-robin algorithm through the available agents in a specified department.
Suppose that you want to assign a request (and the corresponding conversation) to a specific agent. You can implement your own logic using webhooks.
Create your webhook project
1
Fork the example application
Go to Replit and fork the following app: https://replit.com/@tiledesk/agent-handoff#index.js
This app will receive webhook events from Smartify and implement the custom assignment logic.
2
Create a new project in Tiledesk
Create a new project in Smartify (for example: "Custom routing").
Create project screenshot
3
Configure webhooks for the project
Go to Settings > Project Settings > Developer and click on "MANAGE WEBHOOK".
Manage webhook screenshot
Add a new webhook whose endpoint matches your forked Replit application's endpoint followed by /webhooks.
Make sure to use your application endpoint so you can modify the code as needed.
Add webhook screenshot
Create the subscription.
4
Create and attach a bot
Go to the Bots section and create a new bot. Choose "Resolution" as the bot type.
Create bot screenshot
Name it as you prefer, create it and press "Activate" when asked. This will attach the new chatbot to the Default Department and make the bot immediately available to end users.
Activate bot screenshot
Leave all settings on default.
5
Switch department routing to Pooled
Go to "Routing & Departments".
Routing & Departments screenshot
Select the "Default department" and change the Routing rules from the default "Assigned" to the "Pooled" mode.
Change routing to pooled screenshot
6
Test the behavior
When a request is updated, your web application will receive a "request.update" event. The example code checks if no participants are present in the conversation. If participantsAgents[] is empty, the request is in the Unassigned queue (the "pool"). The code then queries teammates and selects the first one to assign the request. You can replace this logic with your own assignment algorithm.
Example assignment screenshot
Self hosted installation
The API_ENDPOINT variable in the source code points to the Smartify cloud by default.
If you installed Smartify using the Docker compose distribution, use one of these values for your API_ENDPOINT var:
On localhost:
API_ENDPOINT = localhost/api/
On your own server:
API_ENDPOINT = ${YOUR_SERVER_HOST}/api/
You can find more on the Docker installation endpoints here: https://github.com/Tiledesk/tiledesk-deployment/blob/master/docker-compose/README.md#service-endpoints
Last updated 2 years ago
For reference: agent-handoff example on Replit — https://replit.com/@tiledesk/agent-handoff#index.js
Create your project, webhook, bot and change the routing to pooled to enable custom assignment via your webhook.