Jump to content

WHMCS Local API Can't Use Admin User


dreadiscool

Recommended Posts

Hello everyone,

 

I've been writing a server module, and I'm stuck on one part, using the localAPI to send an automated email. This is the code in question

 

$values["customtype"] = "general";

$values["id"] = $params["clientsdetails"]["id"];

$values["customsubject"] = "<email subject>";

$values["custommessage"] = "<email message>";

 

localAPI("sendmail", $values, "1");

 

I have tried running localAPI with my admin username and my admin id (1, as shown above). However, using both of those results in the error 'No matching admin user found'. Is there something specific I have to enable to allow my admin account to be used for API accesss?

 

Thanks in advance!

Link to comment
Share on other sites

Use the username of the admin for your API call. Example:

 

$results = localAPI(
   'sendemail',
   array(
       'custommessage' => '<nowiki><p>Thank you for choosing us</p>
<p>Your custom is appreciated</p></nowiki>',
       'customsubject' =>'Demo Client Email', 
       'customtype' => 'general',
       'id' => '1'
   ),
   'someAdminUsernameHere'
);

 

Also, their administrator role group would need API Access permission. Have a look here.

Edited by TekStorm Inc - James
Link to comment
Share on other sites

  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated