I read all the other questions regarding this topic but none actually answers exactly my question.
I installed twilio package. added it to the C# project.
opened an account in twilio and had a number and so on.
but it seems not working
any ideas ? here's the code
using System;
using Twilio;
namespace Project_C_Sharp_Final
{
public partial class User : Form
{
private void label4_Click(object sender, EventArgs e)
{
string AccountSid = "[i wrote the sid here]";
string AuthToken = "[i wrote the authtoken here]";
var twilio = new TwilioRestClient(AccountSid, AuthToken);
var message = twilio.SendMessage("YOUR_TWILIO_NUMBER", "THE NUMBE I WANT TO SEND TO" , "Check New Offers");
}
}
}
message is not being sent...
did i write anything wrong ? did i miss anything ?
Before putting my solution, I want to re-iterate what philnash has mentioned. Testing Twilio Credentials will not actually send SMS.
If you are using test credendials then below solution will not work for you.
For error : Permission Not Enable for the region indicated by the to number, that means the country you are trying to send SMS to is not enabled in geolocation settigs of your Twilio account.
You need to loging to twilio portal and navigate to following URL.
https://www.twilio.com/user/account/settings/international
Here you can enable/disable countries for both SMS and Voice Call. Check if the country you are trying to send SMS to is enabled in that page or not. If not you can enable it and try sending SMS again.
Thanks and regards,
Chetan Ranpariya
Twilio developer evangelist here.
In the comments you say you're using the test credentials. Test credentials will not actually send any messages (or make calls) they are to make sure you're making the request correctly without costing you.
To make Twilio send messages you need to use the production credentials. If you are still on a trial account this won't cost you anything either.
Related
I am working on a bot in which I have to display offers to the user according to their current location.
I use this method to get the user's IP address :
String ip = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (string.IsNullOrEmpty(ip))
{
ip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
}
But the IP address that code fetches is totally wrong.
What is the correct method to get the user's IP address in bot framework C#?
Please look over this project I created not too long ago. It uses botchat.js in a webpage to instantiate a bot and implements backchannel to pass values to and from. The project shows how to use the browser's IP address or a paid service (ipstack.com, in this case) to determine a user's location. The main.js file is where most of the magic happens.
I haven't had a chance to write a proper readme file. If you have any questions, let me know.
Hope of help!
I've made a chat bot using Microsoft Bot Framework which answers a user's questions. When the bot is unable to answer the user's questions, I want to be able to redirect the user question to a customer rep on Skype.
The person on Skype will see the messages posted by the user, and his answers will be sent to the user.
I need some advice on how to achieve this connection (from user<->chatbot<->SkypecustomerRep)
Edit:
I'm toying with the idea of using the commands in http://docs.botframework.com/connector/new-conversations/#navtitle
I figured when the LuisIntent would turn out to be None, I'd message a skype id with:
var connector = new ConnectorClient();
var message = new Message
{
From = new ChannelAccount(channelId: ""),
To = new ChannelAccount() {ChannelId = "Skype", Address = "xyz#abc.com"},
Text = result.Query,
Language = "en"
};
where the email is the Skype id. I'm not able to figure out what should be in the From field (what's the channelId, Address of my bot)
EDIT:
I'm able to pass one message to Skype now, but when the Skype user replies, I observe that the reply is not immediately presented to the bot framework user. In other words, when the user types something into the chat window, he gets a response from the bot (as expected) and the skype user's delayed message.
If you want the customer support representative to have sufficient context (i.e. see more than just the most recent text posted by the user) you are going to need to build your own customer support interface to both record conversations as well as highlight those that need attention from a human. Usually folks do this building their own client with DirectLine or connecting up their existing customer support client (also with DirectLine). The bot then directly passes the support reps replies back to the end users.
Some additional detail can be seen in this previous answer.
When ever I used this below piece of code, it launches the messaging app, i don't want that. I want to send SMS within my app. How to do that. any ideas ?
Code
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = "9012345566778"; // Mention here the phone number to whom the sms is to be sent
smsComposeTask.Body = "Hello! How are you"; // the string containing the sms body
smsComposeTask.Show(); // this will invoke the native sms edtior
You can't send a SMS directly from your app. Using the SmsComposeTask (and therefore displaying the message hub) is the only way.
I think KooKiz is right. windows phone is cared for its security.
I am developing a Windows Store Application (Windows 8).
I have a need to send emails based on data and address stored in the application data and without the need of the user to type it the data or the address.
What would be the right/easy way to implement it?
EitanB
You can try with
var mailto = new Uri("mailto:?to=recipient#example.com&subject=The subject of an email&body=Hello from a Windows 8 Metro app.");
await Windows.System.Launcher.LaunchUriAsync(mailto);
The correct way would be to use Sharing. Your app should create an HTML document or Text and share it. The user would select Mail from the Share charm and the HTML/Text would become the body of the email.
See here for more info...
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh973055.aspx
This is the correct syntax to use for a mailto: link (unlike the other examples above with a mailto: which are incorrect..)
var mailto = new Uri("mailto:yourname#email.com?subject=" + subject + "&body=" + body);
await Launcher.LaunchUriAsync(mailto);
The problem with the mailto: method is if the user has no client program associated with mailto: nothing will happen.
The most reliable method to use is a web service or WCF service of some sort. Using the Share Charm while considered the 'correct' way on Windows 8, is not neccessarily the best as the user may still have no email client installed, for example if they rely on gmail.com for their email.
If you are developping a Universal WinRT Windows Phone application, you could use the "Windows.ApplicationModel.Email.EmailMessage" namespace as the "Microsoft.Phone.Tasks.EmailComposeTask" namespace doesn't work on WinRT application.
Then, uses this code to create and launch a new email.
// Create your new email message.
var em = new EmailMessage() ;
// Add as much EmailRecipient in it as you need using the following method.
em.To.Add(new EmailRecipient("yourname#yourdomain.com"));
em.Subject = "Your Subject...";
em.Body = "Your email body...";
// You can add an attachment that way.
//em.Attachments.Add(new EmailAttachment(...);
// Show the email composer.
await EmailManager.ShowComposeNewEmailAsync(em);
I hope it will solve your (or other developers) problem.
Regards.
It's always possible to connect to an SMTP server and issue commands like HELO, MAIL, RCPT, etc. Of course you'll need an SMTP server to connect to. I use this on our corporate intranet to send emails.
Is it possible to silently send an email from a Windows Phone 7 device?
The reason I ask is because I would like to have a system from which an app will send information to a server which the server will log. I figure if I use emails it would be a lot more straightforward than some other system.
As you can probably guess from my question I'm in completely unexplored territory here.
It's possible to send emails, so long as you are running the SMTP server on your server.
Web services are designed for this sort of thing, email isn't. You won't find emails simpler. Look into WCF.
Of course you can, sending email can be achieved with the EmailComposeTask.
To use the EmailComposeTask , you must include the namespace Microsoft.Phone.Tasks .
*`Using Microsoft.Phone.Tasks ;`*
This namespace can be found in the Microsoft.Phone.dll
To send the email , create an instance of the EmailComposeTask and set the appropriate properties like
To , Subject and Body of the Email .
private void button1_Click(object sender, RoutedEventArgs e)
{
EmailComposeTask emailcomposer = new EmailComposeTask();
emailcomposer.To = "test#ginktage.com";
emailcomposer.Subject = "subject from test app";
emailcomposer.Body = "This is a test mail from Email Composer";
emailcomposer.Show();
}
When the Show method is called , the EmailComposer is opened which lets the user to click the send button to send the email
I hope it's clear :)