- Create a new web application
- using Nuget manager, download/install Tweetsharp
- Create a twitter application by visiting https://dev.twitter.com/apps/new
- Go to your twitter app settings, and make sure it's a read/write app
- Go to "Reset Keys" tab and reset keys, so the permission of read/write works with the new keys
- Generate Access Token and the first tab in your twitter settings
- Write the following Code, *Replace Dashes with your app keys, from the previous steps
======================================
using TweetSharp;
//Store Keys string consumerKey = "-------"; string consumerSecret = "-------"; string accessToken = "-------"; string accessTokenSecret = "-------"; //Authenticate with twitter as your app. var service = new TwitterService(consumerKey, consumerSecret); service.AuthenticateWith(accessToken, accessTokenSecret); //Post Tweet var status = service.SendTweet(new SendTweetOptions { Status = "My Second #Tweet from Code :D" });
======================================
-- You can use the status variable to know the id of you posted status etc.
No comments:
Post a Comment