Trigger laravel event from wordpress - php

I'm currently working on a laravel app.
The same app is already running on wordpress and through the laravel application we are going to add some additional features in original application.
The laravel will run on the subdomain.
Here is the thing:
On wordpress website, we are publishing different public articles but on the publishing of these articles we need to send an email to either "all employees" of company or "all managers" of the company.
The company employees detail is stored and available in laravel.
I was hoping that there'll be a way through which on article publishing, I will give two options to the user on wordpress: "Send email to employees"/"send email to managers" and on selection of any of the option, email send event will be triggered from my laravel website.
I've almost no experience of wordpress. I was trying to google it but couldn't find any helpful links.

WordPress works quite different then laravel, and is working with many hooks..
You could monitor post status changes with: https://codex.wordpress.org/Plugin_API/Action_Reference/publish_post
You have to implement the email sending your self inside this hook,
And also trigger a webhook against your laravel endpoint.
The publish button in wordpress does not allow you to select who to send an email.., But this can be build with custom fields / meta data on your post.
Quite depends on how you would like to implement that.
Unfortunaly WordPress does not work with composer by default therefore you don't have an easy way to get packages like Guzzle to send your request to your larvel endpoint.
WordPress has some build in methods to do REST calls, see:
https://developer.wordpress.org/reference/functions/wp_remote_request/

Related

How to build a basic web app on WordPress site using AWS API Gateway

I want to build a simple Software-as-a-service web application that performs web scraping - the result per execution will be a table of results with several rows and columns. For the front-end, I wanted to build the website using WordPress since I am familiar with making basic websites there and like the plugins available. For the backend I plan on using AWS Lambda to perform the task serverless-ly. The user will log in to the site, then when they want to use the service will enter some keywords via a form, and that will send HTTP request to AWS API Gateway, which is connected to my Lambda function. Currently, the AWS Lambda function writes results into AWS DynamoDB as it goes - perhaps I need to write a second HTTP request method to query the results, or return the results in the same method that scrapes them instead.
Even after hours of googling, there are several areas in which I am unsure how to proceed, or if I have chosen the right path (I have no prior experience in this area.) Two of the biggest puzzles I have currently though are:
How can I use WordPress to send data to AWS API Gateway? Do I need to write some PHP code and if so what does it look like and where should I put it?
How can I present the results on WordPress site for the user? Should I keep the results saved on DynamoDB and query them when I want to present them, or should I store the results on the WordPress database? Ideally they would see a big table and have options to export to CSV, for example.
Thanks for your help and patience.
Cheers,
jack
There are a couple of possible ways this can be accomplished. One way is to just use webhooks. Most form plugins come with the option to use webhooks and doing it this way is pretty straightforward. Here is an article from WPForms on how to configure it WPForms and Webhooks. Below is an example of how I have used it. The example shows a form that sends data to AWS API Gateway which triggers AWS StepFunctions and also puts the customer information in DynamoDB
WPForms Webhook to AWS API Gateway

Building link to post in facebook business manager

We are building an app that creates campaigns and publishes these on our users facebook pages trough our business manager account. We have one part here where we want our users to be able to view their post on business manager. Mailchip does this for example using the following link format:
https://business.facebook.com/{page-id}/posts/{some-id}
The problem we have though is that we can't find the last ID to place in the URL. None of the ones we've found from the API works (campaign_id, ad_id, ad_set_id, ad_creative_id, object_story_id etc).
It is possible to get to this link from inside the business manager if we go trough the notifications and click on a notification related to the post. It perhaps would be possible to go this way but we also can't find anything related to this in the documentation.
Anyone knows how to retrieve this ID?

Fetching content from webhook wordpress?

I am developing a web app which, among other things, enables users to write a small text, have it saved, and automatically posted to their wordpress blog.
I am wondering about Wordpress as my platform, which has already some features that I need.
Wordpress has webhooks that sent notifications to other websites. I would like to know if it is possible to send content [short text] with the notifications and display it as a post in the final wordpress blog.
Other suggestions are also welcome.
Thank you very much.
I think you are asking if you can use Wordpress as the base of your new web app, and use the webhook functionality in Wordpress to send data to other Wordpress blogs.
If this is correct, you can use webhooks to send data from Wordpress to somewhere else. Wordpress allows you to send webhooks when a new post is created, when a new comment is made or when a new page is created.
Webhooks are outbound-only and they are one-sided, that is to say that you can get Wordpress to send a webhook with the content you want, but you have to have something on the other side to catch the incoming data. That thing must understand what Wordpress webhook data looks like and how to call the Wordpress API on the receiving side.
Wordpress does not understand how to receive webhooks, even if they are sent by another Wordpress site.
You could accomplish what you want by writing a Wordpress plugin that could call the other Wordpress via api. The call you would want is here:
Wordpress API call to create a post
Unfortunately, there are very few options in terms of handling incoming webhooks apart from writing custom code to catch the webhook and do something with it. The company I work for created something to do things like this, but it's still in private beta. (see my profile if you are interested)

Create a broadcast service for my website in PHP

I have created a dashboard using PHP and Wordpress, the problem i'm facing now is that I need to create an alert or a message when ever a new data has arrived in any users dashboard. So, I need to send the users that are currently online in the dashboard, a notification that a new data has arrived for them.
Whenever a data has been added by me for a particular user, an automatic notification should be shown on the that users screen if he is online. I have created the dashboard, but I don't know how to implement this notification.
In short, I want to create something like a push notification inside my website.
Use Atmosphere framework for braodcasting any messages. This essentially uses Websockets in the implementation. But its very easy to do.

Training registration in PHP

I would like to do a site in PHP/MySQL using either Drupal/Joomla/Wordpress that allows me to have class list with description/date and students can sign up to pay for it. I prefer Wordpress if there is some package already. The idea is to have students to pay via Paypal. For backend, Admin should be able to manage class, check students status.
The reason I want to do this is because I have a small company and I want to do special workshop once in awhile.
Any recommendation on something already built close to this?
You can accomplish this with WordPress and one of several event registration plugins. These two plugins integrate with paypal
http://wordpress.org/extend/plugins/advanced-events-registration/
http://wordpress.org/extend/plugins/event-registration/
Check out this blog article that mentions more plugins for event registration
http://www.moongoosedesigns.com/event-and-event-management-registration-plugins-for-wordpress/
http://eventespresso.com/ is the evolution of advanced events registration. It's good, and does exactly what you need. I use it for just that on firstlineeducation.com

Categories