The Best way to do this is using Magento build in widgets. Please follow the given instructions:
Create a new static block in admin that will contain your coupon code HTML.
Create a new widget as follow:
Content >> Widgets >> Click "Add widget" Button.
From the widget form, select the following:
StoreFront Properties Tab
Type => CMS static block
Design Theme => Your custom theme (Press continue button)
Widget Title => Widget Name
Assign to Store Views => All
Layout Updates Section:
Display On => All Pages
Container => Page Header
Widget Option Tab
Select the newly created static block here
This is how you can show your custom messages at the top of the page.