Campaign ID place

Hello
I don’t find my campaign ID and I need to a discord chat bot. Can someone write a tutorial where can I find?
If only with programming can I get then please give me a source, because I am no professional programmer. Thank you. :slight_smile:

UPDATE: OK, it’s nothing. I used this: https://github.com/Patreon/patreon-php/blob/master/examples/patron-list.php and put campaign_id in echo.

Other quick way is to load your campaign in a web browser, View Source, and search for “campaign”. It looks like there is currently some JS pre-populated on the page that includes some API call responses which will have the campaign ID

2 Likes

Lol, it works. :smiley: Thank you. :slight_smile:

Or, if you have Chrome or Firefox (and possibly others, Edge no longer works), you can get your campaign id by going to your Patreon page (ex, http://www.patreon.com/patronizer), and then paste the following into your address bar:

javascript:prompt('Campaign ID',window.patreon.bootstrap.creator.data.id);

That will pop up a prompt that has your campaign ID highlighted and ready to be copied. :smiley:

Make sure that what you paste in the address bar is preceded by javascript:, otherwise it won’t work. Both Chrome and Firefox will remove the javascript protocol when you paste the above into your address bar.

5 Likes

I like this solution also. :smiley: Thank you that you shared your method. :slight_smile:

The best way to do it using the API is to use the endpoint /oauth2/api/current_user/campaigns, which will give you the campaign resource along with its ID under data.id

1 Like

To do the same with the actually latest version of Patreon (as of 2024. 02.), the campaign id can be accessed through:

window.patreon.bootstrap.campaign.data.id

v1 is deprecated, therefore avoid using /oauth2/api/current_user/campaigns

Use /oauth2/v2/campaigns instead.