I need to create a rule in Twilio Flex to assign incoming calls, SMS, chat messages to different people based on a custom rule in our existing system, e.g. make a GET request to our backend and decide based on the returned response.
Is this possible to implement with Twilio Flex? What is the best way to do it?
I would prefer to keep as much logic as possible on our server, to avoid all the button clicking and drag&dropping widgets around and to keep it in VCS.
I solved the problem by using a Twilio Function in Studio.
When a call comes in to Studio, it makes an API call via the function that returns some custom JSON data (e.g. assignedWorkerEmail). Then I can pass this data to the Send To Flex widget, which adds that data to its task's attributes. Further routing within Flex happens based on the task attributes.