Is it possible to add custom actions

Hello, I want to ask, if it is possible to add custom actions. I want to able to control the remote device by writing via snmp. I could do a script with snmp commands. But how to add that script to icinga api actions.
I am planning to use icinga API to monitor devices, but I also want to implement control by using same API.
What should I do? Where should I look for info?