Jump to content


Senior Member
  • Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About jwong

  • Rank
    Junior Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello, I'm working on a python script and i'd like to insert customfields on the updateclient call. This is a json of tblcustomfields {"id":"2","type":"client","relid":"0","fieldname":"status","fieldtype":"dropdown","description":"","fieldoptions":"notVerified,verified","regexpr":"","adminonly":"on","required":"","showorder":"","showinvoice":"","sortorder":"0","created_at":"0000-00-00 00:00:00","updated_at":"0000-00-00 00:00:00"}, tblcustomfieldsvalues {"id":"5","fieldid":"2","relid":"297","value":"verified","created_at":"2019-11-05 04:38:50","updated_at":"2019-11-05 04:38:50"}, {"id":"6","fieldid":"3","relid":"297","value":"","created_at":"2019-11-05 04:38:50","updated_at":"2019-11-05 04:38:50"}, {"id":"7","fieldid":"4","relid":"297","value":"","created_at":"2019-11-05 04:38:50","updated_at":"2019-11-05 04:38:50"}, {"id":"8","fieldid":"6","relid":"297","value":"","created_at":"2019-11-05 04:38:50","updated_at":"2019-11-05 04:38:50"} Now when it comes to pushing the data, the documentation isn't clear. All i'm seeing is; customfields|string|Base64 encoded serialized array of custom field values|Optional Based on web searching, its not getting clearer. Here is a snipped of my last code. cstatus = { "fieldid": "2", "value": "verified" } encoded = base64.b64encode(b'cstatus') with requests.Session() as session_whmcs_bounces: session_whmcs_bounces.headers.update(whmcs_auth) whmcs_bounces_payload = { 'identifier': whmcs_ident, 'secret': whmcs_secret, 'responsetype': whmcs_response, 'action': "UpdateClient", 'clientemail': email, 'status': "Inactive", 'marketingoptin': 0, 'notes': '--- Bounces ---\nCreated: %s\nStatus: %s\nReason: %s\n---Bounces---' % (timeconvert,status,reason), 'customfields': encoded } i tried using the json.dumps/json.loads techniques to serialize the data, but in my mind i don't have to since the data is already serialized, i just have to encode it. I also tried variations, as in just the ID and value { "2": "verified" } / { "id": "2", "value": "verified" } and different combinations. Been at it for a few hours and can't seem to find much information. Ideally i'd like to update multiple sections based on the json reply. The flow i'm trying to achieve is this; Receive client information from datasource. { "email": "example@domain.tld", "type": "prospect", "status": "verified", "firstName": "Jon", "lastName": "Wong", "position": "Senior Linux Administrator", "sourcePage": "https:\/\/www.linkedin.com\/in\/jonthewong" } Add it or Update it into WHMCS Use extra fields as customfields. In this case, type/status/position/sourcepage The python code shown is for a separate part of the project, but the customfields base64,serialization still apply. If anyone has any experience or suggestions i'd appreciate it. Thank you. On a side note, I'm using Python 3.7 + requests/time/json/base64/getpass I'm open to adding other libs, but ideally i'd prefer using the ones i already have build for this env.
  2. Just a quick tip to confirm. Did you make sure your API user/roles are allowed to use the "GetClientsProducts" call? Not sure if your code has debug, but you should receive the following error if thats the case. { "result": "error", "message": "Invalid Permissions: API action \"getclientsproducts\" is not allowed" } Providing logs or sample code might help us help you.
  3. jwong

    Update custom client fields via API

    Just for future reference and for other people searching. customfields are supported via the api. https://developers.whmcs.com/api-reference/updateclient/
  4. Hello, During my process of developing a python api client for WHMCS that would get bounce feedback from Sendgrid and then UpdateClient. I'm using this method to make sure clients have valid emails. Even after the email confirmation that WHMCS provides their emails can get stale or even bounce back due to RBL etc. Right now I'm looping bounce data from Sendgrid and using the "UpdateClient" api call. https://developers.whmcs.com/api-reference/updateclient/ When i update the client i can't seem to set "marketingoption" to False or None. I did manage to pass a '0' value and it resolved my issue. I did not get any feedback from the api in the response on why even with skipvalidation to false. I think it might be useful to add that tidbit in the documentation, until then, figured i'd post it here for reference. As an overview here is my flow. Client signup Receives confirmation email Accepts marketing emails / optin X time goes by SendGrid starts giving you email Bounce reports Loop into the bounces and UpdateClient set client to inactive (closed seems harsh, since they might still have a service and are billed) update "mkaretingoptin = 0" add note with reason endloop I'd love to hear how people deal with bounces and if anyone else has this type of problem.
  5. jwong

    Knowledgebase RSS feed

    Would it be possible to include the time the article was posted? It would help with products like hootsuite.
  6. Hello, I'd like to change the way the knowledge base permalinks are displayed. Essentially i'd like to remove the category ID number in the links. Current format: domain.com/knowledgebase/1/Accounts , /2/Domains , and so on. I'd like to remove the numbered prefix. - - - Updated - - - I'd also like to remove the .html extension from actual articles. ideally id want the KB articles to be domains.com/knowledgebase/categoryname/article
  7. jwong

    Opensrs existing clients module

    I've tried the adding the sql statement to my system and i've inserted the domain/user/password combo and i'm still unable to get it to work. Unable to lock/unlock can't update NS server. Can't update contact info or receive EPP code. Also its worth nothing that i'm using the OpenSRSPro module supported by OpenSRS (https://opensrs.com/site/integration/tools/whmcs) I have not tried using the default module since OpenSRS actively supports there module.
  8. jwong


    My question is if a client has purchased multiple domains, example 12345678.com/net/org its safe to assume based on the math above that the username would be "12345678" and the password would be c4ca4238a0 assuming his userid was 1 for the .com domain. But what of the other domains? So if it takes the first 8 then all the usernames would be 12345678 and the password would change based on domain id. So my question is, for this fix to work how should i enter the proper information in OpenSRS's domain management system. Also since i'm on 5.1 i've tried the mod_opensrs table fix with out success. the table is created, i've inserted "12345678.com" in domain, username & password in the right sections. My testing was done with 2 domains on different TLD's. I cannot change the contact info, cannot get the EPP code (even if it says it will send it to the domain owner with a successful msg.) Any help would be appreciated.

Important Information

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