Skip to content

Uchencho/go-termii

Repository files navigation

Go-Termii

Termii client application written in Go

Usage

Install Package

go get github.com/Uchencho/go-termii

Documentation

Please see the docs for the most up-to-date documentation of the Termii API.

TERMII

  • Sample Usage
package main

import (
    termii "github.com/Uchencho/go-termii"
    "log"
)

func main() {

    // Set TERMII_API_KEY, TERMII_URL and TERMII_SENDER_ID as environment variables
    // Ensure TERMII_URL ends with '/' i.e 'https://termii.com/'

    req := termii.AutoGeneratedMessageRequest{
        To:  "2347066554433",
        Sms: "Hello from termii", // You do not need to set the API Key in this request struct
    }

    client := termii.NewClient()
    resp, err := client.SendAutoGeneratedMessage(req)
    if err != nil {
        log.Fatal("error in sending autogenerated message", err)
        return
    }
    log.Printf("Response : %+v", resp)
}

NOTE Check the client directory to see a sample implementation and termii_test.go file to see sample tests