Create FAQ chatbot and manage user session - php

I working on to create FAQ chatbot in PHP. I want to know that how I can build chat flow so that I can know in which question currently user is and reply based on that. Basically I want know how I can maintain session for chatbot flow for user.
I have little experience in creating chatbot. So I want to know what are the way to resolve it.

ChatBot
If you want to get started really fast I would reckon you can use something like Botman, this will let you get started with the chatbot bit, a bot that can take in a question and pass it to function which can then answer. Also since the project is open source you can have a look at how they manage sessions which can be helpful too.
FAQ Smarts
If you want to add the FAQ smarts to your chatbot, you can rely on OpenAI's completion API and use "text-davinci-003" model which can answer the questions based on the FAQs. Also, would recommend fine-tuning the model for better results.
Bear it this would be paid API but is not very expensive if users are not brute in nature and it would be very strongly recommended that the chatbot be either captcha protected or sit in an authenticated space.

Related

Effective method on broadcasting the same notification to all the users in the database

Hello guys i'm building a social network with HTML, CSS, plain JS, AJAX, MYSQLI, and PHP.
I been wondering what's the best method that you guys know personally from experience that is used to broadcast the same notification to all the users in the database.
Lets say I have a million users how would that work? I'm trying to find the most effective method on how to do this without making my database work really hard.
This is how my table look like.
I'm not asking for anyone to code for me. All i'm asking is advice on a method that works best so I can get ideas on how to code this result effectively.
You are probably looking for some pub-sub service. You can find lots of free ones to start with.
Take a look at https://cloud.google.com/pubsub/docs/ or https://aws.amazon.com/sns/
The idea is to publish the message from the server and have all the users subscribe to the channel/topic that the server is broadcasting the message to.
For a quick overview, you can refer to https://faye.jcoglan.com/

Communicating with a Wordpress database

This question is a bit wider than accepted on SO, but I need to start somewhere as I am a bit new to some things.
I am developing an iOS/Android app for a client who has an online store based on Wordpress.
Inside the app, the user logs in using their user credentials that he/she has created on the online store, where the underlying login system is handled using webrequests
His WP site has a database called store_locations consisting of longitude and latitude fields, and I need to somehow read the fields from the app.
What I am wondering is:
would I need to create a custom PHP script to access the DB?
How is security handled such as user verification?
Where is the PHP script placed on the server?
NOTE:
Please let's have a discussion in the comments first, as I might need
to fine-tune the question as per request if anything is unclear.
EDIT 1
I found the following video https://www.youtube.com/watch?v=f7ID_L91lIk
where the instructor at 19:00 to 20:51 talks about what I'm assuming would clarify question 2 from above.
If you are going to interact with Wordpress from an external source you should use WordPress REST API.
You need to fetch data from a custom database table, so take a look at Adding custom endpoints.
As you said, this is probably too broad for here. I suggest you create a plugin that gives you ajax access. You can study up on that here and then when you have more specific questions, let us know.
I understand that you asked to discuss it in the comments first, but there is just not enough to discuss here and that is asking quite a lot for an undeveloped plan.
If you have more questions, feel free to comment here.

Laravel - Multi domain using single login server?

I'm setting up around 4 Laravel 5.3 based apps at the moment, they are all part of one "ecosystem".
I plan to use a central Laravel app that will handle any user signup, user login and also hold all user details. These details will be used across the 4 separate Laravel web apps. I may also use these user details inside mobile apps in the future so I assume i'll need some sort of JWT based system to control this.
I've thought about using Laravel Passport to achieve this but I don't think this will work for this scenario. In all honesty, the documentation is not clear to me whether this is the sort of system it is designed for or if I need to use a different oAuth2 system. My understanding is it is for API authentication only, or am I wrong?
All my other Laravel apps will be on different servers so I can't share the database unfortunately. I need to implement a cross domain solution it seems.
Thanks in advance for any info on this, just to clarify that I am not asking you to code the script for me, simply to help point me in the right direction on how to do this properly - can't really show code on something I don't know!
I believe I have explained everything that I am trying to achieve here, and I have already done research but nothing seems to be clicking in my brain.
I think it depends on your business logic. Below is what i'm thinking:
If what you mean Multi Domains is the sub domains (as you mentioned login.site.com), i think the simplest way is to use site.com wide cookie with redis/memcached as the session storage solution.
If they do have different domain names, and beyond the central site, user when visit site A also want site B feature (or content, those sites are closely connected), i thought the JWT solution is the better choice.
Any other cases, choose OAuth
Well, maybe others have better ideas.

Easiest way to allow outside developers to integrate a few basic functions from my web app?

I have a small web app written in php / mysql that stores customer information and does various things with it.
One of my users has expressed interest in integrating my app with the custom software (also web-based) that they use for setting up customer appointments.
Basically they want a system where, when they create a new customer account using their online software, that information is automatically relayed to my application, to create the customer account on my end as well. This would save them having to enter the same information twice.
I am wondering what your suggestions are for the easiest way to approach something like this? Do I have to create a full-blown RESTful API? (I have never done anything like that before and am not really sure where to start with such a thing.) Or is there a simpler way?
Any ideas or suggestions would be much appreciated. Thanks (in advance) for your help!
In order for another application to communicate with yours, you will have to create some type of API, whether it be RESTful or not.
Personally, I recommend REST as it is fairly trivial to setup and there are LOTS of tutorials on the internet to show you how. If you use Zend Framework, it's 10x easier as they have a REST controller you can extend and quickly build an API with.
Something very simple, which has worked for me is to simply accept the information as a POST. The other application will send the information via POST, which you process in your php, and store it in mysql. if the data is sensitive, you can set up a cert and go over ssl.

Creating online web interface to store messages in dB and make available to an end user, use PHP / MYSQL?

I've been approached about writing a system for a client. They currently want something to replace the email approach that is currently being used.
The system is fairly simple on the surface. There is my client, who is the customer, and his clients.
His clients need to be able to create new messages which are then saved in a repository so to speak. They can also edit and delete their messages.
My client should be able to view all the messages for him (so he can process them so to speak) and essentially be able to view them, filter them through advanced filters / search criteria, through a smart looking web front-end.
My main experience in this kind of thing is using PHP/MYSQL/Oracle. I can see that it is quite easy to create a system for this using these technologies. One dB, which will have aroound 20,000 records created per year say. Allow access to my client to view, advanced filtering and searching, and to his clients to create, edit and delete.
I'm just wondering if I'm missing anything obvious here, in terms of an off-the-shelf solution? Or should I be considering some other technologies (I pretty much can use anything I have to).
Many thanks,
There are a multitude of options. I don't think any of them is better than the others for your application. I'd go with what you already know, or what you can hire people easily to create/maintain.

Categories