EditA record using event hook after account is created

Hello , One of our hosting plans is hosted on a seperate A record than the one that is defined in our DNS template. We would like to create an event hook that modifies the A record after an account is created for a specific package.

I was thinking of using the CLI in non-interactive mode via a shell script that is executed by the events hook plugin.

If I run “nodeworx -u -v -n -h -c DnsRecord -a editA” I then need to provide the record ID in order to edit the record. Unfortunately I do not have the record ID I only have the domain name available , does anyone have an example they can share with me for editing A record using CLI ?

Thank you very much.

Hi xaviercr

Good question and I have been thinking about it since I read your post this morning.

I would think this is possible but my thoughts are first, how are you going to stop the hook been used on all new siteworx accounts

I also thought, but depends upon how you use your setup, presumably from a billing panel for automation, that it might be easier to setup a reseller account, which uses your correct A record (in fact, you can set the DNS template differently as you need) and create an API key, then set this reseller up to be used for this host package.

Does that make sense, as that way you do not need hooks, and bypass the hook acting on every siteworx created.

Many thanks


Hello John ,

Thank you very much for your reply

I did think of building a solution that uses the API Key to change the A record from our billing system after that plan is purchased , how ever I thought having an event hook directly on the server would be a more elegant solution since it seems to have less moving parts.

I would prefer not to have to create a separate reseller just for one of our plans. I’m thinking I can set an event hook that applies only to the plan I am interested in by adding a conditional to my .sh file such as:

if [[ “$iw_packagetemplate” == “My Plan” ]]; then …

I would then use the CLI to modify the record for the domain , I’m just not sure what that correct syntax for this CLI command would be.

Once again thank you for taking the time to think about this.

Best Regards

Hi xaviercr

Many thanks, and I’ll have a think more sorry.

I do think from memory that the hooks run after siteworx has been created, and the package name may not be known. You may want to test this using another hook to see, perhaps use the ssl hook and see if it changes as expected when creating 2 test accounts, 1 using your hook tied to package and the other as default

If you need it quickly, I would advise open a support ticket, but if you do, would appreciate an update if possible

Many thanks