Assign a conversation to a specific agent/teammate

To assign a conversation to a particular agent, you can use the special Operator selection webhook:

On every assignment the webhook is called. You can apply your own logic and call Tiledesk APIs to choose the right operator to assign the conversation to.

Use this simple replit application that implements some simple logic to assign the conversation to a specific teammate.

This is the main code, the webhook endpoint:'/webhooks', (req, res) => {
  if (req.body.hook.event === '') {
    const payload = req.body.payload;
    const projectId = payload.project._id;
    const token = req.body.token;
    const tdclient = new TiledeskClient({projectId:projectId, token:token, APIURL: API_ENDPOINT, APIKEY: "___"});
    tdclient.getTeam((err, teammates) => {
      console.log("teammates:", teammates);
      payload.operators = [{id_user: teammates[0].id}];

You can also use the newly added user-tags to implment some sort of “skill-based” routing.

Hope this helps


1 Like

Thank you I used this as reference for the Dialogflow Fullfilment and Tiledesk Cloud