There are many conditions for it to be waajib:
- The one inviting has to be Muslim.
- Only need to attend for the first day if it’s longer than 1 day.
- They are not people you are supposed to boycott such as innovators or sinners.
- Not an open invitation. Meaning it doesn’t mention you by name.
- There’s no evil taking place such as ladies entering, or music playing, dancing and so on.
- Not from a thief. For example, he steals and it’s known and he invites you. However, if he deals with riba, you can eat his food as the Prophet (saw) would eat from the Jews who ate from riba.
- If only the rich are invited, and ordinary are not.
- No-one who harms you is going to be there.
- If it’s going to harm you attending such as you have an exam tomorrow, or an interview.
If there is nothing preventing you, it’s Sunnah to go and if it’s a Walimah and there are none of the above mentioned preventers then it’s obligatory according to the majority of scholars.