Posting tweet on another twitter account using TweetInvi Api

324 Views Asked by At

I have successfully post a tweet using my own Twitter account thru TweetInvi API. Now I would like to know how to post a tweet thru my application on another Twitter account. The Twitter account I'm using currently on my application is the one with developer account on Twitter. If you could direct me to the right link or tutorial using TweetInvi API please. What do I need from the other Twitter account in order for me to post a tweet on its behalf.

Thank you in advance!

Updates:

       // Create a client for your app
        var appClient = new TwitterClient(apiKey, apiSecretKey);

        // Start the authentication process
        var authenticationRequest = await appClient.Auth.RequestAuthenticationUrlAsync();

        // Go to the URL so that Twitter authenticates the user and gives him a PIN code.
        Process.Start(new ProcessStartInfo(authenticationRequest.AuthorizationURL)
        {
            UseShellExecute = true
        });

        // Ask the user to enter the pin code given by Twitter
        Console.WriteLine("Please enter the code and press enter.");
        var pinCode = Console.ReadLine();

        // With this pin code it is now possible to get the credentials back from Twitter
        var userCredentials = await appClient.Auth.RequestCredentialsFromVerifierCodeAsync(pinCode, authenticationRequest);

        // You can now save those credentials or use them as followed
        var userClient = new TwitterClient(userCredentials);
        var user = await userClient.Users.GetAuthenticatedUserAsync();

        // publish a tweet
        var tweet = await userClient.Tweets.PublishTweetAsync(new PublishTweetParameters("Have a good day."));
        Console.WriteLine("You published the tweet : " + tweet);

        Console.WriteLine("Congratulation you have authenticated the user: " + user);
0

There are 0 best solutions below