Download the PHP package jawabapp/chat-sdk without Composer
On this page you can find all versions of the php package jawabapp/chat-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package chat-sdk
JawabChat App SDK
JawabChat is a chat application that you can integrate to your services easily to gain your structure a chat feature. This library will help you to integrate chat feature easily.
Installation
you can use composer directly to install this library to your application:
Your Responsibilities
Before using JawabChat application as service, your service needs to provide some features.
Service Token
We are expecting a service token as a string to be able to reach your services. We will send this token in the header as "Accept-Token" field to reach your endpoints.
User API
We need a user API to get your user information to our side. We will create a user for you to chat with your clients with this user. Your user phone will be our primary key of the service. You should send a unique user phone number. You need to create an API endpoint which is working with a service token, have already provided by you.
We will send you a request to get user information like below:
The response of this API should be JSON and the structure should be like below:
Topic List API
We need a topic endpoint to handle topics of the chats. We will send a request to get the topics while creating a chat for you:
This endpoint should return a JSON response and the structure should be like below :
SDK Features
Send Channel
You can send a message to your users.
Receive Channel
You can receive the response of the user on JawabChat. For this, you only need a token:
Response Message Structure
- topic string
- message_id string
- content_type [image, text]
- content url (string)
Response Sender Structure
- phone string
- nickname string
This feature will work forever. Maybe, you need to work this feature as a service.
Supervisor
http://supervisord.org/index.html
Adding a Program
The program configuration files for Supervisor programs are found in the /etc/supervisor/conf.d directory, normally with one program per file and a .conf extension. A simple configuration for our script, saved at /etc/supervisor/conf.d/chat_receiver.conf, would look like so:
Once our configuration file is created and saved, we can inform Supervisor of our new program through the supervisorctl command. First we tell Supervisor to look for any new or changed program configurations in the /etc/supervisor/conf.d directory with:
Followed by telling it to enact any changes with:
Any time you make a change to any program configuration file, running the two previous commands will bring the changes into effect.
Managing Programs
Once our programs are running, there will undoubtedly be a time when we want to stop, restart, or see their status. The supervisorctl program, which we first used above, also has an interactive mode through which we can issue commands to control our programs.
To enter the interactive mode, start supervisorctl with no arguments:
When started, supervisorctl will initially print the status and uptime of all programs, followed by showing a command prompt. Entering help will reveal all of the available commands that we can use:
supervisor> help
To start in a simple manner, we can start, stop and restart a program with the associated commands followed by the program name:
Using status we can view again the current execution state of each program after making any changes:
Finally, once we are finished, we can exit supervisorctl with Ctrl-C or by entering quit into the prompt:
And that's it! You've mastered the basics of managing persistent programs through Supervisor and extending this to your own programs should be a relatively simple task. If you have any questions or further advice, be sure to leave it in the comments section.
Credits
- Ibraheem Qanah
- All Contributors
All versions of chat-sdk with dependencies
guzzlehttp/guzzle Version *
ext-json Version *
bluerhinos/phpmqtt Version @dev