Skip to content

GrimRob/TweetSend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TweetSend

This is a C# example of how to send a Tweet with the Twitter API.

The first example does not use media. The second example posts an image embedded in a Tweet.

Preconditions

You need to login to Twitter and create a Project and App at the Twitter Developer Dashboard.

Once that's set up (you may need to keep trying different names, it needs to be unique) then you need to generate an Api Key and Secret. You also need to generate an Access Token and Secret (you don't need a Bearer Token for my examples). To make a writeable token you will need to edit your User authentication settings (even though there is no user) and choose Read and write for your App permissions. This will also give you a ClientId and Secret (not needed for these examples).

When you have done all that you should have four strings which look something like this:

private const string APIKey = "AhbgeX6MnPN9CWzueX58BEVSr";
private const string APISecret = "NEdzKiRWcrpmdXUyBhVoqUuAkRKqYFNg5E34qg2ZSt8yb5xA4q";
private const string AccessToken = "6726397748-n8rzzDrmYh69rQ7Wmhj6rgSFY8E9ZTZN1WY5NZY";
private const string AccessTokenSecret = "Wj5TWJq1AXTxM31jkuf2sYXQg3bF1Dp3E95Chq3zP9MUP";

Replace my example (not a real set of keys) with your own and try the examples. Please store your keys securely and don't leave them in your source code!

Examples

  1. No media.
  2. With media.

About

C# example of how to send a Tweet with https://api.twitter.com/2/tweets

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages