Yes, persistent and offensive messages and calls can constitute harassment. Harassment, as well as "disturbing the peace" are part of the domestic violence act, and theoretically they can be evidence the court can use to issue domestic violence restraining orders. The Court is less likely to issue a restraining order if the calls/messages are not threatening in nature.
They probably also can be used as evidence in a custody proceeding, but without more facts it is impossible to predict what would happen. The Courts are guided by what's in the child's best interest, and if your ex got full custody there must be more to the story, so it's not clear whether the messages themselves will have any impact.