Web Chat API for PHP

Administrer Chat-systemet fra API. Få adgang til eller svar på samtaler fra vores API.

Få en liste over aktive chatkanaler med {sprog}

<?
	
$class="chat";
$method="getchatchannels";
$user="user";
$password="password";

$result = file_get_contents("https://www.afilnet.com/api/http/?class=".$class."&method=".$method."&user=".$user."&password=".$password);
	
?>
<?

	$url = "https://www.afilnet.com/api/http/";
	$fields = array(
		"class" => urlencode("chat"),
		"method" => urlencode("getchatchannels"),
		"user" => urlencode("user"),
		"password" => urlencode("password"),
	);
	foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
	rtrim($fields_string, '&');
	
	$ch = curl_init();
	
	curl_setopt($ch,CURLOPT_URL, $url);
	curl_setopt($ch,CURLOPT_POST, count($fields));
	curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
	
	$result = curl_exec($ch);
	
	curl_close($ch);

		
?>
<?

	$url = "https://www.afilnet.com/api/basic/";
	$fields = array(
		"class" => urlencode("chat"),
		"method" => urlencode("getchatchannels"),
	);
	foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
	rtrim($fields_string, '&');
	
	$ch = curl_init();
	
	curl_setopt($ch,CURLOPT_URL, $url);
	curl_setopt($ch,CURLOPT_USERPWD, $user.":".$password);
	curl_setopt($ch,CURLOPT_POST, count($fields));
	curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
	curl_setopt($ch,CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
	
	$result = curl_exec($ch);
	$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
	
	curl_close($ch);
	
	if($httpcode == 401)
	{
		// LOGIN ERROR
	} else {
		// SUCCESS LOGIN
	}

		
?>
<?
	
	# This example requires nusoap
	require_once('nusoap.php');

	$class="chat";
	$method="getchatchannels";
	$user="user";
	$password="password";

	# Create SOAP Client
	$soapclient = new soapclient('https://www.afilnet.com/api/soap/index.php?wsdl');

	# Call to method
	$result = $soapclient->call($user, $password, $class, $method, '{}');
		
?>
Parameter Beskrivelse Obligatorisk / valgfri
class=chat Klasse anmodet: Klasse, som anmodningen indgives til Obligatorisk
method=getchatchannels Anmodet om klassemetode: Metode for den klasse, som anmodningen indgives til Obligatorisk
user Bruger og e-mail på din Afilnet-konto Obligatorisk
password Adgangskode til din Afilnet-konto Obligatorisk
Svar:
  • status
  • resultat (hvis status = succes), her vil du modtage følgende værdier:
    • list
      • platformid
      • platform
      • name
  • fejl (hvis status = fejl), her vil du modtage fejlkoden

Fejlkoder:
Kode Beskrivelse
MISSING_USER Bruger eller e-mail er ikke inkluderet
MISSING_PASSWORD Adgangskode er ikke inkluderet
MISSING_CLASS Klasse ikke inkluderet
MISSING_METHOD Metode er ikke inkluderet
MISSING_COMPULSORY_PARAM Obligatorisk parameter ikke inkluderet
INCORRECT_USER_PASSWORD Forkert bruger eller adgangskode
INCORRECT_CLASS Forkert klasse
INCORRECT_METHOD Forkert metode

Send en besked via chat med {sprog}

<?
	
	# This example requires nusoap
	require_once('nusoap.php');

	$class="chat";
	$method="getchatchannels";
	$user="user";
	$password="password";

	# Create SOAP Client
	$soapclient = new soapclient('https://www.afilnet.com/api/soap/index.php?wsdl');

	# Call to method
	$result = $soapclient->call($user, $password, $class, $method, '{}');
		
?><?
	
$class="chat";
$method="sendmessage";
$user="user";
$password="password";
$platform="whatsapp";
$platformid=100;
$destination="3460000000";
$message="test+message";

$result = file_get_contents("https://www.afilnet.com/api/http/?class=".$class."&method=".$method."&user=".$user."&password=".$password."&platform=".$platform."&platformid=".$platformid."&destination=".$destination."&message=".$message);
	
?>
<?

	$url = "https://www.afilnet.com/api/http/";
	$fields = array(
		"class" => urlencode("chat"),
		"method" => urlencode("sendmessage"),
		"user" => urlencode("user"),
		"password" => urlencode("password"),
		"platform" => urlencode("whatsapp"),
		"platformid" => urlencode(100),
		"destination" => urlencode("3460000000"),
		"message" => urlencode("test+message"),
	);
	foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
	rtrim($fields_string, '&');
	
	$ch = curl_init();
	
	curl_setopt($ch,CURLOPT_URL, $url);
	curl_setopt($ch,CURLOPT_POST, count($fields));
	curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
	
	$result = curl_exec($ch);
	
	curl_close($ch);

		
?>
<?

	$url = "https://www.afilnet.com/api/basic/";
	$fields = array(
		"class" => urlencode("chat"),
		"method" => urlencode("sendmessage"),
		"platform" => urlencode("whatsapp"),
		"platformid" => urlencode(100),
		"destination" => urlencode("3460000000"),
		"message" => urlencode("test+message"),
	);
	foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
	rtrim($fields_string, '&');
	
	$ch = curl_init();
	
	curl_setopt($ch,CURLOPT_URL, $url);
	curl_setopt($ch,CURLOPT_USERPWD, $user.":".$password);
	curl_setopt($ch,CURLOPT_POST, count($fields));
	curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
	curl_setopt($ch,CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
	
	$result = curl_exec($ch);
	$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
	
	curl_close($ch);
	
	if($httpcode == 401)
	{
		// LOGIN ERROR
	} else {
		// SUCCESS LOGIN
	}

		
?>
<?
	
	# This example requires nusoap
	require_once('nusoap.php');

	$class="chat";
	$method="sendmessage";
	$user="user";
	$password="password";
	$platform="whatsapp";
	$platformid=100;
	$destination="3460000000";
	$message="test+message";

	# Create SOAP Client
	$soapclient = new soapclient('https://www.afilnet.com/api/soap/index.php?wsdl');

	# Call to method
	$result = $soapclient->call($user, $password, $class, $method, '{"platform":"'.$platform.'","platformid":"'.$platformid.'","destination":"'.$destination.'","message":"'.$message.'"}');
		
?>
Parameter Beskrivelse Obligatorisk / valgfri
class=chat Klasse anmodet: Klasse, som anmodningen indgives til Obligatorisk
method=sendmessage Anmodet om klassemetode: Metode for den klasse, som anmodningen indgives til Obligatorisk
user Bruger og e-mail på din Afilnet-konto Obligatorisk
password Adgangskode til din Afilnet-konto Obligatorisk
platform Platform, som meddelelsen sendes til. Mulige værdier: 'webchat', 'whatsapp', 'telegram', 'operatør' Obligatorisk
platformid Platform-id Obligatorisk
destination Modtager, hvor chatbeskeden sendes Obligatorisk
message Besked, der skal sendes via chat Obligatorisk
Svar:
  • status
  • resultat (hvis status = succes), her vil du modtage følgende værdier:
    • Ingen yderligere værdier sendes til dig
  • fejl (hvis status = fejl), her vil du modtage fejlkoden

Fejlkoder:
Kode Beskrivelse
MISSING_USER Bruger eller e-mail er ikke inkluderet
MISSING_PASSWORD Adgangskode er ikke inkluderet
MISSING_CLASS Klasse ikke inkluderet
MISSING_METHOD Metode er ikke inkluderet
MISSING_COMPULSORY_PARAM Obligatorisk parameter ikke inkluderet
INCORRECT_USER_PASSWORD Forkert bruger eller adgangskode
INCORRECT_CLASS Forkert klasse
INCORRECT_METHOD Forkert metode
CHANNEL_NOT_FOUND Den angivne kanal findes ikke

Send en fil via chat med {sprog}

<?
	
	# This example requires nusoap
	require_once('nusoap.php');

	$class="chat";
	$method="sendmessage";
	$user="user";
	$password="password";
	$platform="whatsapp";
	$platformid=100;
	$destination="3460000000";
	$message="test+message";

	# Create SOAP Client
	$soapclient = new soapclient('https://www.afilnet.com/api/soap/index.php?wsdl');

	# Call to method
	$result = $soapclient->call($user, $password, $class, $method, '{"platform":"'.$platform.'","platformid":"'.$platformid.'","destination":"'.$destination.'","message":"'.$message.'"}');
		
?><?
	
$class="chat";
$method="sendfile";
$user="user";
$password="password";
$platform="whatsapp";
$platformid=100;
$destination="3460000000";
$type="image";
$fileurl="https://www.example.com/image.jpg";
$thumburl="https://www.example.com/thumb.jpg";
$message="test+message";

$result = file_get_contents("https://www.afilnet.com/api/http/?class=".$class."&method=".$method."&user=".$user."&password=".$password."&platform=".$platform."&platformid=".$platformid."&destination=".$destination."&type=".$type."&fileurl=".$fileurl."&thumburl=".$thumburl."&message=".$message);
	
?>
<?

	$url = "https://www.afilnet.com/api/http/";
	$fields = array(
		"class" => urlencode("chat"),
		"method" => urlencode("sendfile"),
		"user" => urlencode("user"),
		"password" => urlencode("password"),
		"platform" => urlencode("whatsapp"),
		"platformid" => urlencode(100),
		"destination" => urlencode("3460000000"),
		"type" => urlencode("image"),
		"fileurl" => urlencode("https://www.example.com/image.jpg"),
		"thumburl" => urlencode("https://www.example.com/thumb.jpg"),
		"message" => urlencode("test+message"),
	);
	foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
	rtrim($fields_string, '&');
	
	$ch = curl_init();
	
	curl_setopt($ch,CURLOPT_URL, $url);
	curl_setopt($ch,CURLOPT_POST, count($fields));
	curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
	
	$result = curl_exec($ch);
	
	curl_close($ch);

		
?>
<?

	$url = "https://www.afilnet.com/api/basic/";
	$fields = array(
		"class" => urlencode("chat"),
		"method" => urlencode("sendfile"),
		"platform" => urlencode("whatsapp"),
		"platformid" => urlencode(100),
		"destination" => urlencode("3460000000"),
		"type" => urlencode("image"),
		"fileurl" => urlencode("https://www.example.com/image.jpg"),
		"thumburl" => urlencode("https://www.example.com/thumb.jpg"),
		"message" => urlencode("test+message"),
	);
	foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
	rtrim($fields_string, '&');
	
	$ch = curl_init();
	
	curl_setopt($ch,CURLOPT_URL, $url);
	curl_setopt($ch,CURLOPT_USERPWD, $user.":".$password);
	curl_setopt($ch,CURLOPT_POST, count($fields));
	curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
	curl_setopt($ch,CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
	
	$result = curl_exec($ch);
	$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
	
	curl_close($ch);
	
	if($httpcode == 401)
	{
		// LOGIN ERROR
	} else {
		// SUCCESS LOGIN
	}

		
?>
<?
	
	# This example requires nusoap
	require_once('nusoap.php');

	$class="chat";
	$method="sendfile";
	$user="user";
	$password="password";
	$platform="whatsapp";
	$platformid=100;
	$destination="3460000000";
	$type="image";
	$fileurl="https://www.example.com/image.jpg";
	$thumburl="https://www.example.com/thumb.jpg";
	$message="test+message";

	# Create SOAP Client
	$soapclient = new soapclient('https://www.afilnet.com/api/soap/index.php?wsdl');

	# Call to method
	$result = $soapclient->call($user, $password, $class, $method, '{"platform":"'.$platform.'","platformid":"'.$platformid.'","destination":"'.$destination.'","type":"'.$type.'","fileurl":"'.$fileurl.'","thumburl":"'.$thumburl.'","message":"'.$message.'"}');
		
?>
Parameter Beskrivelse Obligatorisk / valgfri
class=chat Klasse anmodet: Klasse, som anmodningen indgives til Obligatorisk
method=sendfile Anmodet om klassemetode: Metode for den klasse, som anmodningen indgives til Obligatorisk
user Bruger og e-mail på din Afilnet-konto Obligatorisk
password Adgangskode til din Afilnet-konto Obligatorisk
platform Platform, som meddelelsen sendes til. Mulige værdier: 'webchat', 'whatsapp', 'telegram', 'operatør' Obligatorisk
platformid Platform-id Obligatorisk
destination Modtager, hvor filen sendes Obligatorisk
type Type fil, der sendes. Mulige værdier: 'billede', 'video', 'lyd', 'stemme', 'dokument', 'kontakt' Obligatorisk
fileurl URL, hvor filen, der skal sendes med chat, er placeret Obligatorisk
thumburl URL til miniaturebilledet, der ledsager filen Valgfri
message Meddelelse, der ledsager filen Valgfri
Svar:
  • status
  • resultat (hvis status = succes), her vil du modtage følgende værdier:
    • Ingen yderligere værdier sendes til dig
  • fejl (hvis status = fejl), her vil du modtage fejlkoden

Fejlkoder:
Kode Beskrivelse
MISSING_USER Bruger eller e-mail er ikke inkluderet
MISSING_PASSWORD Adgangskode er ikke inkluderet
MISSING_CLASS Klasse ikke inkluderet
MISSING_METHOD Metode er ikke inkluderet
MISSING_COMPULSORY_PARAM Obligatorisk parameter ikke inkluderet
INCORRECT_USER_PASSWORD Forkert bruger eller adgangskode
INCORRECT_CLASS Forkert klasse
INCORRECT_METHOD Forkert metode
CHANNEL_NOT_FOUND Den angivne kanal findes ikke
CHAT_NOT_FOUND Den angivne chat findes ikke
INCORRECT_FILETYPE Filtypen er forkert, kontroller de mulige værdier
INCORRECT_FILEURL Filwebadressen er ikke gyldig
INCORRECT_THUMBURL Miniaturens url er ugyldig

Få en liste over samtaler i en chat med {sprog}

<?
	
	# This example requires nusoap
	require_once('nusoap.php');

	$class="chat";
	$method="sendfile";
	$user="user";
	$password="password";
	$platform="whatsapp";
	$platformid=100;
	$destination="3460000000";
	$type="image";
	$fileurl="https://www.example.com/image.jpg";
	$thumburl="https://www.example.com/thumb.jpg";
	$message="test+message";

	# Create SOAP Client
	$soapclient = new soapclient('https://www.afilnet.com/api/soap/index.php?wsdl');

	# Call to method
	$result = $soapclient->call($user, $password, $class, $method, '{"platform":"'.$platform.'","platformid":"'.$platformid.'","destination":"'.$destination.'","type":"'.$type.'","fileurl":"'.$fileurl.'","thumburl":"'.$thumburl.'","message":"'.$message.'"}');
		
?><?
	
$class="chat";
$method="getchats";
$user="user";
$password="password";
$platform="whatsapp";
$platformid=100;

$result = file_get_contents("https://www.afilnet.com/api/http/?class=".$class."&method=".$method."&user=".$user."&password=".$password."&platform=".$platform."&platformid=".$platformid);
	
?>
<?

	$url = "https://www.afilnet.com/api/http/";
	$fields = array(
		"class" => urlencode("chat"),
		"method" => urlencode("getchats"),
		"user" => urlencode("user"),
		"password" => urlencode("password"),
		"platform" => urlencode("whatsapp"),
		"platformid" => urlencode(100),
	);
	foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
	rtrim($fields_string, '&');
	
	$ch = curl_init();
	
	curl_setopt($ch,CURLOPT_URL, $url);
	curl_setopt($ch,CURLOPT_POST, count($fields));
	curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
	
	$result = curl_exec($ch);
	
	curl_close($ch);

		
?>
<?

	$url = "https://www.afilnet.com/api/basic/";
	$fields = array(
		"class" => urlencode("chat"),
		"method" => urlencode("getchats"),
		"platform" => urlencode("whatsapp"),
		"platformid" => urlencode(100),
	);
	foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
	rtrim($fields_string, '&');
	
	$ch = curl_init();
	
	curl_setopt($ch,CURLOPT_URL, $url);
	curl_setopt($ch,CURLOPT_USERPWD, $user.":".$password);
	curl_setopt($ch,CURLOPT_POST, count($fields));
	curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
	curl_setopt($ch,CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
	
	$result = curl_exec($ch);
	$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
	
	curl_close($ch);
	
	if($httpcode == 401)
	{
		// LOGIN ERROR
	} else {
		// SUCCESS LOGIN
	}

		
?>
<?
	
	# This example requires nusoap
	require_once('nusoap.php');

	$class="chat";
	$method="getchats";
	$user="user";
	$password="password";
	$platform="whatsapp";
	$platformid=100;

	# Create SOAP Client
	$soapclient = new soapclient('https://www.afilnet.com/api/soap/index.php?wsdl');

	# Call to method
	$result = $soapclient->call($user, $password, $class, $method, '{"platform":"'.$platform.'","platformid":"'.$platformid.'"}');
		
?>
Parameter Beskrivelse Obligatorisk / valgfri
class=chat Klasse anmodet: Klasse, som anmodningen indgives til Obligatorisk
method=getchats Anmodet om klassemetode: Metode for den klasse, som anmodningen indgives til Obligatorisk
user Bruger og e-mail på din Afilnet-konto Obligatorisk
password Adgangskode til din Afilnet-konto Obligatorisk
platform Platform, som meddelelsen sendes til. Mulige værdier: 'webchat', 'whatsapp', 'telegram', 'operatør' Obligatorisk
platformid Platform-id Obligatorisk
Svar:
  • status
  • resultat (hvis status = succes), her vil du modtage følgende værdier:
    • list
      • platformid
      • platform
      • message
      • destination
      • messageid
      • sent
      • status
      • datetime
  • fejl (hvis status = fejl), her vil du modtage fejlkoden

Fejlkoder:
Kode Beskrivelse
MISSING_USER Bruger eller e-mail er ikke inkluderet
MISSING_PASSWORD Adgangskode er ikke inkluderet
MISSING_CLASS Klasse ikke inkluderet
MISSING_METHOD Metode er ikke inkluderet
MISSING_COMPULSORY_PARAM Obligatorisk parameter ikke inkluderet
INCORRECT_USER_PASSWORD Forkert bruger eller adgangskode
INCORRECT_CLASS Forkert klasse
INCORRECT_METHOD Forkert metode
CHANNEL_NOT_FOUND Den angivne kanal findes ikke
CHAT_NOT_FOUND Den angivne chat findes ikke

Få en liste over beskeder fra en chat med {sprog}

<?
	
	# This example requires nusoap
	require_once('nusoap.php');

	$class="chat";
	$method="getchats";
	$user="user";
	$password="password";
	$platform="whatsapp";
	$platformid=100;

	# Create SOAP Client
	$soapclient = new soapclient('https://www.afilnet.com/api/soap/index.php?wsdl');

	# Call to method
	$result = $soapclient->call($user, $password, $class, $method, '{"platform":"'.$platform.'","platformid":"'.$platformid.'"}');
		
?><?
	
$class="chat";
$method="getmessages";
$user="user";
$password="password";
$platform="whatsapp";
$platformid=100;
$destination="34600000000";

$result = file_get_contents("https://www.afilnet.com/api/http/?class=".$class."&method=".$method."&user=".$user."&password=".$password."&platform=".$platform."&platformid=".$platformid."&destination=".$destination);
	
?>
<?

	$url = "https://www.afilnet.com/api/http/";
	$fields = array(
		"class" => urlencode("chat"),
		"method" => urlencode("getmessages"),
		"user" => urlencode("user"),
		"password" => urlencode("password"),
		"platform" => urlencode("whatsapp"),
		"platformid" => urlencode(100),
		"destination" => urlencode("34600000000"),
	);
	foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
	rtrim($fields_string, '&');
	
	$ch = curl_init();
	
	curl_setopt($ch,CURLOPT_URL, $url);
	curl_setopt($ch,CURLOPT_POST, count($fields));
	curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
	
	$result = curl_exec($ch);
	
	curl_close($ch);

		
?>
<?

	$url = "https://www.afilnet.com/api/basic/";
	$fields = array(
		"class" => urlencode("chat"),
		"method" => urlencode("getmessages"),
		"platform" => urlencode("whatsapp"),
		"platformid" => urlencode(100),
		"destination" => urlencode("34600000000"),
	);
	foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
	rtrim($fields_string, '&');
	
	$ch = curl_init();
	
	curl_setopt($ch,CURLOPT_URL, $url);
	curl_setopt($ch,CURLOPT_USERPWD, $user.":".$password);
	curl_setopt($ch,CURLOPT_POST, count($fields));
	curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
	curl_setopt($ch,CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
	
	$result = curl_exec($ch);
	$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
	
	curl_close($ch);
	
	if($httpcode == 401)
	{
		// LOGIN ERROR
	} else {
		// SUCCESS LOGIN
	}

		
?>
<?
	
	# This example requires nusoap
	require_once('nusoap.php');

	$class="chat";
	$method="getmessages";
	$user="user";
	$password="password";
	$platform="whatsapp";
	$platformid=100;
	$destination="34600000000";

	# Create SOAP Client
	$soapclient = new soapclient('https://www.afilnet.com/api/soap/index.php?wsdl');

	# Call to method
	$result = $soapclient->call($user, $password, $class, $method, '{"platform":"'.$platform.'","platformid":"'.$platformid.'","destination":"'.$destination.'"}');
		
?>
Parameter Beskrivelse Obligatorisk / valgfri
class=chat Klasse anmodet: Klasse, som anmodningen indgives til Obligatorisk
method=getmessages Anmodet om klassemetode: Metode for den klasse, som anmodningen indgives til Obligatorisk
user Bruger og e-mail på din Afilnet-konto Obligatorisk
password Adgangskode til din Afilnet-konto Obligatorisk
platform Platform, som meddelelsen sendes til. Mulige værdier: 'webchat', 'whatsapp', 'telegram', 'operatør' Obligatorisk
platformid Platform-id Obligatorisk
destination Modtager, hvorfra du vil hente beskederne Obligatorisk
Svar:
  • status
  • resultat (hvis status = succes), her vil du modtage følgende værdier:
    • list
      • platformid
      • platform
      • message
      • destination
      • messageid
      • sent
      • status
      • datetime
  • fejl (hvis status = fejl), her vil du modtage fejlkoden

Fejlkoder:
Kode Beskrivelse
MISSING_USER Bruger eller e-mail er ikke inkluderet
MISSING_PASSWORD Adgangskode er ikke inkluderet
MISSING_CLASS Klasse ikke inkluderet
MISSING_METHOD Metode er ikke inkluderet
MISSING_COMPULSORY_PARAM Obligatorisk parameter ikke inkluderet
INCORRECT_USER_PASSWORD Forkert bruger eller adgangskode
INCORRECT_CLASS Forkert klasse
INCORRECT_METHOD Forkert metode
CHANNEL_NOT_FOUND Den angivne kanal findes ikke
CHAT_NOT_FOUND Den angivne chat findes ikke

Få en liste over ulæste beskeder fra en chat med {sprog}

<?
	
	# This example requires nusoap
	require_once('nusoap.php');

	$class="chat";
	$method="getmessages";
	$user="user";
	$password="password";
	$platform="whatsapp";
	$platformid=100;
	$destination="34600000000";

	# Create SOAP Client
	$soapclient = new soapclient('https://www.afilnet.com/api/soap/index.php?wsdl');

	# Call to method
	$result = $soapclient->call($user, $password, $class, $method, '{"platform":"'.$platform.'","platformid":"'.$platformid.'","destination":"'.$destination.'"}');
		
?><?
	
$class="chat";
$method="getunreadmessages";
$user="user";
$password="password";
$platform="whatsapp";
$platformid=100;
$destination="34600000000";

$result = file_get_contents("https://www.afilnet.com/api/http/?class=".$class."&method=".$method."&user=".$user."&password=".$password."&platform=".$platform."&platformid=".$platformid."&destination=".$destination);
	
?>
<?

	$url = "https://www.afilnet.com/api/http/";
	$fields = array(
		"class" => urlencode("chat"),
		"method" => urlencode("getunreadmessages"),
		"user" => urlencode("user"),
		"password" => urlencode("password"),
		"platform" => urlencode("whatsapp"),
		"platformid" => urlencode(100),
		"destination" => urlencode("34600000000"),
	);
	foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
	rtrim($fields_string, '&');
	
	$ch = curl_init();
	
	curl_setopt($ch,CURLOPT_URL, $url);
	curl_setopt($ch,CURLOPT_POST, count($fields));
	curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
	
	$result = curl_exec($ch);
	
	curl_close($ch);

		
?>
<?

	$url = "https://www.afilnet.com/api/basic/";
	$fields = array(
		"class" => urlencode("chat"),
		"method" => urlencode("getunreadmessages"),
		"platform" => urlencode("whatsapp"),
		"platformid" => urlencode(100),
		"destination" => urlencode("34600000000"),
	);
	foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
	rtrim($fields_string, '&');
	
	$ch = curl_init();
	
	curl_setopt($ch,CURLOPT_URL, $url);
	curl_setopt($ch,CURLOPT_USERPWD, $user.":".$password);
	curl_setopt($ch,CURLOPT_POST, count($fields));
	curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
	curl_setopt($ch,CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
	
	$result = curl_exec($ch);
	$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
	
	curl_close($ch);
	
	if($httpcode == 401)
	{
		// LOGIN ERROR
	} else {
		// SUCCESS LOGIN
	}

		
?>
<?
	
	# This example requires nusoap
	require_once('nusoap.php');

	$class="chat";
	$method="getunreadmessages";
	$user="user";
	$password="password";
	$platform="whatsapp";
	$platformid=100;
	$destination="34600000000";

	# Create SOAP Client
	$soapclient = new soapclient('https://www.afilnet.com/api/soap/index.php?wsdl');

	# Call to method
	$result = $soapclient->call($user, $password, $class, $method, '{"platform":"'.$platform.'","platformid":"'.$platformid.'","destination":"'.$destination.'"}');
		
?>
Parameter Beskrivelse Obligatorisk / valgfri
class=chat Klasse anmodet: Klasse, som anmodningen indgives til Obligatorisk
method=getunreadmessages Anmodet om klassemetode: Metode for den klasse, som anmodningen indgives til Obligatorisk
user Bruger og e-mail på din Afilnet-konto Obligatorisk
password Adgangskode til din Afilnet-konto Obligatorisk
platform Platform, som meddelelsen sendes til. Mulige værdier: 'webchat', 'whatsapp', 'telegram', 'operatør' Obligatorisk
platformid Platform-id Obligatorisk
destination Modtager, hvorfra du vil hente beskederne Obligatorisk
Svar:
  • status
  • resultat (hvis status = succes), her vil du modtage følgende værdier:
    • list
      • platformid
      • platform
      • message
      • destination
      • messageid
      • issent
      • status
      • datetime
  • fejl (hvis status = fejl), her vil du modtage fejlkoden

Fejlkoder:
Kode Beskrivelse
MISSING_USER Bruger eller e-mail er ikke inkluderet
MISSING_PASSWORD Adgangskode er ikke inkluderet
MISSING_CLASS Klasse ikke inkluderet
MISSING_METHOD Metode er ikke inkluderet
MISSING_COMPULSORY_PARAM Obligatorisk parameter ikke inkluderet
INCORRECT_USER_PASSWORD Forkert bruger eller adgangskode
INCORRECT_CLASS Forkert klasse
INCORRECT_METHOD Forkert metode
CHANNEL_NOT_FOUND Den angivne kanal findes ikke
CHAT_NOT_FOUND Den angivne chat findes ikke

Returnerer leveringsstatus for certificeret sms med PHP Returnerer leveringsstatus for certificeret sms med Java Returnerer leveringsstatus for certificeret sms med C Sharp Returnerer leveringsstatus for certificeret sms med Unix Returnerer leveringsstatus for certificeret sms med Ruby on rails Returnerer leveringsstatus for certificeret sms med Python Returnerer leveringsstatus for certificeret sms med Android Returnerer leveringsstatus for certificeret sms med Objective C / iPhone Returnerer leveringsstatus for certificeret sms med SQL Server Returnerer leveringsstatus for certificeret sms med Oracle Returnerer leveringsstatus for certificeret sms med Node JS Returnerer leveringsstatus for certificeret sms med Go lang Returnerer leveringsstatus for certificeret sms med Scala lang Returnerer leveringsstatus for certificeret sms med Swift Returnerer leveringsstatus for certificeret sms med Delphi

Afilnet tilbyder dig metoder til at forbedre sikkerheden, når du bruger vores API med PHP, takket være muligheden for at oprette adgange og muligheden for at aktivere filtrering efter IP.

Hvilken API til PHP skal jeg bruge?

Opdag fordelene og ulemperne ved hver af vores API'er. Find ud af, hvilken API der er bedst til din software på PHP.

Denne API giver dig mulighed for at oprette forbindelse til os fra PHP for at sende anmodninger via HTTP GET-anmodninger. Denne anmodning sender parametrene i samme URL som anmodningen.

  • HTTP GET er ekstremt simpelt at implementere
  • Oplysninger sendes ukrypteret (adgangskoder kan udtrækkes fra logfiler eller cache)
  • Maksimal anmodning på ~4000 tegn

POST request API giver dig mulighed for at oprette forbindelse til vores API fra PHP ved at sende anmodningsparametre via HTTP POST-parametre. Oplysningerne sendes uafhængigt af URL'en.

  • HTTP POST er enkel at implementere
  • Information sendes krypteret
  • Der er ingen grænse for størrelsen af anmodningen
  • Middel sikkerhed

Den grundlæggende autentificerings-API tillader brugen af GET- og POST-anmodninger på PHP med et ekstra sikkerhedslag, da brugernavnet og adgangskoden i dette tilfælde sendes i overskriften på anmodningen.

  • Grundlæggende godkendelse er nem at implementere
  • Adgangsdata sendes krypteret
  • Størrelsesgrænsen afhænger af brugen af GET eller POST
  • Middel sikkerhed

SOAP giver dig mulighed for at sende anmodninger i XML-format med PHP, SOAP tilføjer et ekstra lag af sikkerhed til API-anmodninger.

  • SOAP-integration er mere kompleks
  • Information sendes krypteret
  • Der er ingen grænse for størrelsen af anmodningen
  • Middel / Høj sikkerhed

Vores JSON API giver dig mulighed for at sende anmodninger i JSON-format med PHP, derudover tilføjer denne API oAuth 2.0-protokollen i godkendelsen, der giver dig mulighed for at tilføje et ekstra lag af sikkerhed.

  • JSON oAuth 2.0-integration er mere kompleks
  • Information sendes krypteret
  • Der er ingen grænse for størrelsen af anmodningen
  • Høj sikkerhed

Opret forbindelse {sprog} med vores Chats API

01

Registrer dig som klient

For at få adgang til API'en skal du være en Afilnet-klient. Registrering vil tage et par minutter.

02

Anmod om din gratis prøveperiode

Vores firma vil tilbyde dig en prøvebalance, der giver dig mulighed for at teste med den API, du har brug for.

03

Integrer API

Udfør API-integration ved hjælp af det programmeringssprog, du vælger. Hvis du har spørgsmål eller forslag til API'et, så kontakt os

04

Velkommen til Afilnet!

Alt klar !, har formået at forbedre sin kommunikation med Afilnet. Vi er her for at støtte vores API, når du har brug for det


Kontakt vores team med eventuelle spørgsmål gennem de kontaktmetoder, vi tilbyder. Vores team vil forsøge at tilbyde dig en øjeblikkelig løsning og vil hjælpe dig med integrationen af vores API i din software.

Prøv Afilnet gratis!

Tilmeld dig gratis, og prøv Afilnet! Vi tilbyder dig en gratis prøveperiode på vores tjenester. *



(*) Kampagnen gælder kun for virksomheder, der aldrig har brugt Afilnet-tjenesten før. Når du anmoder om den gratis saldo, kan Afilnet anmode om at bekræfte dine virksomhedsoplysninger


Bulk SMS · E-mail-marketing · Socialt netværk · Øjeblikkelig udveksling af beskeder · Certificering · og meget mere
Blive ved VIGTIG INFORMATION OM COOKIES: Hvis du fortsætter med at bruge denne web, antager vi, at du accepterer vilkårene for brug. Du finder flere oplysninger i vores cookiepolitik.
Betalingsmetoder
Bankoverførsel
Kreditkort
Paypal
Western Union
Skrill
Crypto
Afilnet på dit sprog

Copyright © 2023 Afilnet · Alle rettigheder forbeholdes