using System;
using System.Collections.Generic;
using System.Net.Http;
using Newtonsoft.Json;
class Program
{
static async System.Threading.Tasks.Task Main(string[] args)
{
// Replace the placeholders with your actual values
string campaignId = "your_campaign_id";
string accessToken = "your_access_token";
// Define the endpoint URL and headers
string endpoint = $"https://www.patreon.com/api/oauth2/v2/campaigns/{campaignId}/members";
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");
// Send the API request
HttpResponseMessage response = await client.GetAsync(endpoint);
// Parse the response JSON to extract the member data
string responseContent = await response.Content.ReadAsStringAsync();
dynamic jsonResponse = JsonConvert.DeserializeObject(responseContent);
List<dynamic> members = jsonResponse.data.ToObject<List<dynamic>>();
// Print the member data
foreach (dynamic member in members)
{
decimal pledgeAmount = member.attributes.currently_entitled_amount_cents / 100.0m;
string discordId = member.attributes.discord_id;
Console.WriteLine($"Discord ID: {discordId}, Pledge Amount: ${pledgeAmount}");
}
}
}
As artist you can connect your bot profile to your Patreon-Account and also link your patreon tiers to roles on the server.
API-Documentation: https://docs.patreon.com/#user-v2
Sample code: