My question is basically about existence of API.
Is there any api from which I can get CallBackUrl against a number?
I have bought a Twilio number (and planning to buy more). Against that number i have configured a CallBackUrl.
Now I need to get the Callbackurl from API. Like I will provide create twilio client
var twilioClient = new TwilioRestClient(accountSid, authToken);
then need a API in which I will pass twilio number and it will return back the url
like
twilioUrl = twilioClient.GetCallBackUrl(mytwilioNumber);
is there Any possibility of such thing
Twilio evangelist here.
You can use the GetIncomingPhoneNumber method to get the details of a specific phone number, including the voice and message request URL's:
var result = client.GetIncomingPhoneNumber("PHxxxxxxxxxxxxxxxxxxxxxxx");
if (result.RestException == null)
{
Console.WriteLine(result.VoiceUrl);
Console.WriteLine(result.SmsUrl);
Console.WriteLine(result.StatusCallback);
}
Hope that helps.
Related
I could make a call and record call conversation.
string callerId =string.Empty;//Twillio Account SID
var dial = new Dial(callerId: callerId, record: record_from_answer
How to retrieve Recording Sid of the current call, once the call recording is complete from Twilio using c#
Twilio developer evangelist here.
Twilio will make a request to your server with the recording information via the RecordingStatusCallback attribute. You can read more about it here
So all you need is create an endpoint that accepts a POST request from Twilio and change your code to something like:
var response = new VoiceResponse();
response.Dial("to-phone-number",
callerId: "your-twilio-number",
record: "record-from-answer",
recordingStatusCallback: new Uri("url_in_your_application_that_processes_recordings")
);
Hope this helps you
I'm successfully using the Twilio API in an ASP.net C# app using the sample code (obviously changing the variables as required):
static void Main(string[] args)
{
// Find your Account Sid and Auth Token at twilio.com/console
const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const string authToken = "your_auth_token";
TwilioClient.Init(accountSid, authToken);
var to = new PhoneNumber("+15017122661");
var message = MessageResource.Create(
to,
from: new PhoneNumber("+15558675310"),
body: "This is the ship that made the Kessel Run in fourteen parsecs?");
Console.WriteLine(message.Sid);
}
I'm sure I read somewhere that you can change what the message receiver sees on their phone - so you could have 'my company' instead of the phone number the message is sent from.
However, I can't find this anywhere in Google or on the Twilio API C# samples.
How can I do this?
Thanks.
This article is more clear on the requirements. It is a paid account feature only:
Alphanumeric Sender ID is automatically supported on all new upgraded (paid) Twilio accounts. It is not supported for Free Trial accounts.
and
This feature is only available for upgraded (paid) Twilio accounts sending messages to supported countries. Some supported countries may have additional requirements, including pre-registration for alpha sender IDs, or limiting these messages to be only sent as transactional messages.
There are also instructions there for checking if it supported on your account. I believe short code is a different concept, using a 5 or 6 digit number for the sender id, which is also associated with larger message rate limits and of course paid account only as well.
Is it possible to fetch user's phone number from Twitter Digits callback? I'm using http version and javascript to send SMS with twitter digits.
I only see next information response headers:
{"oauth_echo_headers":{"X-Verify-Credentials-Authorization":"OAuth oauth_consumer_key=\"gmoaaZhEG88hMQUdpWHnF1IAz\", oauth_nonce=\"3375731039-FmyAQgjhQG9rljUaXO3jBbiryF7dFQHeVL5oxu4gmoaaZhEG88hMQUdpWHnF1IAz1437035638029\", oauth_signature=\"TTbPlgipWdaNCSblfx0qznz%2B2Fc%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1437035638\", oauth_token=\"3375731039-FmyAQgjhQG9rljUaXO3jBbiryF7dFQHeVL5oxu4\", oauth_version=\"1.0\"","X-Auth-Service-Provider":"https://api.digits.com/1.1/sdk/account.json"}}
Once you receive the credentials authorization header, you can query the server directly to receive attributes from the Digits service. Per the docs:
/* Validate and log user in. */
function onLogin(loginResponse){
// Send headers to your server and validate user by calling Digits’ API
var oAuthHeaders = loginResponse.oauth_echo_headers;
var verifyData = {
authHeader: oAuthHeaders['X-Verify-Credentials-Authorization'],
apiUrl: oAuthHeaders['X-Auth-Service-Provider']
};
$.post('/verify', verifyData)
.done(function(){ window.reload(); });
}
You can see a sample of this in action in the Cannonball web demo.
May be its late but it can easily be achieved by putting following code wherever you want to fetch phone number:
String phone = Digits.getActiveSession().getPhoneNumber();
I am trying with this sample code to send message using SNS API -
BasicAWSCredentials cr = new BasicAWSCredentials("MYACCESSKEYS","mySecretKeys");
AmazonSimpleNotificationService sns = new AmazonSimpleNotificationServiceClient(cr);
string topicArn = sns.CreateTopic(new CreateTopicRequest
{
Name = "ses-bounces-topic",
}).CreateTopicResult.TopicArn;
sns.SetTopicAttributes(new SetTopicAttributesRequest
{
TopicArn = topicArn,
AttributeName = "MyName",
AttributeValue = "Sample Notifications"
});
sns.Subscribe(new SubscribeRequest
{
TopicArn = topicArn,
Protocol = "SMS",
Endpoint = "my-mobile-number"
});
ListSubscriptionsByTopicResult ls = sns.ListSubscriptionsByTopic(new ListSubscriptionsByTopicRequest
{
TopicArn = topicArn
}).ListSubscriptionsByTopicResult;
sns.Publish(new PublishRequest {
TopicArn=topicArn,
Subject="MySms",
Message="Testing Message"
});
This code working fine to send message to my mobile. I am successful to send message to a SMS-enabled device mobile.
Is there any way to get reply of user if he/she sent back? Please guide me if we can get the reply of user sent back using any API request.
Thanks in advance!!
You cannot currently receive replies to SMS messages with Amazon SNS. We would like to provide expanded SMS support (more AWS regions, more geographic coverage, more functionality), but unfortunately don’t have timing to share.
As #Rohan explained AWS cannot receive the SMS. You will have to look for some third party solution like:
Twilio SMS - Build SMS Text Messaging Into Your Web Apps | Twilio : http://www.twilio.com/sms
Send & Receive SMS using the best SMS API there is. : http://www.sent.ly/
Disclaimer - I havent tried them myself. Just giving you a direction to explore! Post here if you find it useful.
I'm developing a feature for our product that will allow users to send SMS messages via Twilio and we handle all of the account issues. We have our Master Account and all of our customers will be sub accounts under us.
In an effort to not have to keep track of 1000+ auth tokens, we decided to use our Master Account credentials to send the SMS message however we still want it to roll up under the sub account. According to Twilio, this shouldn't be an issue.
My problem is that there is very little (that I've found) documentation for the c# library they provide. I'm not sure if what I've done is the correct way to accomplish what I described above and since I'm on a trial account until the project is finished and can be rolled out to production I have no way of testing.
var twilio = new TwilioRestClient("Master SID", "Master Auth Token");
var response = twilio.SendSmsMessage(sender, recipient.ConvertToE164Format(), message, null, "Subaccount SID");
The comment on this overload isn't really clear on if passing the subaccounts SID here will send the message as if I had logged into their account and sent it.
// applicationSid:
// Twilio will POST SmsSid as well as SmsStatus=sent or SmsStatus=failed to
// the URL in the SmsStatusCallback property of this Application. If the StatusCallback
// parameter above is also passed, the Application's SmsStatusCallback parameter
// will take precedence.
The callback url will be the same across all accounts so I don't need/care about that value.
Short Version:
If I log in with my Master Account details but pass the subaccount SID in the SendSmsMessage() method, which account does the message come from?
Twilio support finally got back to me and confirmed my fears that this wouldn't work. I do have to pull the subaccount information down and reinstantiate the twilioRestClient with the new credentials which I was hoping I could get away with not doing. Just a few extra lines.
var twilio = new TwilioRestClient("Master SID", "Master Auth Token");
var subAccount = twilio.GetAccount("SubAccount SID");
var subAccountClient = new TwilioRestClient(subAccount.Sid, subAccount.AuthToken);
var response = subAccountClient.SendSmsMessage(sender, recipient.ConvertToE164Format(), message);
return response.Sid;