As a rule, indirect objects must be preceeded with either a or para.1. Also as a rule, direct objects (like subjects) are bare. That means they can be quickly identified in sentences because they have no preposition introducing them.
Direct objects have two exceptions, though:
- If the direct object is anthropomorphized (a person, or something we see as a person, e.g., a pet), then you must place an a in front of it. This is very common.
- If the direct object could be otherwised confused for the subject, then you may/ought to place an a in front of it to make it clear it is not the subject: Come el lobo el zorro could use an a to let us know which animal was eaten. Comen los lobos el zorro does not, because there is no ambiguity.
As you can see, the first exception is what is getting at you. Always, 100% of the time, if your direct object is a person (or pet), use a for direct objects. You can actually simplify this to, regardless the object, just use a if it's a person (because indirect objects can also take a).
1. There is a difference between these two: a allows redudancy with object pronouns (di algo a Juan or le di algo a Juan) and in fact requires it when the explicit indirect object is a pronoun itself (like mí, ti, él, ella, etc). Quite differently, para categorically rejects the redudancy (only di algo para Juan) such that when para is seen with an indirect object pronoun (as in le di algo para Juan), the indirect object pronoun indicates a third person, and the para clause is a sort of obviative — effectively, a fourth person.