Chatbot with Telegram, Wit ai, Dialogflow and CodeIgniter
- Wit AI Account.
- Dialogflow Account.
- Telegram Account.
- Linux OS (feel free to use any OS).
- Gcloud.
- Git.
- PHP.
- Ngrok.
- Create a new chatbot via BotFather.
- Store the newly created telegram bot access token in your OS environment variable by running:
export TELEGRAM_ACCESS_TOKEN=YOUR-ACCESS-TOKEN
- Enable Small Talks in your Dialogflow account.
- Store your Dialogflow project ID in your OS environment variable by running:
export DIALOGFLOW_PROJECT_ID=YOUR-DIALOGFLOW-PROJECT-ID
- Export your private key for Dialogflow integrations in JSON format
- Store the path to your JSON file in your OS environment variable by running:
export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/ordertracker-isocuo-d7882fd63303.json"
- Import the project Wit AI data into a new app on wit.ai.
- Store the wit.ai server access token in your OS environment variable by running:
export WITAI_ACCESS_TOKEN=YOUR-WITAI-ACCESS-TOKEN
Navigate to the project directory in your terminal and start your PHP local web server
php -S localhost:8000
Open a new terminal, Navigate to the project directory and start your Ngrok Server
ngrok http 8000
To set the webhook URL to your chatbot, run this in your terminal. Note: Replace YOUR_NGROK_URL with your Ngrok server URL.
curl https://api.telegram.org/bot$TELEGRAM_ACCESS_TOKEN/setWebhook?url=https://YOUR_NGROK_URL/index.php/flow/webhook
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.