The study you are looking for is
Leventhal, H., Singer, R., & Jones, S. (1965). Effects of fear and
specificity of recommendation upon attitudes and behavior. Journal of
Personality and Social Psychology, 2(1), pp. 20-29. doi:
10.1037/h0022089
The study is mostly how you remember (though it was tetanus instead of the flu). Critically, the manipulation was intended to increase the the availability of receiving a tetanus shot by having rehearsed the steps needed to get one. Students were given a map of the campus with the health center circled, and were asked to review their schedule and find a time they might be able to go--however, they did not make an appointment. Thus, the commitment was only to themselves.
There are, of course, a wide variety of ways to increase consumer compliance, including the foot-in-the-door strategy, door-in-the-face strategy, and framing effects to name a few.
There is a wide body of literature in social psychology on the idea of influence. I highly recommend two books on the topic, both of which are leisure reads:
1) Nudge by Richard Thaler and Cass Sunstein (which mentions the Leventhal study!)
2) Influence: Science and Practice by Robert Cialdini. There is a chapter specifically on Commitment (ch 3) which also talks about the classic foot-in-the-door paper (below), more in line with the commitment strategy you suggest.
Freedman, J.L., & Fraser, S.C. (1966). Compliance without pressure:
The foot-in-the-door technique. Journal of Personality and Social
Psychology, 4, 195-202.