How to use API and hooks in WHMCS?

RobinF

New member
Due to an upcoming new law in the Netherlands it will be required to inform a customer when you are about to renew a subscription. Right now WHMCS does not support notifying customers automatically when their package is about to expire so I'm looking to create my own event.

What I want to do is send an automated e-mail to any client with a package that is set to be renewed in less than 30 days. I already made the e-mail template in WHMCS, but I have no idea how to make it send it out to the relevant clients at the right moment.

WHMCS support told me to use action hooks and the API to accomplish this but I didn't get much info aside from that.

Anyone have a clue on how I would do this?
 
Due to an upcoming new law in the Netherlands it will be required to inform a customer when you are about to renew a subscription. Right now WHMCS does not support notifying customers automatically when their package is about to expire
WHMCS automatically invoices clients in-advance of their renewal date, which is before the subscription (money sent by PP etc) takes place - so you're already covered - just set the appropriate number of days in your config :D
 
Wish it were that easy. Not paying an invoice is not a common way of allowing a service to be canceled. In the Netherlands we're not allowed to just cancel an invoice and delete it for example. We'd have to send a credit invoice to cancel the original invoice.

Aside from that, by generating the invoice I'm already renewing the customers service (for the law), paid or not.

So it's important that the notice goes out before any kind of invoice is generated to begin with. I know, it's stupid. But I don't make the laws.
 
There are some action hooks specifically for invoicing, which as others have pointed out, happen around the time an account is due to be renewed (or in your case, expired).

I'd also have a look in the WHMCS forums, as if this is law and regulation, it sounds like many other hosts in the Netherlands will be in the sam situation - someone in the community may have already coded a module up, or have provided the code for a solution.

Alternatively, if you're decent at PHP you could write a quick cron job which checks for upcoming expiry dates via mysql and sends an email using a basic mail function. Not as easy as a module I know, but an option nonetheless.
 
Thanks for all the replies, everyone. Luckily it turns out there are a few alternatives to dealing with this than just this complicated solution.
 
Back
Top