Table of Contents
- 1. Creating an Account or Logging In
- 2. Downloading the Sample Project from GitHub
- 2.1 Accessing the GitHub Project
- 2.2 Downloading the Project
- 2.2.1 Adding the NuGet Package
- 2.3 Project Structure and Default Settings
- 2.4 Setting Up a Reverse Proxy
- Setting Up Ngrok
- 3. Adding the Ngrok URL to the Project
- 4. Configuring Developer Settings in CxPerium
- 4.1 Adding the Hook Address to the Project
- 4.2 Generating an API Key
- 5. Testing the Setup
- Congratulations!
1. Creating an Account or Logging In
- Go to app.cxperium.com.
- If you don’t have an account, click on “Sign Up” and create an account by providing:
- Full Name
- Email Address
- Password
- Don’t forget to verify your activation email.
- If you already have an account, log in using the “Sign In” option.
2. Downloading the Sample Project from GitHub
2.1 Accessing the GitHub Project
- Open a web browser and go to https://github.com/cxperium/CxPerium.BotTemplate.git.
- You can review the project description on the page.
2.2 Downloading the Project
- Click on the “Code” button.
- Choose one of the following methods to download the project:
- Download ZIP: Download the project as a ZIP file to your computer.
- Clone with HTTPS: If Git is installed, run the following command in the terminal or Git Bash:git clone https://github.com/cxperium/CxPerium.BotTemplate.git
2.2.1 Adding the NuGet Package
- After downloading the project, you need to add the CxPerium private NuGet package to the project.
- Required package: QSoft.CxPerium
- If you do not see this package in the CxPerium private NuGet repository, follow these steps:
2.3 Project Structure and Default Settings
- After downloading the project, open it using a development environment (e.g., Visual Studio).
- By default, the project runs on http://localhost:3978/. If you need to change this port, modify the launchSettings.json file within the project.
2.4 Setting Up a Reverse Proxy
- When sending a message to WhatsApp from the CxPerium sandbox number, a reverse proxy is required to route the message to the developer’s local machine at http://localhost:3978/.
- A tool like ngrok or a similar reverse proxy application can be used for this.
Setting Up Ngrok
- Download and install Ngrok from https://ngrok.com/.
- Run the following command in the terminal:ngrok http 3978 –host-header=”localhost:3978″
- Ngrok will generate a public URL (e.g., https://xxxxx.ngrok.io/). Make sure to note this URL.
3. Adding the Ngrok URL to the Project
- Locate the appsettings.json file within the downloaded project files.
- Open the file using a text editor (e.g., Visual Studio Code, Notepad++).
- Update the BotUrl field with the URL provided by Ngrok. Example:”BotUrl”: “https://xxxxx.ngrok.io”
- Save the file.
4. Configuring Developer Settings in CxPerium
4.1 Adding the Hook Address to the Project
- Locate the appsettings.json file within the downloaded project files.
- Update the HookUrl field with the URL obtained from the Assistant > Developer Settings screen. Example:”HookUrl”: “https://hook.example.com”
- Save the file.
4.2 Generating an API Key
- Log in to your CxPerium account and navigate to the Settings menu.
- Open the API Integration tab.
- Click the Regenerate button to generate an API Key.
- This process will provide you with a new API Key.
- Add this API Key to the appsettings.json file in the project. Example:”ApiKey”: “your_generated_api_key_here”
- Save the file.
5. Testing the Setup
- After running the project, you can test it using the WhatsApp sandbox number provided by CxPerium:
- Sandbox number: +908503094552
- Send the message “Hello” to this number via WhatsApp.
- The chatbot should respond with “Hello World”.
- Alternatively, you can open the sandbox number directly in WhatsApp by clicking this link: https://web.whatsapp.com/send/?phone=908503094552&text=hi
After completing these steps, you should be able to verify that your chatbot is working correctly.
Congratulations!
Your CxPerium-based chatbot is now successfully running.
In the next steps, we will provide detailed information about the project structure and the lifecycle of messages.
—
Source: https://github.com/cxperium/CxPerium.BotTemplate/wiki