Twilio integration - api

I am using twilio from salesforce (On a custom object) to call some numbers. Is there any way to send voicemails to those numbers without ringing there phone or with ring as least as possible .
Will appreciate your help .
Thanks!

Twilio developer evangelist here.
The voicemail of someone else's phone is not under control by Twilio. So you can't directly leave a voicemail without ringing them. You also cannot control the number of rings someone else's phone will make before going to voicemail.
Using Twilio, you could make calls to the numbers and play a message when they or their voicemail answers. This would either directly deliver the message to the user or record it on their voicemail.
[edit]:
After the discussion in comments below, here is an updated answer.
I'll give an overview of the system I think you need to build. I can't be more specific, because I have little details of your system or what you've tried.
I think you need to build in Twilio Client to your Salesforce application. You can watch a video on how to integrate Twilio Client with Salesforce.
You can use this to generate the calls to your customers and speak to them from within Salesforce.
To add to this, you also want to leave a message if you get a voicemail. You will need to do a few things to achieve this.
First, you will need to store the Call Sid of the call you made in the browser. You can get this from the parameters attribute of the Twilio.Connection.
You will need to add a button to your interface that is active when you are on an active call. This button needs to hook up to an endpoint in your Salesforce app. The button should send the Call Sid you saved from your connection to the app.
Within the Salesforce app, you will need to build the endpoint for the above. This will receive the Call Sid as an argument. This Call Sid is the parent call and represents your connection to the call. We need to get the Child Call, which is the other end. We do this by calling on the Calls resource passing the Call Sid as the ParentCallSid parameter. This will get you access to the child call.
You now need to redirect the child call using the REST API to another endpoint that has the TwiML to <Play> your recorded message for voicemail.
Then, when your user is on a call and it goes to voicemail, they should press the button in the interface. This will redirect the child call away and consequently hang up on the user in salesforce.
Let me know if this helps at all.

Related

Maximo script to send a message to another user?

With IBM ICD/Maximo version 7.6.1.2 I am trying to inform a user when an attachment (arriving via a REST call) has finally arrived.
I have access to the USERID of the requester
the launchpoint is 'add' on DOCLINKS
I aim to inform the user using a message box (or something similar) if he/she is still active on the platform
The whole send/receive action takes more than 10-15 minutes so waiting for a response during the same REST call is not possible. The user sends a POST and later receives a POST.
The problem is, mbo.getUserInfo() points to the username of the external service and not the requester so in my opinion I need to either change the active session or active user in order to be able to use commands like:
service.webclientsession().showMessageBox(msggroup,msgkey,params)
I need a method or commands to do that.
One possible way to do this would be by sending a bulletin board message to the user to notify that their file has been uploaded as shown here

Callback service on the website using Twilio

Let's say I need to implement a callback service on a website.
I'm curious if it's possible to develop it using Twilio.
For example, if a website visitor provides his mobile phone number from one side, from another side I have a manager using his web CRM application. Is it possible to:
Make a call (using WebRTC?) to a manager
When the manager replies the incoming call, call to the website visitor (on his mobile phone)
Connect both sides together
I know there are lots of ready-to-use callback services, I'm just curious how it works under the hood.
Twilio developer evangelist here.
This is a feature we call Click to Call. Here's how it would work with Twilio:
The visitor provides his number through a form on the site
Generate a call to the manager using the Twilio REST API
When the call connects to the manager, dial the visitor.
This is achieved using TwiML
Whent the call connects, Twilio makes an HTTP request to a URL you provide in step 2
That URL needs to respond with TwiML, which is a subset of XML to tell Twilio what to do with the call
In this case the TwiML would be to <Dial> the visitors number
When the visitor answers the two are connected
This is a high level view of it, we also have a tutorial walking you through Click to Call with Twilio (this is the Python version, but there are others available too) which I recommend you take a look at.
Let me know if this helps at all.

Unregister tags with Azure Service Bus Notification Hubs

