Search code examples
c#twittertweetsharptweetinviads-api

C# Client Library for Twitter Ads Api


Is there a C# Client library for twitter Ads Api?

Apparently Tweetinvi doesn't support Ads Api but otherwise is very good library for Twitter.


Solution

  • I would guess that you can setup the authentication the same way as you'd do with Tweetinvi and then use the TwitterAccessor.

    You can find the documentation here : https://github.com/linvi/tweetinvi/wiki/Custom-Queries#simple-query

    Instead of using the JSON I would instead simplify the process by creating DTO's decorated with [JsonProperty] attributes (example in UserDTO).

    // Example of DTO class
    public class AdDTO
    {
        [JsonProperty("name")] // This is the name json field of the response
        public string Name { get; set; }
    }
    

    And then you will be able to get the AdDTO as followed:

    var adDTO = TwitterAccessor.ExecuteGETQuery<AdDTO>("my_twitter_ads_api_query");
    

    I hope this is of any help.

    Finally just for the sake of your knowledge, I have been working with multiple companies, and I have signed confidentiality clauses/contracts in order to always preserve their credentials safe. If needed I will be happy to do this with you too.

    Have an happy ads coding :)