The symptoms you have described leads to Alendronic acid
induced OESOPHAGITIS and GASTRITIS
Alendronic acid has a very known side effect of gastritis and oesophagitis , some people have this side effect immediately , some have after months , and even 3-5 years of using it . taking the pill in upright sitting position early morning can reduce it but does not rules out completely.Lansoprazole
is long acting stomach acid reliever , but alendronic acid is so strong than lansoprazole to heal your small drug iinduced stomach arosions.
Your foamy mucus , reflects all night long regurgutation and reflex of stomach burning.
I would suggest to have a review with your GP to stop or switch alendronic acid with less stomach problems.
Hope this helps