Where did the term slot machine originate from?

The term came along with any automatic vending machine, and was later only used for gambling machines. The “slot” part refers to where you would put your coin in, even though online slots today can’t even accept coins through a physical slot.