WhatsApp Web Messages generally refers to the way WhatsApp delivers messages on its web platform. Here's how to integrate the solution on an existing solution already developed.
To get your key developer, please click here -->
https://whatsapp.1simple1.com
Send Message:
POST /v1/send-message-api
- Handle send message requestGet sent message:
Get /messages
- to get sent messageHeaders:
Content-Type
: application/json
,Accept
: application/json
Request type is : - POST
https://whatsapp.1simple1.com/api/v1/send-message-api
{
"number": "whatsApp number with international format",
"message": "Your Message",
"key": "Your api key"
}
use Illuminate\Support\Facades\Http;
public function sendMessage(): void
{
Http::withHeaders([
'Accept' => 'application/json',
'Content-Type' => 'application/json',
])->post('https://whatsapp.1simple1.com/v1/send-message-api', [
'key' => 'Your api key',
'number' => 'whatsapp phone number',
'message' => 'your message here',
]);
}
import 'package:http/http.dart' as http;
Future<void> sendMessageRequest() async {
// Define the URL and headers
final url = Uri.parse('https://whatsapp.1simple1.com/v1/send-message-api');
final headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
};
// Define the body of the request
final body = jsonEncode({
'key': 'Your api key',
'number' : 'whatsapp phone number',
'message' : 'your message here',
});
try {
// Send the POST request
final response = await http.post(
url,
headers: headers,
body: body,
);
// Check if the request was successful
if (response.statusCode == 200) {
// If the request was successful, decode the response body
final responseBody = jsonDecode(response.body);
print('Response data: $responseBody');
} else {
print('Request failed with status: ${response.statusCode}');
}
} catch (error) {
print('Error: $error');
}
}