What is the best way to assign incoming task (SMS, call, chat) to a person based on custom logic? - twilio

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.

Related

Access call history in app for Microsoft Teams

While it seems it is not possible for an app to register incoming calls, I wondered if it would be possible to access the call history of the current user?
It looks like there is a Graph API to get information of a specific call by id, I didn't find anything about getting the call history or the last call.
This could be a workaround for our approach: We want to enable the employees to make several notes on incoming calls and reference them with existing items in another web application.
Is there any way to achieve what I'm trying to do?
There seems to be a new Preview way of and application subscribing to a call event though still no way to get the full history.
Application
CallRecords.Read.All:
Subscribe to new call records (POST /beta/subscriptions).
There are more details here https://learn.microsoft.com/en-us/graph/cloud-communications-callrecords but it suggests you could capture the incoming call and allow notes as you want.

Wait for response from ui in ABAP Odata

I am trying to make an ABAP OData, that receive a request, does some calculation, then, should return a message to the End User and make an decision based on the user input. So basically, the OData service should be put "on hold", before its receives a response.
Does anyone have a good idea?
Appreciate your response.
Regards!
OData is a special kind of REST. REST is stateless. What you want is stateful.
The good way to do turn this stateful flow into a stateless one is:
Send a first request (REST: POST, OData: CREATE) that creates and saves(!) a document that represents the calculation and its result. That first request may return the calculation's result to be presented to the user.
The user's choice then sends a second request that addresses the previously created document (e.g. via a GUID) and includes the user's choice. This means the second request neither has to send the computation input again, nor does it actually perform any calculations; it only changes the existing object's state.
If the calculation is not needed anymore afterwards, that second request may delete it. To prevent data leakage, removing older calculations after a time limit (e.g. 24h) may be a wise move.

How to enable Watson conversation service to use your own database for serving user's request

I want to build a smart search agent which would use Watson conversation to process the request and give response but will use my own database say SQL server to search the desired output.
In Short Instead of writing intents and dialogues manually or importing from a csv file, I want to write my won code in .net in such a way that all the request and responses are influenced by my own data stored in my database. I only intent to use watson's processing and interpreting capability. But the processing must happen on my data.
E.g If the user searches for a word say "Dog", the Watson conversation service must search in my database and give relevant answers to the user based on the search.
Take a look at the solution architecture in the Watson Conversation documentation. Your database would be one of the depicted backend systems. Your application would be, as you mentioned, written in .NET and would use WCS to process the user input. It would return a response with all the associated metadata. Instead of having complete answers configured in a dialog, you would use something I have described as "replaced markers" in my collection of examples. Those markers are kind of hints to your application of which database query or which action to perform.
Note that WCS requires some intents and entities to work on. If you want to rely just on the detected intents and entities, you could work with one or two generic dialog nodes. As another technique you could use data from your database to generate intents and entities as an initial setup. In my "Mutating EgoBot" I use the Watson Conversation API to add intents and entities on the fly.
I believe you should use the standard trick:
instead of defining resposnses in the node of your diaglog, define an action on the output object of the node and let your applicatation take care of providing response (see https://console.bluemix.net/docs/services/conversation/develop-app.html#building-a-client-application)

Recommended Structure for Twilio Rails project?

What is the best structure for this Twilio project?
Phone numbers are POSTed and stored to be dialed at a later time (to be triggered by cron)
I have a controller to accept incoming POST requests and add the numbers to the database.
I also have a rake task (called via CRON) that pulls all the numbers that need to be dialed.
Where should I place the method for making the actual call? Right now I have it in a controller, would it be better to have it as a module or a plugin?
I use a controller to handle the twilio api calls, but my model contains the methods to actually send the calls.
If someone feels like they need an example, I'd suggest you check out the Twilio tutorials. Full disclosure: I work for Twilio.
In the automated survey Rails example, we demonstrate a call flow using <Say>, <Record>, and <Gather> TwiML verbs. And we show you how to maintain conversation state in a database that spans multiple webhook requests.
Hopefully seeing how we've structured our app will help you get started on your own.
I would put it in a model or a lib.
Could it be part of the model that the number is stored in? A Number#dial method perhaps?

Trouble with react final form FieldArray, listeners and displaying data from api call outside of form

I want to trigger an API call to fetch some supplemental data and display it alongside my react final form. What's the best way to do this?
I've started by using OnChange from react-final-form-listeners to listen for a field change and make an API call, but I don't really know how to store this data somewhere and display it within the react-final-form framework. Using a functional component and a State hook, it would be relatively trivial, because I would just set the state of a variable and then display it somewhere in the same component. Is this a sign that I should be storing these kinds of things in redux? Can I use hooks instead?
I forked one of the examples and added what I am trying to do:
https://codesandbox.io/embed/react-final-form-field-arrays-k9pqm
You're talking a little too abstractly about your goal here, but sure, you could keep the loaded data in state with a useState() hook. If I were you, I'd want to debounce it, and keep track of whether or not the Promise from your API call was the Promise from the last call or not.

Resources