telesign-kit

3.1.1

A Swift package used to communicate with the Telesign API
vapor-community/telesign-kit

What's New

TelesignKit 3.1.1

2020-08-08T04:04:34Z

Fixes an issue where signatures would sometimes fail validation because the timezone was set to UTC which isn't a timezone but a time standard and not GMT which is an actual timezone.

TelesignKit

TelesignKit is a Swift package used to communicate with the Telesign API for Server Side Swift Apps.

What's Telesign?

Telesign is a Communication Platform as a Service. Allowing you to send SMS messages for your use case, text to voice communications, phone identification to reduce risk/fraud and many other things.

Installation

To start using TelesignKit, in your Package.swift, add the following

.package(url: "https://github.com/vapor-community/telesignkit.git", from: "3.0.0")

Using the API

In your main.swift simply create a TelesignClient:

import NIO
import TelesignKit

let httpClient = HTTPClient(..)

let client = TelesignClient(httpClient: httpClient,
                            eventLoop: eventloop,
                            apiKey: "YOUR_API_KEY",
                            customerId: "YOUR_CUSTOMER_ID")

do {
    let result = try client.messaging.send(phoneNumber: "11234567890",
                                           message: "Hello Telesign!",
                                           messageType: .ARN).wait()
    print(result)
} catch {
    print(error)
}

Vapor Integration

To use TelesignKit with Vapor 4.x, add a simple extension on Request.

extension Request {
    public var telesign: TelesignClient {
    return TelesignClient(httpClient: self.application.client.http, eventLoop: self.eventLoop, apiKey: "TELESIGN_API_KEY", customerId: "CUSTOMER_ID")
    }
}

// Later...

func sendSMS(req: Request) -> EventLoopFuture<Response> {
    return req.telesign.messaging.send(...)
}

Supports the following APIs

  • Messaging
  • PhoneId
  • Score

Description

  • Swift Tools 5.2.0
View More Packages from this Author

Dependencies

Last updated: Sun Mar 17 2024 23:51:30 GMT-0900 (Hawaii-Aleutian Daylight Time)