Software Architect / Microsoft MVP (AI) and Pluralsight Author

C#, Social Opinion, Social Opinion API, Twitter API v2

Support for Twitter API v2 Mutes endpoint added to Social Opinion API

I’ve implemented the new V2 Mutes endpoint that recently shipped by the Twitter Development Team.

This is available in my NuGet package and on GitHub. It’s written in C#.

This endpoint lets you programmatically:

  • Mute an account
  • Unmute an account

 

You can use these new methods in the Social Opinion API to create safer experiences for people on Twitter.

One benefit of muting an account is that is removes an account Tweets from your timeline without unfollowing or muting that account.

Any accounts you mute don’t know that you’ve muted them. You can unmute them at any time.

Using The Mutes Enpoint with The Social Opinion API

You can use this end point with a few lines of code. The first thing you need to do is create an instance of the Mutes Service and pass in your OAuth tokens:

MutesService mutesService = new MutesService(oAuthInfo);

You are now free to call each of the methods.

Muting an Account

This method lets the authenticated account mute a target user account

bool isMuting = mutesService.Mute("958676983", "34655603");

The first parameter is the id you are muting on behalf of.  The second parameter is the target id of the account you want to mute.

A boolean (true) is returned when the operation has been successful and the account has been muted.

This account will then appear in the list of Muted Accounts on Twitter:

Unmuting an Account

This method lets the authenticated account unmute a target user account.

The first parameter is the id you are unmuting on behalf of.  The second parameter is the target id of the account you want to unmute.

A boolean (false) is returned when the operation has been successful, and the account has been unmuted.

bool isMuting = mutesService.UnMute("958676983", "34655603");

Use Cases

There are a few use cases for this, I see the main ones being around creating automation to improve the health of your timeline.

You might also choose to harvest accounts based no configurable logic and mute accounts after these rules have been broken.

~

Free NuGet Package: You can find the free Social Opinion API NuGet package here.

If you want to understand your followers, get richer analytics, perform social media monitoring, schedule tweets, or automate other aspects of your Twitter account, you can do that using Social Opinion

JOIN MY EXCLUSIVE EMAIL LIST
Get the latest content and code from the blog posts!
I respect your privacy. No spam. Ever.

Leave a Reply