This library enables sending messages through the LINE Messaging API using ESP32. It's designed to be compatible with the SPRESENSE_ESP8266_LINE_Messaging_API library while utilizing ESP32's native WiFi capabilities.
- Download this library and save it as a ZIP file
- Open Arduino IDE, go to "Sketch" → "Include Library" → "Add .ZIP Library..."
- Select the downloaded ZIP file to install
#include "ESP32LineMessenger.h"
// WiFi and LINE configuration
const char* ssid = "your_wifi_ssid";
const char* password = "your_wifi_password";
const char* accessToken = "your_line_access_token";
// Create library instance
ESP32LineMessenger line;
void setup() {
Serial.begin(115200);
// Set access token
line.setAccessToken(accessToken);
// Connect to WiFi
if (line.connectWiFi(ssid, password, true)) {
// Send message
line.sendMessage("Hello from ESP32!", true);
}
}
void loop() {
// Additional code if needed
}ESP32LineMessenger(); // Basic constructor
ESP32LineMessenger(const char* token); // Constructor with access tokenvoid setAccessToken(const char* token);bool connectWiFi(const char* ssid, const char* password, bool showConnect = true);ssid: WiFi SSIDpassword: WiFi passwordshowConnect: Whether to show connection status on serial (default: true)- Returns:
trueon success,falseon failure
bool sendMessage(const char* message, bool showSend = true);message: Message to sendshowSend: Whether to show send status on serial (default: true)- Returns:
trueon success,falseon failure
bool isWiFiConnected(); // Check WiFi connection status
void setDebug(bool debug); // Enable/disable debug mode- Go to LINE Developers
- Create a new provider
- Create a Messaging API channel
- Issue a long-lived channel access token
- Set the token in your program
ESP32_LINE_Basic: Basic usage exampleESP32_LINE_Advanced: Example with scheduled messages and button-triggered sending
- This library is specifically designed for ESP32
- SSL certificate verification is disabled (recommended to use proper certificates in production)
- Usage of LINE Messaging API is subject to LINE's Terms of Use
- Class name changed from
LineMessengertoESP32LineMessenger - Uses ESP32's native WiFi library instead of ESP8266's AT commands
- Added features like WiFi connection status check and debug mode
- If WiFi connection fails, verify SSID and password
- If message sending fails, check the validity of your access token
- Enable debug mode for detailed error information
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.