I almost had a heart attack.
This is an interesting idiom: por poco no and the verb in present tense.