What if the Twilio Browser Client user is afk? How to change a Ready device to Not Ready? - twilio

I must be missing something.
I've successfully set my web page so that the browser is ready to receive incoming calls using the code from the Twilio QuickStart guides, but I wanted to give my user the ability to set their status to "Not Ready to Take Calls" if they're afk for example.
Is there a way to do this?
I've looked at the documentation and the closest thing I can find is:
Twilio.Device.disconnectAll();
But disconnectAll doesn't prevent incoming calls.
I'm wanting something like the ability to set Presence but there's only a method to register a callback when a Client's Presence changes:
Twilio.Device.presence(function(presenceEvent) {...});
And Presence currently only changes when a Client is on another call. I want the Client to be able to set Presence to a state that means incoming calls aren't directed to it.

Related

Twilio: Webhook not calling specified URL on phone number

Setting up to respond to SMS replies. I've gone to my Active Numbers page, selected the number (I only have one), gone to the Messaging Service section (again only one service) and in "A message comes in", I've specified the URL of one of our HTTP Handlers. It's a .Net Core handler that we use all the time. It will try to process anything sent to its URL:
https://ourserver/lmw/core/filemanager?SC=SMS
I send an SMS message to my personal number, reply "Help", and send that. Nothing hits that URL. I have it in the debugger and it catches anything I send it. It just doesn't get hit by the reply to the SMS message.
What am I doing wrong?.. or did I misunderstand how this works?
EDIT:
I found an "Integration" section in the Messaging Service. It was set to "Defer to sender’s webhook"... which sounds right but I changed it to "Send a webhook -- Invoke an HTTP webhook for all incoming messages"... which sounds like the same thing. Anyway, it didn't change a thing. I'm still not receiving a post on the http handler.
Please note that "Help" is a special keyword when using messaging services.
According to the Twilio Help Center:
Twilio does not forward HELP/INFO messages to your incoming message webhook by default. However, if you use Advanced Opt-Out for Messaging Services, Twilio does forward HELP/INFO requests to your inbound webhook.
This is not a good answer but I wanted to close this out. I started over and released my phone number and bought a new one. I went to Active Numbers and selected the new phone. In "A message comes in", I put my webhook url in both primary and primary fails and saved that.
I then went to Messaging, Services, and selected my service. In Integration, I clicked "Defer to sender's webhook" and then put the handler url in "Callback URL" and saved that.
I went to compliance and the first two were done but 3. Campaign Use Case was incomplete. I completed that.
In Opt-out management, I edited that and put in some of my own text.
After doing all this, I replied to the message and got a response in the handler. Not sure which one of these was the problem but doing it all over seemed to work. Sorry I can't provide a better insight.

How to send user identification when a user interacts with an adaptive card in a Teams Message

We are using the graph API to send a message to the General channel of a Microsoft Team, which has a number of members.
We would like to allow any members to interact with the message via an adaptive card.
This is doable using say Action.OpenUrl or .Submit, however we need to know which user it is which is interacting. I imagine this must be a fairly common thing to do.
What solutions and options are available to do this?
For example, is it possible to obtain the user's Team id at the time an action is invoked ?
Every activity sent to the bot has a from property that identifies the user that sent the activity. You can see the full activity schema here. I advise you to run your bot in debug mode so that you can see all the data your bot receives. If you want to run your bot in debug mode and talk to the bot using Teams instead of Emulator, you can use tunneling: https://learn.microsoft.com/azure/bot-service/bot-service-debug-channel-ngrok

Twilio studio, initial sms message

In twilio studio, I'm trying to create a workflow to send an initial text if the person has never sent us a message before. I have already setup auto responses, but I can't get the program to check whether the person has “subscribed” or not. What am I missing?
you will need to create your own database to capture that metadata (firstContact=false or something similar) if they have previously responded and then respond with the appropriate message.
You can save this data to your CRM or a database, POSTing via the HTTP Request Widget or Run Function Widget (where you keep their opt-in records) and then refer to it when making an outbound response or REST API Trigger call, to determine if they responded previously.
It is important to make sure you have customer opt-in before initiating an outbound SMS.
You could use the Messages Resource and include the optional parameter of the incoming message from number. Check the response back from the API call and look for the body property.
If they've messaged you in the past you'll get a response and you'll see what they messaged you.
You could do this using a Twilio function and the run function widget or just use the http get widget and then use a split based on widget to make a branch based upon the returned JSON.

Firebase detect email verification

When a user verifies their email address, I want to receive some notification on my client app (iOS/Android).
I need this to ensure that I can unlock additional capabilities for those users whose address is verified. How can I achieve this?
Currently, the only way to do this is to call the reload method on the User object. However, it is not an ideal way of dealing with this situation – after all, I have no idea when they would click on the link. So, performing a reload every time my app becomes active seems excessive.
Maybe there is a trigger which I missed?
Well, what I do is, each app launch I query the user object for its verification status; if it's not verified I send a verif request right there, if not sent before, and if it is and it's the first time, I show some thank you text and move on. I don't think there's an actual notification you can hook with for when the user clicks the link in the email, but alternatively you could build an admin node function server side to check every now and then for verifications and send pushes to the relevant devices.

Twilio: Answer an incoming call that started before opening browser

I'm using the Twilio Javascript Client SDK to allow users of our application to receive incoming calls through their browser. We have everything working well (ie: the call can be answered) if the user already has a browser tab open and receives an incoming call.
The use-case that we would like to support is this:
The user has no browser open to our site
An incoming call comes into our app and attempts to Dial the user (using their client ID)
The user opens up their browser to our app
The user sees the incoming call and answers it
I've tested this scenario and it doesn't appear to work. When the browser is opened and an incoming call is already ringing, the user is not presented our call dialog (which is triggered by the Twilio.Device.incoming event).
So my question is: Is this use-case possible to implement? Is there a setting that needs to be enabled, or is this something that cannot happen because we missed the initial incoming event?
Thanks for any help!
My .02, to achieve this a desktop app would be needed. It could be a simple web-wrapper though. Create an app that wraps a browser and have that user login. When a call comes in the app would receive it because the user WAS logged in. Your user wouldn't interact with your webapp through the desktop app, but I don't think that would be a problem given your use-case.

Resources