Get a Free WhatsApp Business Account – Includes Onboarding, API Access & Sandbox. Apply Now!


Sample Code For Sending Voice in Swift

Sending Voice using Authkey APIs is a breeze and lightning fast. You can simply pass the message body, message sender, mobile number & authkey in the API request to send sms instantly.

Swift Sample Code For Send SMS



import Foundation


let request = NSMutableURLRequest(url: NSURL(string: "https://api.authkey.io/request?authkey=AUTHKEY&mobile=RecepientMobile&
country_code=CountryCode&voice=Hello%2C%20your%20OTP%20is%201234")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()

Sending SMS using Authkey APIs is a breeze and lightning fast. You can simply pass the message body, message sender, mobile number & authkey in the API request to send sms instantly.