I’m designing a database with ERD for a Telegram Bot and I want to store the Users. Every user gets an id (primary key, int) and the chat id form Telegram (int).
The Telegram Bot API says this about the chat id: "Unique identifier for the target chat or username of the target channel" https://core.telegram.org/bots/api
Now is my question: is the chat id a second primary key or a foreign key or just NOT NULL and UNIQUE? (Or something I never heard before)
This is a pretty straightforward spec.
My cursory reading of the link is that there are multiple different entities being returned, depending on the call. Each of them has an integer primary key which they refer to as the ID.
Its not clear from the spec how it returns references to other objects - for example the Chat definition refers to a UserName, while the Message object has a field called from which is of type user. This could be a name, the ID of the user, or the embedded object. If you are creating a database to support this then any embedded objects should be stored as foreign keys to the embedded object's ID, and you might have to do a lookup from whatever is returned in the call to find the correct ID.
I think some experimentation or sample calls would help - you might find it useful to experiment with Postman that will allow you to run the calls manually and inspect the results.