I have inherited an iOS app that uses Azure Notification hubs to send notifications, however there is a snag.
The users select multiple categories for which to receive notifications (News, Sports, etc), and they can change these at any time. Whenever they add or delete an interest the app unregisters from the notification hub and subscribes with the new tags.
I thought that this was incorrect, but I can't find a way to see what tags a user is subscribed to, or add/delete a single tag.
In the current app, sometimes our test devices don't receive notifications that I think they should.
I've found answers online saying that you should avoid unregistering, and that there is a delay to register and unregister (such as the answer here, Android Azure Notification hub unregister)
I am looking for any insight on how to handle this usecase, of adding and deleting tags.
Since you didn't specify how you are communicating with the Azure Notification Hub, I will use the ANH REST API as reference.
"...I can't find a way to see what tags a user is subscribed to..."
If you request a registration (e.g. per registration ID), you will get the registration data including the assigned tags.
"...or add/delete a single tag."
You don't add or delete single tags directly on the registration in ANH, you basically update the whole registration, if necessary. Some ANH SDKs may have convenience methods for this, but in general, you just send the complete registration object with the desired tags to ANH and it gets overwritten. E.g. the REST API has an "Update Registration" method, but no "Add/Remove Tag" methods.
"I've found answers online saying that you should avoid unregistering, and that there is a delay to register and unregister..."
You should indeed not unregister and register for this use case because of the reasons you stated. This is probably also the reason for:
"In the current app, sometimes our test devices don't receive notifications that I think they should."
Never unregister and register again for updating a registration. Only unregister, if you don't want to receive notifications at all on a specific device.
"I am looking for any insight on how to handle this usecase, of adding and deleting tags."
Basically, just omit the "unregister step" and make the "register step" a "create or update registration step" using the actual ANH registration ID and all desired tags.

PayPal Custom variable returned back

I am new to PayPal API, so I have a nooby question.
When I send user from my shopping site to PayPal payment page e.g. https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=xxxxxx&custom=xxxx and I use custom variable with unique ID about product inside my database and when user get returned back to my website thank you page, do I use simple $_GET["custom"] inside my php script to grab that value or I need some PayPal API code implemented inside my website?
Thanks for help.
In order to retrieve this value, you would not be able to get it as you described, however, you can do one of a couple of things:
post the custom value to a cookie or session variable before sending the user to paypal, then retrieving the cookie or session variable value when they are returned from paypal.
(preferred method) implement an IPN listener that will be able to parse the posted transaction details, one of which is the custom value. This method would allow you to confirm a completed transaction as well as do pretty much anything else with the data that you need to do.
Paypal has PHP code samples for an IPN listener on their DEV site. It's pretty easy to implement and follow along.
I hope this helps.
Old thread I know but if I understand the user correctly and he is using the IPN url to collect the returned data he can use $myphpvar = $_POST[custom];
More info # http://www.brianmoreau.com/articles/paypal_buy_now_button_sending_custom_variables.php

hangout API event on exit

I created a Hangout API that works to send invites to certain users from my server by sending an ajax request from my app with hangout url etc.
For now I need hangout event on exit so that I can make another callback to my server indicating that particular hangout has been closed.
I know it sounds odd. I looked around on https://developers.google.com/+/hangouts/api/gapi.hangout but didn't get any such events.
Can I tweak it in some other way to get a notification on exit?
I think this was already answered on the Google forums. The short answer is no there is currently not an event to detect the exit of the Hangout.
You could have your app send a periodic heartbeat to your server and once you detect a timeout then you can conclude the hangout stopped.
Another approach might be to implement an onbeforeunload handler within your hangout app and use that to send a Ajax call back to your server each time a participant leaves or just when the final participant leaves. You can get the participant count from the API and might also be able to use the participantChanged event. Not sure if participantChanged event will fire if the last user exits the hangout by closing the window, that could be a route to explore too.
+1 what Brett said for the heartbeat. I would also optimize by only starting the heartbeat when there is one participant. It would be rare that everyone exists the hangout at the exact same time.
Darn solar flares!