There are countless social occasions that require some sort of written communication out of courtesy toward a business acquaintance, friend, or relative. Some require a predetermined course of action. Others are more flexible about how you can respond.
Should you write a note? Send a letter? Is it okay if you type it? Because of that flexibility, there often isn't one right or wrong way to go about structuring your response.