How to hack a module which has not API
Usually there are two situations: your hack may be useful for other users or your hack is very very custom and is not likely to be useful for other users.

In the second case you can go with arpitr answer.

If your hack can be useful for other users (like this case) you should open a new Feature request or bug issue in the module's issue queue where you can share your hack as patch to the module. This way:


Other people can evaluate and discuss your code and solution pointing out any mistakes or bugs you are not aware of, improving your changes.
Maintainers can commit your patch to the module so in next upgrade you don't lose your changes as changes are included in the new release.
Any ohter module's user can benefit from the new feature.


The drawbacks is that your code must fit the general usage of the module, so your feature should not break others module's functionalities or usages. This may imply more work but benefits are good enough.