In general in English, we use "I", "we", "he", "she", and "they" for the subject of a verb, and "me", "us", "him", "her", and "them" for the object. "I asked her", "They asked me", etc.
When the verb is a form of "to be", by the textbook, this is what is called a "predicate nominative", the word following the verb is the subject, and so it uses the subject form. "Who's there?" "It is I." "Who asked for this?" "It was she."
In practice, most English speakers, even the best educated and most fluent, use the object form. "Who's there?" "It's me." "Who asked for this?" "It was her."
So I'd say for very formal writing, like if you're writing a term paper for English class, or an article for a learned literary magazine, use the subject form. For common speech and informal writing, use the object form.
2
This was addressed on ELU by It was he … / It was him. Basically it's the same as *It is I* vs *It is me*. "Traditional grammar" tells us we should use *I*, but ordinary native speakers almost completely reject this. *Knock, knock! Who's there? It is I* is just about acceptable as a "theatrical, facetious" reply, but the contracted form *It's I* wouldn't be a remotely credible utterance.
– FumbleFingers Reinstate Monica – 2017-09-06T17:37:50.260See also https://www.xkcd.com/1771/
– rjpond – 2017-09-06T17:40:29.457@rjpond: Love it! *It was I who allowed people to ignore the "predicate nominative" rule! Me! I allowed it!* – FumbleFingers Reinstate Monica – 2017-09-06T18:32:39.597