API Web Chat para C Sharp
Gerencie o sistema de bate-papo da API. Acesse ou responda a conversas de nossa API.

Obtenha uma lista de canais de chat ativos com C Sharp
String afilnet_class="chat";
String afilnet_method="getchatchannels";
String afilnet_user="user";
String afilnet_password="password";
// Create an URL request
WebRequest request = WebRequest.Create("https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password);
// Get the response
WebResponse response = request.GetResponse ();
// Get the stream returned by the server
Stream dataStream = response.GetResponseStream();
// Open the stream
StreamReader reader = new StreamReader (dataStream);
// Read the Response
String result = reader.ReadToEnd ();
// Asign vars
var data = new NameValueCollection();
data["class"] = "chat";
data["method"] = "getchatchannels";
data["user"] = "user";
data["password"] = "password";
// Create Web client
var wb = new WebClient();
// Execute POST petition
var response = wb.UploadValues("https://www.afilnet.com/api/http/", "POST", data);
// Get response
string responseString = Encoding.UTF8.GetString(response);
// Asign vars
var data = new NameValueCollection();
data["class"] = "chat";
data["method"] = "getchatchannels";
// Create Web client
var wb = new WebClient { Credentials = new NetworkCredential("user", "password") };
// Execute POST petition
var response = wb.UploadValues("https://www.afilnet.com/api/basic/", "POST", data);
// Get response
string responseString = Encoding.UTF8.GetString(response);
String afilnet_class="chat";
String afilnet_method="getchatchannels";
String afilnet_user="user";
String afilnet_password="password";
// Allow SSL/TLS config
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// We create the webservice instance (Register Web Service first in project)
var service = new WebService.ApplicationServicesPortTypeClient();
// Call to WebService method
String response = service.call(afilnet_user, afilnet_password, afilnet_class, afilnet_method, "{}");
Parâmetro | Descrição | Mandatório / Opcional |
---|---|---|
class=chat | Classe pedida: Classe à qual o pedido é requisitado | Mandatório |
method=getchatchannels | Método de classe requisitado: Método da classe à qual o pedido é requisitado | Mandatório |
user | Utilizador e email da sua conta Afilnet | Mandatório |
password | Password da sua conta Afilnet | Mandatório |
Responda:
- status
-
result (if status=success), aqui receberá os seguintes valores:
-
list
- platformid
- platform
- name
-
list
- error (if status=error), aqui receberá o código de erro
Códigos de erro:
Código | Descrição |
---|---|
MISSING_USER | Utilizador ou email não incluído |
MISSING_PASSWORD | Password não incluída |
MISSING_CLASS | Classe não incluída |
MISSING_METHOD | Método não incluído |
MISSING_COMPULSORY_PARAM | Parâmetro obrigatório não incluído |
INCORRECT_USER_PASSWORD | Utilizador ou password incorretos |
INCORRECT_CLASS | Classe incorreta |
INCORRECT_METHOD | Método incorreto |
Envie uma mensagem por bate-papo com C Sharp
String afilnet_class="chat";
String afilnet_method="getchatchannels";
String afilnet_user="user";
String afilnet_password="password";
// Allow SSL/TLS config
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// We create the webservice instance (Register Web Service first in project)
var service = new WebService.ApplicationServicesPortTypeClient();
// Call to WebService method
String response = service.call(afilnet_user, afilnet_password, afilnet_class, afilnet_method, "{}");String afilnet_class="chat";
String afilnet_method="sendmessage";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platform="whatsapp";
String afilnet_platformid="100";
String afilnet_destination="3460000000";
String afilnet_message="test+message";
// Create an URL request
WebRequest request = WebRequest.Create("https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&platform="+afilnet_platform+"&platformid="+afilnet_platformid+"&destination="+afilnet_destination+"&message="+afilnet_message);
// Get the response
WebResponse response = request.GetResponse ();
// Get the stream returned by the server
Stream dataStream = response.GetResponseStream();
// Open the stream
StreamReader reader = new StreamReader (dataStream);
// Read the Response
String result = reader.ReadToEnd ();
// Asign vars
var data = new NameValueCollection();
data["class"] = "chat";
data["method"] = "sendmessage";
data["user"] = "user";
data["password"] = "password";
data["platform"] = "whatsapp";
data["platformid"] = "100";
data["destination"] = "3460000000";
data["message"] = "test+message";
// Create Web client
var wb = new WebClient();
// Execute POST petition
var response = wb.UploadValues("https://www.afilnet.com/api/http/", "POST", data);
// Get response
string responseString = Encoding.UTF8.GetString(response);
// Asign vars
var data = new NameValueCollection();
data["class"] = "chat";
data["method"] = "sendmessage";
data["platform"] = "whatsapp";
data["platformid"] = "100";
data["destination"] = "3460000000";
data["message"] = "test+message";
// Create Web client
var wb = new WebClient { Credentials = new NetworkCredential("user", "password") };
// Execute POST petition
var response = wb.UploadValues("https://www.afilnet.com/api/basic/", "POST", data);
// Get response
string responseString = Encoding.UTF8.GetString(response);
String afilnet_class="chat";
String afilnet_method="sendmessage";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platform="whatsapp";
String afilnet_platformid="100";
String afilnet_destination="3460000000";
String afilnet_message="test+message";
// Allow SSL/TLS config
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// We create the webservice instance (Register Web Service first in project)
var service = new WebService.ApplicationServicesPortTypeClient();
// Call to WebService method
String response = service.call(afilnet_user, afilnet_password, afilnet_class, afilnet_method, "{\"platform\":\""+afilnet_platform+"\",\"platformid\":\""+afilnet_platformid+"\",\"destination\":\""+afilnet_destination+"\",\"message\":\""+afilnet_message+"\"}");
Parâmetro | Descrição | Mandatório / Opcional |
---|---|---|
class=chat | Classe pedida: Classe à qual o pedido é requisitado | Mandatório |
method=sendmessage | Método de classe requisitado: Método da classe à qual o pedido é requisitado | Mandatório |
user | Utilizador e email da sua conta Afilnet | Mandatório |
password | Password da sua conta Afilnet | Mandatório |
platform | Plataforma para a qual a mensagem é enviada. Valores possíveis: 'webchat', 'whatsapp', 'telegram', 'operator' | Mandatório |
platformid | Identificador de plataforma | Mandatório |
destination | Destinatário para onde a mensagem de bate-papo é enviada | Mandatório |
message | Mensagem para enviar via chat | Mandatório |
Responda:
- status
-
result (if status=success), aqui receberá os seguintes valores:
- Não lhe será enviado qualquer valor adicional
- error (if status=error), aqui receberá o código de erro
Códigos de erro:
Código | Descrição |
---|---|
MISSING_USER | Utilizador ou email não incluído |
MISSING_PASSWORD | Password não incluída |
MISSING_CLASS | Classe não incluída |
MISSING_METHOD | Método não incluído |
MISSING_COMPULSORY_PARAM | Parâmetro obrigatório não incluído |
INCORRECT_USER_PASSWORD | Utilizador ou password incorretos |
INCORRECT_CLASS | Classe incorreta |
INCORRECT_METHOD | Método incorreto |
CHANNEL_NOT_FOUND | O canal indicado não existe |
Envie um arquivo por bate-papo com C Sharp
String afilnet_class="chat";
String afilnet_method="sendmessage";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platform="whatsapp";
String afilnet_platformid="100";
String afilnet_destination="3460000000";
String afilnet_message="test+message";
// Allow SSL/TLS config
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// We create the webservice instance (Register Web Service first in project)
var service = new WebService.ApplicationServicesPortTypeClient();
// Call to WebService method
String response = service.call(afilnet_user, afilnet_password, afilnet_class, afilnet_method, "{\"platform\":\""+afilnet_platform+"\",\"platformid\":\""+afilnet_platformid+"\",\"destination\":\""+afilnet_destination+"\",\"message\":\""+afilnet_message+"\"}");String afilnet_class="chat";
String afilnet_method="sendfile";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platform="whatsapp";
String afilnet_platformid="100";
String afilnet_destination="3460000000";
String afilnet_type="image";
String afilnet_fileurl="https://www.example.com/image.jpg";
String afilnet_thumburl="https://www.example.com/thumb.jpg";
String afilnet_message="test+message";
// Create an URL request
WebRequest request = WebRequest.Create("https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&platform="+afilnet_platform+"&platformid="+afilnet_platformid+"&destination="+afilnet_destination+"&type="+afilnet_type+"&fileurl="+afilnet_fileurl+"&thumburl="+afilnet_thumburl+"&message="+afilnet_message);
// Get the response
WebResponse response = request.GetResponse ();
// Get the stream returned by the server
Stream dataStream = response.GetResponseStream();
// Open the stream
StreamReader reader = new StreamReader (dataStream);
// Read the Response
String result = reader.ReadToEnd ();
// Asign vars
var data = new NameValueCollection();
data["class"] = "chat";
data["method"] = "sendfile";
data["user"] = "user";
data["password"] = "password";
data["platform"] = "whatsapp";
data["platformid"] = "100";
data["destination"] = "3460000000";
data["type"] = "image";
data["fileurl"] = "https://www.example.com/image.jpg";
data["thumburl"] = "https://www.example.com/thumb.jpg";
data["message"] = "test+message";
// Create Web client
var wb = new WebClient();
// Execute POST petition
var response = wb.UploadValues("https://www.afilnet.com/api/http/", "POST", data);
// Get response
string responseString = Encoding.UTF8.GetString(response);
// Asign vars
var data = new NameValueCollection();
data["class"] = "chat";
data["method"] = "sendfile";
data["platform"] = "whatsapp";
data["platformid"] = "100";
data["destination"] = "3460000000";
data["type"] = "image";
data["fileurl"] = "https://www.example.com/image.jpg";
data["thumburl"] = "https://www.example.com/thumb.jpg";
data["message"] = "test+message";
// Create Web client
var wb = new WebClient { Credentials = new NetworkCredential("user", "password") };
// Execute POST petition
var response = wb.UploadValues("https://www.afilnet.com/api/basic/", "POST", data);
// Get response
string responseString = Encoding.UTF8.GetString(response);
String afilnet_class="chat";
String afilnet_method="sendfile";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platform="whatsapp";
String afilnet_platformid="100";
String afilnet_destination="3460000000";
String afilnet_type="image";
String afilnet_fileurl="https://www.example.com/image.jpg";
String afilnet_thumburl="https://www.example.com/thumb.jpg";
String afilnet_message="test+message";
// Allow SSL/TLS config
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// We create the webservice instance (Register Web Service first in project)
var service = new WebService.ApplicationServicesPortTypeClient();
// Call to WebService method
String response = service.call(afilnet_user, afilnet_password, afilnet_class, afilnet_method, "{\"platform\":\""+afilnet_platform+"\",\"platformid\":\""+afilnet_platformid+"\",\"destination\":\""+afilnet_destination+"\",\"type\":\""+afilnet_type+"\",\"fileurl\":\""+afilnet_fileurl+"\",\"thumburl\":\""+afilnet_thumburl+"\",\"message\":\""+afilnet_message+"\"}");
Parâmetro | Descrição | Mandatório / Opcional |
---|---|---|
class=chat | Classe pedida: Classe à qual o pedido é requisitado | Mandatório |
method=sendfile | Método de classe requisitado: Método da classe à qual o pedido é requisitado | Mandatório |
user | Utilizador e email da sua conta Afilnet | Mandatório |
password | Password da sua conta Afilnet | Mandatório |
platform | Plataforma para a qual a mensagem é enviada. Valores possíveis: 'webchat', 'whatsapp', 'telegram', 'operator' | Mandatório |
platformid | Identificador de plataforma | Mandatório |
destination | Destinatário para onde o arquivo é enviado | Mandatório |
type | Tipo de arquivo sendo enviado. Valores possíveis: 'imagem', 'vídeo', 'áudio', 'voz', 'documento', 'contato' | Mandatório |
fileurl | Url onde se encontra o arquivo a ser enviado por chat | Mandatório |
thumburl | Url da imagem em miniatura que acompanha o arquivo | Opcional |
message | Mensagem que acompanha o arquivo | Opcional |
Responda:
- status
-
result (if status=success), aqui receberá os seguintes valores:
- Não lhe será enviado qualquer valor adicional
- error (if status=error), aqui receberá o código de erro
Códigos de erro:
Código | Descrição |
---|---|
MISSING_USER | Utilizador ou email não incluído |
MISSING_PASSWORD | Password não incluída |
MISSING_CLASS | Classe não incluída |
MISSING_METHOD | Método não incluído |
MISSING_COMPULSORY_PARAM | Parâmetro obrigatório não incluído |
INCORRECT_USER_PASSWORD | Utilizador ou password incorretos |
INCORRECT_CLASS | Classe incorreta |
INCORRECT_METHOD | Método incorreto |
CHANNEL_NOT_FOUND | O canal indicado não existe |
CHAT_NOT_FOUND | O chat indicado não existe |
INCORRECT_FILETYPE | O tipo de arquivo está errado, verifique os valores possíveis |
INCORRECT_FILEURL | O url do arquivo não é válido |
INCORRECT_THUMBURL | O url da miniatura é inválido |
Obtenha uma lista de conversas em um bate-papo com C Sharp
String afilnet_class="chat";
String afilnet_method="sendfile";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platform="whatsapp";
String afilnet_platformid="100";
String afilnet_destination="3460000000";
String afilnet_type="image";
String afilnet_fileurl="https://www.example.com/image.jpg";
String afilnet_thumburl="https://www.example.com/thumb.jpg";
String afilnet_message="test+message";
// Allow SSL/TLS config
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// We create the webservice instance (Register Web Service first in project)
var service = new WebService.ApplicationServicesPortTypeClient();
// Call to WebService method
String response = service.call(afilnet_user, afilnet_password, afilnet_class, afilnet_method, "{\"platform\":\""+afilnet_platform+"\",\"platformid\":\""+afilnet_platformid+"\",\"destination\":\""+afilnet_destination+"\",\"type\":\""+afilnet_type+"\",\"fileurl\":\""+afilnet_fileurl+"\",\"thumburl\":\""+afilnet_thumburl+"\",\"message\":\""+afilnet_message+"\"}");String afilnet_class="chat";
String afilnet_method="getchats";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platform="whatsapp";
String afilnet_platformid="100";
// Create an URL request
WebRequest request = WebRequest.Create("https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&platform="+afilnet_platform+"&platformid="+afilnet_platformid);
// Get the response
WebResponse response = request.GetResponse ();
// Get the stream returned by the server
Stream dataStream = response.GetResponseStream();
// Open the stream
StreamReader reader = new StreamReader (dataStream);
// Read the Response
String result = reader.ReadToEnd ();
// Asign vars
var data = new NameValueCollection();
data["class"] = "chat";
data["method"] = "getchats";
data["user"] = "user";
data["password"] = "password";
data["platform"] = "whatsapp";
data["platformid"] = "100";
// Create Web client
var wb = new WebClient();
// Execute POST petition
var response = wb.UploadValues("https://www.afilnet.com/api/http/", "POST", data);
// Get response
string responseString = Encoding.UTF8.GetString(response);
// Asign vars
var data = new NameValueCollection();
data["class"] = "chat";
data["method"] = "getchats";
data["platform"] = "whatsapp";
data["platformid"] = "100";
// Create Web client
var wb = new WebClient { Credentials = new NetworkCredential("user", "password") };
// Execute POST petition
var response = wb.UploadValues("https://www.afilnet.com/api/basic/", "POST", data);
// Get response
string responseString = Encoding.UTF8.GetString(response);
String afilnet_class="chat";
String afilnet_method="getchats";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platform="whatsapp";
String afilnet_platformid="100";
// Allow SSL/TLS config
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// We create the webservice instance (Register Web Service first in project)
var service = new WebService.ApplicationServicesPortTypeClient();
// Call to WebService method
String response = service.call(afilnet_user, afilnet_password, afilnet_class, afilnet_method, "{\"platform\":\""+afilnet_platform+"\",\"platformid\":\""+afilnet_platformid+"\"}");
Parâmetro | Descrição | Mandatório / Opcional |
---|---|---|
class=chat | Classe pedida: Classe à qual o pedido é requisitado | Mandatório |
method=getchats | Método de classe requisitado: Método da classe à qual o pedido é requisitado | Mandatório |
user | Utilizador e email da sua conta Afilnet | Mandatório |
password | Password da sua conta Afilnet | Mandatório |
platform | Plataforma para a qual a mensagem é enviada. Valores possíveis: 'webchat', 'whatsapp', 'telegram', 'operator' | Mandatório |
platformid | Identificador de plataforma | Mandatório |
Responda:
- status
-
result (if status=success), aqui receberá os seguintes valores:
-
list
- platformid
- platform
- message
- destination
- messageid
- sent
- status
- datetime
-
list
- error (if status=error), aqui receberá o código de erro
Códigos de erro:
Código | Descrição |
---|---|
MISSING_USER | Utilizador ou email não incluído |
MISSING_PASSWORD | Password não incluída |
MISSING_CLASS | Classe não incluída |
MISSING_METHOD | Método não incluído |
MISSING_COMPULSORY_PARAM | Parâmetro obrigatório não incluído |
INCORRECT_USER_PASSWORD | Utilizador ou password incorretos |
INCORRECT_CLASS | Classe incorreta |
INCORRECT_METHOD | Método incorreto |
CHANNEL_NOT_FOUND | O canal indicado não existe |
CHAT_NOT_FOUND | O chat indicado não existe |
Obtenha uma lista de mensagens de um bate-papo com C Sharp
String afilnet_class="chat";
String afilnet_method="getchats";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platform="whatsapp";
String afilnet_platformid="100";
// Allow SSL/TLS config
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// We create the webservice instance (Register Web Service first in project)
var service = new WebService.ApplicationServicesPortTypeClient();
// Call to WebService method
String response = service.call(afilnet_user, afilnet_password, afilnet_class, afilnet_method, "{\"platform\":\""+afilnet_platform+"\",\"platformid\":\""+afilnet_platformid+"\"}");String afilnet_class="chat";
String afilnet_method="getmessages";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platform="whatsapp";
String afilnet_platformid="100";
String afilnet_destination="34600000000";
// Create an URL request
WebRequest request = WebRequest.Create("https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&platform="+afilnet_platform+"&platformid="+afilnet_platformid+"&destination="+afilnet_destination);
// Get the response
WebResponse response = request.GetResponse ();
// Get the stream returned by the server
Stream dataStream = response.GetResponseStream();
// Open the stream
StreamReader reader = new StreamReader (dataStream);
// Read the Response
String result = reader.ReadToEnd ();
// Asign vars
var data = new NameValueCollection();
data["class"] = "chat";
data["method"] = "getmessages";
data["user"] = "user";
data["password"] = "password";
data["platform"] = "whatsapp";
data["platformid"] = "100";
data["destination"] = "34600000000";
// Create Web client
var wb = new WebClient();
// Execute POST petition
var response = wb.UploadValues("https://www.afilnet.com/api/http/", "POST", data);
// Get response
string responseString = Encoding.UTF8.GetString(response);
// Asign vars
var data = new NameValueCollection();
data["class"] = "chat";
data["method"] = "getmessages";
data["platform"] = "whatsapp";
data["platformid"] = "100";
data["destination"] = "34600000000";
// Create Web client
var wb = new WebClient { Credentials = new NetworkCredential("user", "password") };
// Execute POST petition
var response = wb.UploadValues("https://www.afilnet.com/api/basic/", "POST", data);
// Get response
string responseString = Encoding.UTF8.GetString(response);
String afilnet_class="chat";
String afilnet_method="getmessages";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platform="whatsapp";
String afilnet_platformid="100";
String afilnet_destination="34600000000";
// Allow SSL/TLS config
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// We create the webservice instance (Register Web Service first in project)
var service = new WebService.ApplicationServicesPortTypeClient();
// Call to WebService method
String response = service.call(afilnet_user, afilnet_password, afilnet_class, afilnet_method, "{\"platform\":\""+afilnet_platform+"\",\"platformid\":\""+afilnet_platformid+"\",\"destination\":\""+afilnet_destination+"\"}");
Parâmetro | Descrição | Mandatório / Opcional |
---|---|---|
class=chat | Classe pedida: Classe à qual o pedido é requisitado | Mandatório |
method=getmessages | Método de classe requisitado: Método da classe à qual o pedido é requisitado | Mandatório |
user | Utilizador e email da sua conta Afilnet | Mandatório |
password | Password da sua conta Afilnet | Mandatório |
platform | Plataforma para a qual a mensagem é enviada. Valores possíveis: 'webchat', 'whatsapp', 'telegram', 'operator' | Mandatório |
platformid | Identificador de plataforma | Mandatório |
destination | Destinatário do qual você deseja obter as mensagens | Mandatório |
Responda:
- status
-
result (if status=success), aqui receberá os seguintes valores:
-
list
- platformid
- platform
- message
- destination
- messageid
- sent
- status
- datetime
-
list
- error (if status=error), aqui receberá o código de erro
Códigos de erro:
Código | Descrição |
---|---|
MISSING_USER | Utilizador ou email não incluído |
MISSING_PASSWORD | Password não incluída |
MISSING_CLASS | Classe não incluída |
MISSING_METHOD | Método não incluído |
MISSING_COMPULSORY_PARAM | Parâmetro obrigatório não incluído |
INCORRECT_USER_PASSWORD | Utilizador ou password incorretos |
INCORRECT_CLASS | Classe incorreta |
INCORRECT_METHOD | Método incorreto |
CHANNEL_NOT_FOUND | O canal indicado não existe |
CHAT_NOT_FOUND | O chat indicado não existe |
Obtenha uma lista de mensagens não lidas de um bate-papo com C Sharp
String afilnet_class="chat";
String afilnet_method="getmessages";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platform="whatsapp";
String afilnet_platformid="100";
String afilnet_destination="34600000000";
// Allow SSL/TLS config
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// We create the webservice instance (Register Web Service first in project)
var service = new WebService.ApplicationServicesPortTypeClient();
// Call to WebService method
String response = service.call(afilnet_user, afilnet_password, afilnet_class, afilnet_method, "{\"platform\":\""+afilnet_platform+"\",\"platformid\":\""+afilnet_platformid+"\",\"destination\":\""+afilnet_destination+"\"}");String afilnet_class="chat";
String afilnet_method="getunreadmessages";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platform="whatsapp";
String afilnet_platformid="100";
String afilnet_destination="34600000000";
// Create an URL request
WebRequest request = WebRequest.Create("https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&platform="+afilnet_platform+"&platformid="+afilnet_platformid+"&destination="+afilnet_destination);
// Get the response
WebResponse response = request.GetResponse ();
// Get the stream returned by the server
Stream dataStream = response.GetResponseStream();
// Open the stream
StreamReader reader = new StreamReader (dataStream);
// Read the Response
String result = reader.ReadToEnd ();
// Asign vars
var data = new NameValueCollection();
data["class"] = "chat";
data["method"] = "getunreadmessages";
data["user"] = "user";
data["password"] = "password";
data["platform"] = "whatsapp";
data["platformid"] = "100";
data["destination"] = "34600000000";
// Create Web client
var wb = new WebClient();
// Execute POST petition
var response = wb.UploadValues("https://www.afilnet.com/api/http/", "POST", data);
// Get response
string responseString = Encoding.UTF8.GetString(response);
// Asign vars
var data = new NameValueCollection();
data["class"] = "chat";
data["method"] = "getunreadmessages";
data["platform"] = "whatsapp";
data["platformid"] = "100";
data["destination"] = "34600000000";
// Create Web client
var wb = new WebClient { Credentials = new NetworkCredential("user", "password") };
// Execute POST petition
var response = wb.UploadValues("https://www.afilnet.com/api/basic/", "POST", data);
// Get response
string responseString = Encoding.UTF8.GetString(response);
String afilnet_class="chat";
String afilnet_method="getunreadmessages";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platform="whatsapp";
String afilnet_platformid="100";
String afilnet_destination="34600000000";
// Allow SSL/TLS config
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// We create the webservice instance (Register Web Service first in project)
var service = new WebService.ApplicationServicesPortTypeClient();
// Call to WebService method
String response = service.call(afilnet_user, afilnet_password, afilnet_class, afilnet_method, "{\"platform\":\""+afilnet_platform+"\",\"platformid\":\""+afilnet_platformid+"\",\"destination\":\""+afilnet_destination+"\"}");
Parâmetro | Descrição | Mandatório / Opcional |
---|---|---|
class=chat | Classe pedida: Classe à qual o pedido é requisitado | Mandatório |
method=getunreadmessages | Método de classe requisitado: Método da classe à qual o pedido é requisitado | Mandatório |
user | Utilizador e email da sua conta Afilnet | Mandatório |
password | Password da sua conta Afilnet | Mandatório |
platform | Plataforma para a qual a mensagem é enviada. Valores possíveis: 'webchat', 'whatsapp', 'telegram', 'operator' | Mandatório |
platformid | Identificador de plataforma | Mandatório |
destination | Destinatário do qual você deseja obter as mensagens | Mandatório |
Responda:
- status
-
result (if status=success), aqui receberá os seguintes valores:
-
list
- platformid
- platform
- message
- destination
- messageid
- issent
- status
- datetime
-
list
- error (if status=error), aqui receberá o código de erro
Códigos de erro:
Código | Descrição |
---|---|
MISSING_USER | Utilizador ou email não incluído |
MISSING_PASSWORD | Password não incluída |
MISSING_CLASS | Classe não incluída |
MISSING_METHOD | Método não incluído |
MISSING_COMPULSORY_PARAM | Parâmetro obrigatório não incluído |
INCORRECT_USER_PASSWORD | Utilizador ou password incorretos |
INCORRECT_CLASS | Classe incorreta |
INCORRECT_METHOD | Método incorreto |
CHANNEL_NOT_FOUND | O canal indicado não existe |
CHAT_NOT_FOUND | O chat indicado não existe |

Qual API para C Sharp devo usar?
Descubra as vantagens e desvantagens de cada uma das nossas APIs. Descubra qual API é melhor para o seu Software em C Sharp.
Essa API permite que você se conecte a nós de C Sharp para enviar solicitações por meio de solicitações HTTP GET. Essa solicitação envia os parâmetros na mesma URL da solicitação.
- HTTP GET é extremamente simples de implementar
- As informações são enviadas sem criptografia (as senhas podem ser extraídas de logs ou cache)
- Solicitação máxima de aproximadamente 4.000 caracteres
A API de solicitação POST permite que você se conecte à nossa API de C Sharp enviando parâmetros de solicitação por meio de parâmetros HTTP POST. As informações são enviadas independentemente da URL.
- HTTP POST é simples de implementar
- As informações são enviadas criptografadas
- Não há limite para o tamanho da solicitação
- Segurança média
A API de autenticação básica permite o uso de solicitações GET e POST em C Sharp com uma camada de segurança adicional, pois neste caso o nome de usuário e a senha são enviados no cabeçalho da solicitação.
- A autenticação básica é fácil de implementar
- Os dados de acesso são enviados criptografados
- O limite de tamanho depende do uso de GET ou POST
- Segurança média
SOAP permite enviar solicitações em formato XML com C Sharp, SOAP adiciona uma camada extra de segurança às solicitações de API.
- A integração SOAP é mais complexa
- As informações são enviadas criptografadas
- Não há limite para o tamanho da solicitação
- Segurança média/alta
Nossa API JSON permite enviar solicitações em formato JSON com C Sharp, além disso, essa API adiciona o protocolo oAuth 2.0 na autenticação que permite adicionar uma camada adicional de segurança.
- A integração JSON oAuth 2.0 é mais complexa
- As informações são enviadas criptografadas
- Não há limite para o tamanho da solicitação
- Alta seguranca
Conecte C Sharp com nossa API Bate-papos
Registre-se como um cliente
Para ter acesso à API você deve ser um cliente Afilnet. O registro levará alguns minutos.
Solicite sua avaliação gratuita
Nossa empresa lhe oferecerá um balancete que lhe permitirá testar com a API que você precisa.
Integrar a API
Realize a integração da API usando a linguagem de programação de sua escolha. Se você tiver dúvidas ou sugestões sobre a API, entre em contato conosco
Bem vindo ao Afilnet!
Tudo pronto!, conseguiu melhorar as suas comunicações com a Afilnet. Estamos aqui para dar suporte à nossa API quando você precisar
Em caso de dúvidas, entre em contato com nossa equipe através dos meios de contato que oferecemos. Nossa equipe tentará lhe oferecer uma solução imediata e lhe ajudará na integração de nossa API em seu Software.