1784 (1782 as melo drame), "a stage-play in which songs were interspersed and music accompanied the action," from French mélodrame (18c.), from Greek melos "song" (see melody) + French drame "drama" (see drama). Meaning "a romantic and sensational dramatic piece with a happy ending" is from 1883, because this was often the form of the original melodramas. Also from French are Spanish melodrama, Italian melodramma, German melodram. Related: Melodramatize.
The melodramatist's task is to get his characters labelled good & wicked in his audience's minds, & to provide striking situations that shall provoke & relieve anxieties on behalf of poetic justice. [Fowler]