Amy came back from work, and when she opened the door, the phone immediately started to ring.
Immediately is an adverb.
If the sentence is: I will go to the store immediately...then "immediately" is an adverb. It answers the "when" requirement. "Immediately" is never a preposition.
That sentence is a declarative sentence, a sentence that makes a statement.
"Immediately" is the adverb.
"Unpack immediately" is an imperative phrase, specifically a command or instruction telling someone to unpack right away.
We need to evacuate this building immediately!
Imperative A+
Yes! Immediately exit the building. Immediately turn on your television. Immediately look up Mitch Longley. And so on and so forth.
I want you to run to the store immediately and get some ice cream.
I must speak with a haberdasher immediately.
I wish she had been immediately enamored of me.
Emphatic