Webchat-API für Swift
Verwalten Sie das Chat-System über die API. Greifen Sie über unsere API auf Konversationen zu oder antworten Sie darauf.

Holen Sie sich eine Liste der aktiven Chat-Kanäle mit Swift
let aclass : String = "chat";
let method : String = "getchatchannels";
let user : String = "user";
let password : String = "password";
let urlPath: String = "https://www.afilnet.com/api/http/?class="+aclass+"&method="+method+"&user="+user+"&password="+password
let url: NSURL = NSURL(string: urlPath)!
let request1: NSURLRequest = NSURLRequest(url: url as URL)
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as NSError {
print(error.localizedDescription)
}
})
let aclass : String = "chat";
let method : String = "getchatchannels";
let user : String = "user";
let password : String = "password";
let urlPath: String = "https://www.afilnet.com/api/http/"
let url: NSURL = NSURL(string: urlPath)!
let request1: NSMutableURLRequest = NSMutableURLRequest(url: url as URL)
request1.httpMethod = "POST"
let stringPost="class="+aclass+"&method="+method+"&user="+user+"&password="+password
let data = stringPost.data(using: String.Encoding.utf8)
request1.timeoutInterval = 60
request1.httpBody=data
request1.httpShouldHandleCookies=false
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as Error {
print(error.localizedDescription)
}
Parameter | Beschreibung | Zwigend / optional |
---|---|---|
class=chat | Sorte deren Antragen sich realisiert | Zwigend |
method=getchatchannels | Sortenmethode deren Antragen sich realisiert | Zwigend |
user | Der User / Email Ihres Afilnet Account | Zwigend |
password | Das password Ihres Afilnet Account | Zwigend |
Antworten:
- Status
-
result (si status=success), Sie werden die nächsten Codes bekommen:
-
list
- platformid
- platform
- name
-
list
- Fehler (si status=Fehler), hier werden Sie der Fehlercode bekommen
Fehlercodes:
Code | Beschreibung |
---|---|
MISSING_USER | User / email nicht beiliegend |
MISSING_PASSWORD | Password nicht beiliegend |
MISSING_CLASS | Sorten nicht beiliegend |
MISSING_METHOD | Methode nicht beiliegend |
MISSING_COMPULSORY_PARAM | Parameterversicherung nicht beiliegend |
INCORRECT_USER_PASSWORD | User oder Passwort inkorrekt |
INCORRECT_CLASS | Inkorrekt Sorte |
INCORRECT_METHOD | Inkorrekt Methode |
Senden Sie eine Nachricht per Chat mit Swift
let aclass : String = "chat";
let method : String = "getchatchannels";
let user : String = "user";
let password : String = "password";
let urlPath: String = "https://www.afilnet.com/api/http/"
let url: NSURL = NSURL(string: urlPath)!
let request1: NSMutableURLRequest = NSMutableURLRequest(url: url as URL)
request1.httpMethod = "POST"
let stringPost="class="+aclass+"&method="+method+"&user="+user+"&password="+password
let data = stringPost.data(using: String.Encoding.utf8)
request1.timeoutInterval = 60
request1.httpBody=data
request1.httpShouldHandleCookies=false
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as Error {
print(error.localizedDescription)
}let aclass : String = "chat";
let method : String = "sendmessage";
let user : String = "user";
let password : String = "password";
let platform : String = "whatsapp";
let platformid : String = "100";
let destination : String = "3460000000";
let message : String = "test+message";
let urlPath: String = "https://www.afilnet.com/api/http/?+"&class="+aclass+"&method="+method+"&user="+user+"&password="+password+"&platform="+platform+"&platformid="+platformid+"&destination="+destination+"&message="+message
let url: NSURL = NSURL(string: urlPath)!
let request1: NSURLRequest = NSURLRequest(url: url as URL)
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as NSError {
print(error.localizedDescription)
}
})
let aclass : String = "chat";
let method : String = "sendmessage";
let user : String = "user";
let password : String = "password";
let platform : String = "whatsapp";
let platformid : String = "100";
let destination : String = "3460000000";
let message : String = "test+message";
let urlPath: String = "https://www.afilnet.com/api/http/"
let url: NSURL = NSURL(string: urlPath)!
let request1: NSMutableURLRequest = NSMutableURLRequest(url: url as URL)
request1.httpMethod = "POST"
let stringPost="class="+aclass+"&method="+method+"&user="+user+"&password="+password+"&platform="+platform+"&platformid="+platformid+"&destination="+destination+"&message="+message
let data = stringPost.data(using: String.Encoding.utf8)
request1.timeoutInterval = 60
request1.httpBody=data
request1.httpShouldHandleCookies=false
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as Error {
print(error.localizedDescription)
}
Parameter | Beschreibung | Zwigend / optional |
---|---|---|
class=chat | Sorte deren Antragen sich realisiert | Zwigend |
method=sendmessage | Sortenmethode deren Antragen sich realisiert | Zwigend |
user | Der User / Email Ihres Afilnet Account | Zwigend |
password | Das password Ihres Afilnet Account | Zwigend |
platform | Plattform, an die die Nachricht gesendet wird. Mögliche Werte: 'Webchat', 'WhatsApp', 'Telegramm', 'Operator' | Zwigend |
platformid | Plattform-ID | Zwigend |
destination | Empfänger, an den die Chat-Nachricht gesendet wird | Zwigend |
message | Nachricht, die per Chat gesendet werden soll | Zwigend |
Antworten:
- Status
-
result (si status=success), Sie werden die nächsten Codes bekommen:
- Sie werden kein Grenzkosten bekommen
- Fehler (si status=Fehler), hier werden Sie der Fehlercode bekommen
Fehlercodes:
Code | Beschreibung |
---|---|
MISSING_USER | User / email nicht beiliegend |
MISSING_PASSWORD | Password nicht beiliegend |
MISSING_CLASS | Sorten nicht beiliegend |
MISSING_METHOD | Methode nicht beiliegend |
MISSING_COMPULSORY_PARAM | Parameterversicherung nicht beiliegend |
INCORRECT_USER_PASSWORD | User oder Passwort inkorrekt |
INCORRECT_CLASS | Inkorrekt Sorte |
INCORRECT_METHOD | Inkorrekt Methode |
CHANNEL_NOT_FOUND | Der angegebene Kanal existiert nicht |
Senden Sie eine Datei per Chat mit Swift
let aclass : String = "chat";
let method : String = "sendmessage";
let user : String = "user";
let password : String = "password";
let platform : String = "whatsapp";
let platformid : String = "100";
let destination : String = "3460000000";
let message : String = "test+message";
let urlPath: String = "https://www.afilnet.com/api/http/"
let url: NSURL = NSURL(string: urlPath)!
let request1: NSMutableURLRequest = NSMutableURLRequest(url: url as URL)
request1.httpMethod = "POST"
let stringPost="class="+aclass+"&method="+method+"&user="+user+"&password="+password+"&platform="+platform+"&platformid="+platformid+"&destination="+destination+"&message="+message
let data = stringPost.data(using: String.Encoding.utf8)
request1.timeoutInterval = 60
request1.httpBody=data
request1.httpShouldHandleCookies=false
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as Error {
print(error.localizedDescription)
}let aclass : String = "chat";
let method : String = "sendfile";
let user : String = "user";
let password : String = "password";
let platform : String = "whatsapp";
let platformid : String = "100";
let destination : String = "3460000000";
let type : String = "image";
let fileurl : String = "https://www.example.com/image.jpg";
let thumburl : String = "https://www.example.com/thumb.jpg";
let message : String = "test+message";
let urlPath: String = "https://www.afilnet.com/api/http/?+"&class="+aclass+"&method="+method+"&user="+user+"&password="+password+"&platform="+platform+"&platformid="+platformid+"&destination="+destination+"&type="+type+"&fileurl="+fileurl+"&thumburl="+thumburl+"&message="+message
let url: NSURL = NSURL(string: urlPath)!
let request1: NSURLRequest = NSURLRequest(url: url as URL)
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as NSError {
print(error.localizedDescription)
}
})
let aclass : String = "chat";
let method : String = "sendfile";
let user : String = "user";
let password : String = "password";
let platform : String = "whatsapp";
let platformid : String = "100";
let destination : String = "3460000000";
let type : String = "image";
let fileurl : String = "https://www.example.com/image.jpg";
let thumburl : String = "https://www.example.com/thumb.jpg";
let message : String = "test+message";
let urlPath: String = "https://www.afilnet.com/api/http/"
let url: NSURL = NSURL(string: urlPath)!
let request1: NSMutableURLRequest = NSMutableURLRequest(url: url as URL)
request1.httpMethod = "POST"
let stringPost="class="+aclass+"&method="+method+"&user="+user+"&password="+password+"&platform="+platform+"&platformid="+platformid+"&destination="+destination+"&type="+type+"&fileurl="+fileurl+"&thumburl="+thumburl+"&message="+message
let data = stringPost.data(using: String.Encoding.utf8)
request1.timeoutInterval = 60
request1.httpBody=data
request1.httpShouldHandleCookies=false
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as Error {
print(error.localizedDescription)
}
Parameter | Beschreibung | Zwigend / optional |
---|---|---|
class=chat | Sorte deren Antragen sich realisiert | Zwigend |
method=sendfile | Sortenmethode deren Antragen sich realisiert | Zwigend |
user | Der User / Email Ihres Afilnet Account | Zwigend |
password | Das password Ihres Afilnet Account | Zwigend |
platform | Plattform, an die die Nachricht gesendet wird. Mögliche Werte: 'Webchat', 'WhatsApp', 'Telegramm', 'Operator' | Zwigend |
platformid | Plattform-ID | Zwigend |
destination | Empfänger, an den die Datei gesendet wird | Zwigend |
type | Art der gesendeten Datei. Mögliche Werte: 'Bild', 'Video', 'Audio', 'Sprache', 'Dokument', 'Kontakt' | Zwigend |
fileurl | URL, in der sich die per Chat zu sendende Datei befindet | Zwigend |
thumburl | URL des Miniaturbilds, das der Datei beiliegt | Optional |
message | Nachricht zur Datei | Optional |
Antworten:
- Status
-
result (si status=success), Sie werden die nächsten Codes bekommen:
- Sie werden kein Grenzkosten bekommen
- Fehler (si status=Fehler), hier werden Sie der Fehlercode bekommen
Fehlercodes:
Code | Beschreibung |
---|---|
MISSING_USER | User / email nicht beiliegend |
MISSING_PASSWORD | Password nicht beiliegend |
MISSING_CLASS | Sorten nicht beiliegend |
MISSING_METHOD | Methode nicht beiliegend |
MISSING_COMPULSORY_PARAM | Parameterversicherung nicht beiliegend |
INCORRECT_USER_PASSWORD | User oder Passwort inkorrekt |
INCORRECT_CLASS | Inkorrekt Sorte |
INCORRECT_METHOD | Inkorrekt Methode |
CHANNEL_NOT_FOUND | Der angegebene Kanal existiert nicht |
CHAT_NOT_FOUND | Der angegebene Chat existiert nicht |
INCORRECT_FILETYPE | Der Dateityp ist falsch, überprüfen Sie die möglichen Werte |
INCORRECT_FILEURL | Die Datei-URL ist ungültig |
INCORRECT_THUMBURL | Die URL der Miniaturansicht ist ungültig |
Holen Sie sich eine Liste der Konversationen in einem Chat mit Swift
let aclass : String = "chat";
let method : String = "sendfile";
let user : String = "user";
let password : String = "password";
let platform : String = "whatsapp";
let platformid : String = "100";
let destination : String = "3460000000";
let type : String = "image";
let fileurl : String = "https://www.example.com/image.jpg";
let thumburl : String = "https://www.example.com/thumb.jpg";
let message : String = "test+message";
let urlPath: String = "https://www.afilnet.com/api/http/"
let url: NSURL = NSURL(string: urlPath)!
let request1: NSMutableURLRequest = NSMutableURLRequest(url: url as URL)
request1.httpMethod = "POST"
let stringPost="class="+aclass+"&method="+method+"&user="+user+"&password="+password+"&platform="+platform+"&platformid="+platformid+"&destination="+destination+"&type="+type+"&fileurl="+fileurl+"&thumburl="+thumburl+"&message="+message
let data = stringPost.data(using: String.Encoding.utf8)
request1.timeoutInterval = 60
request1.httpBody=data
request1.httpShouldHandleCookies=false
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as Error {
print(error.localizedDescription)
}let aclass : String = "chat";
let method : String = "getchats";
let user : String = "user";
let password : String = "password";
let platform : String = "whatsapp";
let platformid : String = "100";
let urlPath: String = "https://www.afilnet.com/api/http/?+"&class="+aclass+"&method="+method+"&user="+user+"&password="+password+"&platform="+platform+"&platformid="+platformid
let url: NSURL = NSURL(string: urlPath)!
let request1: NSURLRequest = NSURLRequest(url: url as URL)
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as NSError {
print(error.localizedDescription)
}
})
let aclass : String = "chat";
let method : String = "getchats";
let user : String = "user";
let password : String = "password";
let platform : String = "whatsapp";
let platformid : String = "100";
let urlPath: String = "https://www.afilnet.com/api/http/"
let url: NSURL = NSURL(string: urlPath)!
let request1: NSMutableURLRequest = NSMutableURLRequest(url: url as URL)
request1.httpMethod = "POST"
let stringPost="class="+aclass+"&method="+method+"&user="+user+"&password="+password+"&platform="+platform+"&platformid="+platformid
let data = stringPost.data(using: String.Encoding.utf8)
request1.timeoutInterval = 60
request1.httpBody=data
request1.httpShouldHandleCookies=false
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as Error {
print(error.localizedDescription)
}
Parameter | Beschreibung | Zwigend / optional |
---|---|---|
class=chat | Sorte deren Antragen sich realisiert | Zwigend |
method=getchats | Sortenmethode deren Antragen sich realisiert | Zwigend |
user | Der User / Email Ihres Afilnet Account | Zwigend |
password | Das password Ihres Afilnet Account | Zwigend |
platform | Plattform, an die die Nachricht gesendet wird. Mögliche Werte: 'Webchat', 'WhatsApp', 'Telegramm', 'Operator' | Zwigend |
platformid | Plattform-ID | Zwigend |
Antworten:
- Status
-
result (si status=success), Sie werden die nächsten Codes bekommen:
-
list
- platformid
- platform
- message
- destination
- messageid
- sent
- status
- datetime
-
list
- Fehler (si status=Fehler), hier werden Sie der Fehlercode bekommen
Fehlercodes:
Code | Beschreibung |
---|---|
MISSING_USER | User / email nicht beiliegend |
MISSING_PASSWORD | Password nicht beiliegend |
MISSING_CLASS | Sorten nicht beiliegend |
MISSING_METHOD | Methode nicht beiliegend |
MISSING_COMPULSORY_PARAM | Parameterversicherung nicht beiliegend |
INCORRECT_USER_PASSWORD | User oder Passwort inkorrekt |
INCORRECT_CLASS | Inkorrekt Sorte |
INCORRECT_METHOD | Inkorrekt Methode |
CHANNEL_NOT_FOUND | Der angegebene Kanal existiert nicht |
CHAT_NOT_FOUND | Der angegebene Chat existiert nicht |
Liste der Nachrichten aus einem Chat mit Swift abrufen
let aclass : String = "chat";
let method : String = "getchats";
let user : String = "user";
let password : String = "password";
let platform : String = "whatsapp";
let platformid : String = "100";
let urlPath: String = "https://www.afilnet.com/api/http/"
let url: NSURL = NSURL(string: urlPath)!
let request1: NSMutableURLRequest = NSMutableURLRequest(url: url as URL)
request1.httpMethod = "POST"
let stringPost="class="+aclass+"&method="+method+"&user="+user+"&password="+password+"&platform="+platform+"&platformid="+platformid
let data = stringPost.data(using: String.Encoding.utf8)
request1.timeoutInterval = 60
request1.httpBody=data
request1.httpShouldHandleCookies=false
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as Error {
print(error.localizedDescription)
}let aclass : String = "chat";
let method : String = "getmessages";
let user : String = "user";
let password : String = "password";
let platform : String = "whatsapp";
let platformid : String = "100";
let destination : String = "34600000000";
let urlPath: String = "https://www.afilnet.com/api/http/?+"&class="+aclass+"&method="+method+"&user="+user+"&password="+password+"&platform="+platform+"&platformid="+platformid+"&destination="+destination
let url: NSURL = NSURL(string: urlPath)!
let request1: NSURLRequest = NSURLRequest(url: url as URL)
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as NSError {
print(error.localizedDescription)
}
})
let aclass : String = "chat";
let method : String = "getmessages";
let user : String = "user";
let password : String = "password";
let platform : String = "whatsapp";
let platformid : String = "100";
let destination : String = "34600000000";
let urlPath: String = "https://www.afilnet.com/api/http/"
let url: NSURL = NSURL(string: urlPath)!
let request1: NSMutableURLRequest = NSMutableURLRequest(url: url as URL)
request1.httpMethod = "POST"
let stringPost="class="+aclass+"&method="+method+"&user="+user+"&password="+password+"&platform="+platform+"&platformid="+platformid+"&destination="+destination
let data = stringPost.data(using: String.Encoding.utf8)
request1.timeoutInterval = 60
request1.httpBody=data
request1.httpShouldHandleCookies=false
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as Error {
print(error.localizedDescription)
}
Parameter | Beschreibung | Zwigend / optional |
---|---|---|
class=chat | Sorte deren Antragen sich realisiert | Zwigend |
method=getmessages | Sortenmethode deren Antragen sich realisiert | Zwigend |
user | Der User / Email Ihres Afilnet Account | Zwigend |
password | Das password Ihres Afilnet Account | Zwigend |
platform | Plattform, an die die Nachricht gesendet wird. Mögliche Werte: 'Webchat', 'WhatsApp', 'Telegramm', 'Operator' | Zwigend |
platformid | Plattform-ID | Zwigend |
destination | Empfänger, von dem Sie die Nachrichten erhalten möchten | Zwigend |
Antworten:
- Status
-
result (si status=success), Sie werden die nächsten Codes bekommen:
-
list
- platformid
- platform
- message
- destination
- messageid
- sent
- status
- datetime
-
list
- Fehler (si status=Fehler), hier werden Sie der Fehlercode bekommen
Fehlercodes:
Code | Beschreibung |
---|---|
MISSING_USER | User / email nicht beiliegend |
MISSING_PASSWORD | Password nicht beiliegend |
MISSING_CLASS | Sorten nicht beiliegend |
MISSING_METHOD | Methode nicht beiliegend |
MISSING_COMPULSORY_PARAM | Parameterversicherung nicht beiliegend |
INCORRECT_USER_PASSWORD | User oder Passwort inkorrekt |
INCORRECT_CLASS | Inkorrekt Sorte |
INCORRECT_METHOD | Inkorrekt Methode |
CHANNEL_NOT_FOUND | Der angegebene Kanal existiert nicht |
CHAT_NOT_FOUND | Der angegebene Chat existiert nicht |
Holen Sie sich eine Liste ungelesener Nachrichten aus einem Chat mit Swift
let aclass : String = "chat";
let method : String = "getmessages";
let user : String = "user";
let password : String = "password";
let platform : String = "whatsapp";
let platformid : String = "100";
let destination : String = "34600000000";
let urlPath: String = "https://www.afilnet.com/api/http/"
let url: NSURL = NSURL(string: urlPath)!
let request1: NSMutableURLRequest = NSMutableURLRequest(url: url as URL)
request1.httpMethod = "POST"
let stringPost="class="+aclass+"&method="+method+"&user="+user+"&password="+password+"&platform="+platform+"&platformid="+platformid+"&destination="+destination
let data = stringPost.data(using: String.Encoding.utf8)
request1.timeoutInterval = 60
request1.httpBody=data
request1.httpShouldHandleCookies=false
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as Error {
print(error.localizedDescription)
}let aclass : String = "chat";
let method : String = "getunreadmessages";
let user : String = "user";
let password : String = "password";
let platform : String = "whatsapp";
let platformid : String = "100";
let destination : String = "34600000000";
let urlPath: String = "https://www.afilnet.com/api/http/?+"&class="+aclass+"&method="+method+"&user="+user+"&password="+password+"&platform="+platform+"&platformid="+platformid+"&destination="+destination
let url: NSURL = NSURL(string: urlPath)!
let request1: NSURLRequest = NSURLRequest(url: url as URL)
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as NSError {
print(error.localizedDescription)
}
})
let aclass : String = "chat";
let method : String = "getunreadmessages";
let user : String = "user";
let password : String = "password";
let platform : String = "whatsapp";
let platformid : String = "100";
let destination : String = "34600000000";
let urlPath: String = "https://www.afilnet.com/api/http/"
let url: NSURL = NSURL(string: urlPath)!
let request1: NSMutableURLRequest = NSMutableURLRequest(url: url as URL)
request1.httpMethod = "POST"
let stringPost="class="+aclass+"&method="+method+"&user="+user+"&password="+password+"&platform="+platform+"&platformid="+platformid+"&destination="+destination
let data = stringPost.data(using: String.Encoding.utf8)
request1.timeoutInterval = 60
request1.httpBody=data
request1.httpShouldHandleCookies=false
let queue:OperationQueue = OperationQueue()
NSURLConnection.sendAsynchronousRequest(request1 as URLRequest, queue: queue, completionHandler:{ (response: URLResponse?, data: Data?, error: Error?) -> Void in
do {
if let jsonResult = try JSONSerialization.jsonObject(with: data!, options: []) as? NSDictionary {
// Do something with result
}
} catch let error as Error {
print(error.localizedDescription)
}
Parameter | Beschreibung | Zwigend / optional |
---|---|---|
class=chat | Sorte deren Antragen sich realisiert | Zwigend |
method=getunreadmessages | Sortenmethode deren Antragen sich realisiert | Zwigend |
user | Der User / Email Ihres Afilnet Account | Zwigend |
password | Das password Ihres Afilnet Account | Zwigend |
platform | Plattform, an die die Nachricht gesendet wird. Mögliche Werte: 'Webchat', 'WhatsApp', 'Telegramm', 'Operator' | Zwigend |
platformid | Plattform-ID | Zwigend |
destination | Empfänger, von dem Sie die Nachrichten erhalten möchten | Zwigend |
Antworten:
- Status
-
result (si status=success), Sie werden die nächsten Codes bekommen:
-
list
- platformid
- platform
- message
- destination
- messageid
- issent
- status
- datetime
-
list
- Fehler (si status=Fehler), hier werden Sie der Fehlercode bekommen
Fehlercodes:
Code | Beschreibung |
---|---|
MISSING_USER | User / email nicht beiliegend |
MISSING_PASSWORD | Password nicht beiliegend |
MISSING_CLASS | Sorten nicht beiliegend |
MISSING_METHOD | Methode nicht beiliegend |
MISSING_COMPULSORY_PARAM | Parameterversicherung nicht beiliegend |
INCORRECT_USER_PASSWORD | User oder Passwort inkorrekt |
INCORRECT_CLASS | Inkorrekt Sorte |
INCORRECT_METHOD | Inkorrekt Methode |
CHANNEL_NOT_FOUND | Der angegebene Kanal existiert nicht |
CHAT_NOT_FOUND | Der angegebene Chat existiert nicht |

Welche API für Swift soll ich verwenden?
Entdecken Sie die Vor- und Nachteile jeder unserer APIs. Finden Sie heraus, welche API für Ihre Software in Swift am besten geeignet ist.
Mit dieser API können Sie von Swift aus eine Verbindung zu uns herstellen, um Anfragen über HTTP GET-Anfragen zu senden. Diese Anfrage sendet die Parameter in derselben URL wie die Anfrage.
- HTTP GET ist extrem einfach zu implementieren
- Informationen werden unverschlüsselt gesendet (Passwörter können aus Protokollen oder Cache extrahiert werden)
- Maximale Anfrage von ~4000 Zeichen
Mit der POST-Anfrage-API können Sie von Swift aus eine Verbindung zu unserer API herstellen, indem Sie Anfrageparameter über HTTP-POST-Parameter senden. Die Informationen werden unabhängig von der URL gesendet.
- HTTP POST ist einfach zu implementieren
- Informationen werden verschlüsselt gesendet
- Die Größe der Anfrage ist unbegrenzt
- Mittlere Sicherheit
Die grundlegende Authentifizierungs-API ermöglicht die Verwendung von GET- und POST-Anfragen in Swift mit einer zusätzlichen Sicherheitsschicht, da in diesem Fall der Benutzername und das Passwort im Header der Anfrage gesendet werden.
- Die Basisauthentifizierung ist einfach zu implementieren
- Zugangsdaten werden verschlüsselt gesendet
- Die Größenbeschränkung hängt von der Verwendung von GET oder POST ab
- Mittlere Sicherheit
SOAP ermöglicht es Ihnen, Anfragen im XML-Format mit Swift zu senden, SOAP fügt API-Anfragen eine zusätzliche Sicherheitsebene hinzu.
- Die SOAP-Integration ist komplexer
- Informationen werden verschlüsselt gesendet
- Die Größe der Anfrage ist unbegrenzt
- Mittlere/hohe Sicherheit
Unsere JSON-API ermöglicht es Ihnen, Anfragen im JSON-Format mit Swift zu senden, zusätzlich fügt diese API das oAuth 2.0-Protokoll zur Authentifizierung hinzu, mit dem Sie eine zusätzliche Sicherheitsebene hinzufügen können.
- Die JSON oAuth 2.0-Integration ist komplexer
- Informationen werden verschlüsselt gesendet
- Die Größe der Anfrage ist unbegrenzt
- Hohe Sicherheit
Verbinden Sie Swift mit unserer Chats API
Registrieren Sie sich als Kunde
Um Zugriff auf die API zu haben, müssen Sie ein Afilnet-Kunde sein. Die Registrierung dauert einige Minuten.
Fordern Sie Ihre kostenlose Testversion an
Unser Unternehmen bietet Ihnen ein Testguthaben an, mit dem Sie mit der von Ihnen benötigten API testen können.
Integrieren Sie die API
Führen Sie die API-Integration mit der Programmiersprache Ihrer Wahl durch. Wenn Sie Fragen oder Anregungen zur API haben, kontaktieren Sie uns
Willkommen bei Afilnet!
Alles bereit! Hat es geschafft, seine Kommunikation mit Afilnet zu verbessern. Wir sind hier, um unsere API zu unterstützen, wenn Sie sie benötigen
Wenden Sie sich bei Fragen über die von uns angebotenen Kontaktmethoden an unser Team. Unser Team wird versuchen, Ihnen eine sofortige Lösung anzubieten und Ihnen bei der Integration unserer API in Ihre Software helfen.