Sending a chat message to a bot using Bot Libre PHP SDK |
To begin, you should first set up the PHP server and the SDK. Please follow the instructions provided in this post: https://botlibre.com/forum-post?id=47255847 Firstly, ensure you meet these prerequisites: Prior to testing the API, please ensure you have the following: user credentials, password, and your application ID.
Additionally, you will need to include the bot's ID. This can be achieved through the "testSendChatMessage()" function.
Note: For other API requests, for example the creation of a new post in a forum, you'll need to provide specific IDs, such as the forum ID.
Proceeding to testing the api, Once that’s done, we need to start up the PHP server. Navigate to the directory where the Bot Libre PHP SDK is located using the terminal or command prompt on windows. For example, if the Bot Libre PHP SDK is located in the "D:\php-8.2.3" directory, you can navigate to that directory by typing "cd D:\php-8.2.3" and pressing Enter. Once you are in the PHP SDK directory, you can start the PHP development server by typing the following command:
This will start the PHP development server on your computer, listening on port 8000. You can then access your PHP application by navigating to "http://localhost:8000/index.php". To proceed with testing, select "post-chat" from the dropdown menu, and then click the "Test" button located next to the dropdown menu. After clicking the "Test" button, closely monitor the API logs to observe the ongoing activities. You can review each POST request for a detailed overview of the activity. These logs can provide valuable insights into the behind-the-scenes operations. To gain a better understanding of the functions and their requirements, please review the remaining functions in the "index.php" file. |
|
|
|
|