ChatBot API Schnittstelle

Code-Beispiele

Multilanguage-Chat

/getBotLanguages (Swagger)
/updateUserLanguage (Swagger)
/sendMessage (Swagger)

Ihre letzte Absender-ID :

								 
<?php
$botIdentifier = YOUR_BOT_IDENTIFIER;
$clientId = YOUR_CLIENT_ID;
$url = "https://bot.chatbot4you.de/restApi/cb4you/action/getBotLanguages?botIdentifier=YOUR_BOT_IDENTIFIER";
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_POST => 1,
    CURLOPT_URL => $url,
    CURLOPT_POSTFIELDS => [
        "currentHref" => YOUR_CURRENT_PAGE_URL
    ],
    CURLOPT_SSL_VERIFYPEER => false
]);
$languages = curl_exec($curl);
curl_close($curl);
$url = "https://bot.chatbot4you.de/restApi/cb4you/action/updateUserLanguage?botIdentifier=YOUR_BOT_IDENTIFIER";
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_POST => 1,
    CURLOPT_URL => $url,
    CURLOPT_POSTFIELDS => [
        "senderId" => $clientId,
        "currentHref" => YOUR_CURRENT_PAGE_URL,
        "user_language" => YOUR_LANGUAGE_CODE,
    ],
    CURLOPT_SSL_VERIFYPEER => false
]);
$response = curl_exec($curl);
curl_close($curl);
$url = "https://bot.chatbot4you.de/restApi/cb4you/sendMessage?botIdentifier=YOUR_BOT_IDENTIFIER";
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_POST => 1,
    CURLOPT_URL => $url,
    CURLOPT_POSTFIELDS => [
        "clientId" => $clientId,
        "currentHref" => YOUR_CURRENT_PAGE_URL,
        "message" => YOUR_MESSAGE,
        "tempId" => YOUR_TEMP_ID
    ],
    CURLOPT_SSL_VERIFYPEER => false
]);
$response = curl_exec($curl);
curl_close($curl);
?>