NATION

PASSWORD

API Recruitment Telegrams

Bug reports, general help, ideas for improvements, and questions about how things are meant to work.
User avatar
Kassimo
Lobbyist
 
Posts: 13
Founded: May 10, 2015
Ex-Nation

API Recruitment Telegrams

Postby Kassimo » Wed Jun 03, 2020 9:59 am

Hello, I have a question. If several people in a region wish to carry out a recruitment campaign via API automated telegrams, should we all use the same API client key (I already have one for the region), or do we each need our own client key? And I presume, either way, we would all use the same TGID to send out the same telegram. If several people are recruiting for the same region, how do we avoid exceeding the API rate limit? (If it makes any difference, we will be using PyNS.)
Thanks in advance.

User avatar
Merni
Ambassador
 
Posts: 1800
Founded: May 03, 2016
Democratic Socialists

Postby Merni » Wed Jun 03, 2020 11:19 am

Kassimo wrote:Hello, I have a question. If several people in a region wish to carry out a recruitment campaign via API automated telegrams, should we all use the same API client key (I already have one for the region), or do we each need our own client key?

A region can only have one client key. Per the Telegram API docs:
the API docs wrote:API Client Keys are tied to a particular region, and each region may only have one (although they can be revoked and re-issued). Multiple people and scripts within a region can use the same API Client Key. If they do, they will be bound by the same rate limit: that is, when anyone uses the API Client Key to send a recruitment telegram, no-one else using the same API Client Key will be able to send more messages until the rate limit expires.

Kassimo wrote:And I presume, either way, we would all use the same TGID to send out the same telegram.

Don't do that. The API docs say:
the API docs wrote:Never share your telegram's Secret Key, as this will allow others to send your telegram to the recipients of their choice. You are responsible for all usage of your keys.

Besides, the telegram will always appear to be sent from the nation that created the TGID and secret key.
Kassimo wrote: If several people are recruiting for the same region, how do we avoid exceeding the API rate limit? (If it makes any difference, we will be using PyNS.)

If I'm not mistaken, exceeding the API rate limit has no penalty except that you will not be able to send telegrams until the rate limit expires. Again from the docs:
the API docs wrote: If you attempt to send telegrams faster than this, your request will fail, and the response will include a 'X-Retry-After' header with information on when you can try again successfully. There is no penalty for trying too soon, although each request does count toward your overall API Rate Limit.

I don't know what effect this has on PyNS, though.
Last edited by Merni on Wed Jun 03, 2020 11:21 am, edited 1 time in total.
2024: the year of democracy. Vote!
The Labyrinth | Donate your free time, help make free ebooks | Admins: Please let us block WACC TGs!
RIP Residency 3.5.16-18.11.21, killed by simplistic calculation
Political Compass: Economic -9.5 (Left) / Social -3.85 (Liberal)
Wrote issue 1523, GA resolutions 532 and 659
meth
When the people are being beaten with a stick, they are not much happier if it is called 'the People’s Stick.' — Mikhail Bakunin (to Karl Marx)
You're supposed to be employing the arts of diplomacy, not the ruddy great thumping sledgehammers of diplomacy. — Ardchoille
The West won the world not by the superiority of its ideas or values or religion [...] but rather by its superiority in applying organised violence. — Samuel P. Huntington (even he said that!)

User avatar
Imperium Anglorum
GA Secretariat
 
Posts: 12655
Founded: Aug 26, 2013
Left-Leaning College State

Postby Imperium Anglorum » Wed Jun 03, 2020 3:03 pm

It makes no difference if you have a single client polling the API every 3 minutes or eight thousand clients polling the API every 3 minutes (or one client polling the API ever 3/8000 minutes). The API will reject all calls exceeding the rate limit and lock you out. The best way to do this is to have a computer which can sit there and is always on and connected to the internet. It will then run your Telegram API calls within the rate limit.

Author: 1 SC and 56+ GA resolutions
Maintainer: GA Passed Resolutions
Developer: Communiqué and InfoEurope
GenSec (24 Dec 2021 –); posts not official unless so indicated
Delegate for Europe
Elsie Mortimer Wellesley
Ideological Bulwark 285, WALL delegate
Twice-commended toxic villainous globalist kittehs


Return to Technical

Who is online

Users browsing this forum: Eremocyma, Fleetariland, Grishahakkaverchynot, Justinian Kalominos, Kirago, New Verodania, Patolia, Rary, Rusolveq, Seskeisau, Sklobia, Sol Nations, Staidear, The French National Workers State, The Militant Sultanate of JaviLand, Unat, Winx club

Advertisement

Remove ads