With C#, how do I delete a sms on Google Voice? Alternatively, how do I mark a sms as read? I'd rather delete it but marking it would be ok too.
As far as marking it as read I tried this
public String markAsRead(string _authToken, string _msgID, string rnrSEE)
{
String smsdata = HttpUtility.UrlEncode("auth", Encoding.UTF8) + "="
+ HttpUtility.UrlEncode(_authToken, Encoding.UTF8);
smsdata += "&" + HttpUtility.UrlEncode("messages", Encoding.UTF8) + "="
+ HttpUtility.UrlEncode(_msgID, Encoding.UTF8);
smsdata += "&" + HttpUtility.UrlEncode("read", Encoding.UTF8) + "="
+ HttpUtility.UrlEncode("1", Encoding.UTF8);
smsdata += "&" + HttpUtility.UrlEncode("_rnr_se", Encoding.UTF8) + "="
+ HttpUtility.UrlEncode(rnrSEE, Encoding.UTF8);
//POST /voice/inbox/mark/ messages=[message id]&read=1&_rnr_se=[pull from page]
return this.makeRequest("https://www.google.com/voice/inbox/mark/", smsdata);
}
public String makeRequest(String url, String data)
{
string result = null;
WebResponse response = null;
StreamReader reader = null;
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
using (Stream writeStream = request.GetRequestStream())
{
UTF8Encoding encoding = new UTF8Encoding();
byte[] bytes = encoding.GetBytes(data);
writeStream.Write(bytes, 0, bytes.Length);
}
response = request.GetResponse();
reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
result = reader.ReadToEnd();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
throw new IOException(ex.Message);
}
finally
{
if (reader != null)
reader.Close();
if (response != null)
response.Close();
}
if (result.Equals(""))
{
throw new IOException("No Response Data Received.");
}
return result;
}
markAsRead(authTokenAccount1, msgFromAccount1, voiceConnectionAccount1.rnrSEE);
but it doesn't work just returns html for the login screen
This site http://posttopic.com/topic/google-voice-add-on-development says to mark a message as read u have to post this data to
messages=[message id]&read=1&_rnr_se=[pull from page]
to this site
/voice/inbox/mark/
could someone tell me what im doing wrong?
Thanks!