I'm trying to use the WHMCS API / provisioning module to auto-create a mysql database for a new WHM / cPanel client after their order for hosting goes through.
It seems like it should be simple enough to do, but I can't find anything about it in the docs. The WHMCS module is connected to the WHMCS mysql instance, but I would want to be connecting the "main" local mysql instance where the client's data is held.
Would I simply connect to localhost in the provisioning module, and create a new database and user? Or is there a more robust way to handle this without going outside the WHMCS / WHM system.
Please provide examples if possible!
Thanks for any help
I would use whmcs's hooks. A hook is function that is fired as a result of an internal action.
You should look for the invoice items after the invoice is paid but before the email in case you want to send database information if not then after paid should be fine
This would go in billing dir / includes / hooks
and it would look like
function init_InvoicePaidPreEmail($vars) {
// create your db code here be sure to look for the specific invoice item "order for hosting"
}
add_hook("InvoicePaidPreEmail",1,"init_InvoicePaidPreEmail","");
Related
I've read a lot of questions and look after a lot of sources, but I could not get the idea. That's because there is lot redirects happening with my application, let's see a quick look over the steps.
Step1. Login with [MyApp1]
1.1 get tokens via POST method
Step2. [Save tokens temporarily] < Stuck here.
Step3. Login with [MyApp2]
3.1 get tokens via POST method
Step4. Encrypt all tokens
4.1 Save it to MySQL Database
I do not know what is best to save the data temporarily, I looked over sessions and Redis, I am working on Node.js Web Application, HTML with a Server and MySQL Database.
Perhaps store them in the query? OAuth2 provides a state query parameter that is applied on redirect so your application can pass some information to itself after redirecting.
I have a HubSpot account where my team updates my customers' details in three sheets such as Contacts, activities etc. Now I want to integrate the data available in these sheets to my MySQL database.
I want the changes done in the HubSpot sheets to be automatically transferred to my MySQL database.
Is there any way to do so?
Unfortunately, there is no any direct connector between HubSpot and MySQL out of the box. You have to create all the relevant tables yourself in your MySQL database and then populate them with the desired data via HubSpot APIs, for instance, use https://legacydocs.hubspot.com/docs/methods/lists/get_lists to retrieve all contact lists.
Alternatively, you can look at some commercial solutions such as Zapier, Skyvia, Hull etc.
For example, configuration of a Zapier connector is straight forward:
Sign up for free here, it will give you a chance to explore Zapier features within 2 weeks;
Authenticate MySQL in Zapier -> MyApps -> Connect a new account (select MySQL) to allow Zapier to access your MySQL account;
Authenticate HubSpot similar to the above step for MySQL;
Pick up HubSpot app as a trigger to kick off your data sync, for example, "Contact Recently Created or Updated";
Choose a resulting action from the MySQL app, for example, "Update Row";
Select the data you want to send from HubSpot to MySQL;
That is all, enjoy!
You can trial Zapier for 2 weeks, it should be enough to validate the integration aspect before signing up for a certain commercial plan; once logged in to Zapier you can see all available plans here.
Sequin recently launched a HubSpot/Postgres integration along the lines you're describing. There's a technical writeup describing how it works, which should be cross-applicable to MySQL.
The API strategy:
Use list endpoints to establish a base state in SQL.
Use /search endpoints and a stored cursor: fetch new changes and apply them to the base state.
I wrote a longer post on why we don't use the Webhooks API for this.
Slack offers a simple oauth method (sign in with slack) for existing slack users to cross-authenticate to "my platform," whatever that may be. I've been able to do everything on the slack side, including getting a real name and email address from slack's identity scope and finding my user in the drupal mysql database users table.
But how can I actually log this user in and create/regenerate a session programmatically? Is there a way to do this from command line using drush or something, without having to edit the php, because that's not my preference. I thought I could just modify the timestamps in the database, but it looks like the session object requires more than that.
So given a drupal uid, and access to the drupal DB, what do I do?
You can use Masquerade module to generate session for any Drupal user no matter what was his creation source
It sounds like you're looking for Selenium. It's a command line browser interface used to create test scenarios and web scraping tools. You can build code which implements selenium with java, python, and I think a few other languages. The tool has been such a life saver for me! I hope this helps.
Since both systems are on the same server, I wrote a python script to modify the drupal7 mysql database and "log them in" without using any drupal environment tricks. By updating the access timestamp for the user, the system treats as logged in. I also added code to run drush -user-create from the command line if the slack user's email doesn't match the drupal users table in the database.
This was definitely not my preferred route, but it seems drupal's own tricks are more along the line of a bot impersonating a user anyway.
I did not figure out how to create a session cookie and provide it to the user during login, so if you know how to do that, I'd love to know!
I am trying to work out an application using
Dotnet Core 1.0
MySQL as the data store
Authetication and Authorization
Entity Framework
Ubuntu 16 machine
I have succeeded in creating a sample API to fetch data from MySQL database using entity framework. Now I want to introduce Authentication using email as username and Password.
I tried several method from different blogs but unable to achieve this.
What I am trying to achieve is Custom Authentication for the api where user will send username and password to login Api. The login Api will return an access token and refresh token. Using this access token, the user can call other APIs.
Later on I want to add Google and Facebook Authentication too.
Is there a way to do this?
Everything you want to achieve is possible. However there are some caveats.
Yes you can do this. You will need to use the resource owner grant which is turned off in identityserver 4 by default. I suspect the reason for this is because passing user credentials into an application is an anti-pattern, it is there to typically support legacy systems, also it does not authenticate users in the explicit sense because the credentials could come from an un-trusted source (as an example). You can read up about the grant's generic value here. You can find samples here.
The safer pattern is to use something like Implicit Flow which is good practice if you cannot guarantee trust between clients and your API.
As for social logins this is possible. There are tonnes of samples online but here are the official docs.
There is a project on github, https://github.com/diogodamiani/IdentityServer4.MongoDB and a corresponding nuget package that will send you in the right direction. It's obviously MongoDb, but the same premise applies.
I've created my app and SQL container on Google App Engine. All is ready to go, I just need to grant network access to the SQL server from the application. When clicking the Add Item button, then entering the Application ID (I verified through what appears to be an ancient deprecated interface) then clicking save I get the following error:
Could not complete the operation. Dismiss
I've read the instructions and as far as I can tell this is the correct method. It's the same region as the App. Tried us-east and us-west.
I created another SQL instance just in case with the same results.
I checked the dns records of the provided application URL and added the 4 IPv4 and IPv6 addresses that were returned just in case I could do it that way. The app still can't connect to the database.
I'm not sure what to try next, does anybody have an idea how to allow access in this situation?
I created my Project in US-east1 originally, had the same problem as above. Went back and created another project in US-central. This problem "Could not complete the operation. Dismiss" went away. Easy way to tell that it is working, the "Preferred location" will auto populate with "Follow App Engine app", the "App Engine application id" will auto populate with your project app id, the "Authorized App Engine applications" will auto populate with the project app id as well.