Skip to content

EdwinWalela/africastalking-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Africa's Talking Golang SDK

tests License: MIT Go Report Card Go Reference

Unofficial Golang SDK for the Africa's Talking API with no external dependencies

Install

go get github.com/edwinwalela/africastalking-go

Quick Start: Sending an SMS

This example makes use of the sms package to send bulk sms

package main

import (
	"fmt"
	"github.com/edwinwalela/africastalking-go/pkg/sms"
)

func main() {
	client := &Client{
		ApiKey:    os.Getenv("AT_API_KEY"),
		Username:  os.Getenv("AT_USERNAME"),
		IsSandbox: true,
	}

	bulkRequest := &BulkRequest{
		To:            []string{"+254700000000","+254700000001","+254700000002"},
		Message:       "Hello AT",
		From:          "",
		BulkSMSMode:   true,
		RetryDuration: time.Hour,
	}

	response, err := client.SendBulk(bulkRequest)

	fmt.Println(response)
}

Local development

Clone repo

git clone https://github.com/EdwinWalela/africastalking-go

Export Africa's talking credentials (sandbox)

A caller ID is required for the Voice API. You can generate one on the sandbox dashboard under Voice > Create Number

export AT_USERNAME=sandbox

export AT_API_KEY=xxxxxxxxxxxxx

export AT_CALLER_ID=+254xxxxxxxxx 

Run tests

make test

Resources

Features

SMS

  • Sending (Bulk & Premium)

Airtime

  • Sending

Voice

  • Call
  • Transfer

TODO

SMS

  • Premium Subscriptions
  • Fetch Messages
  • Notifications

USSD

  • Sessions
  • Notifications

Airtime

  • Query

Payments

  • C2B
  • B2C
  • B2B
  • Bank
  • Card
  • Query

Mobile Data

  • Sending

Contributing

Any contribution, in the form of a suggestion, bug report or pull request, is well accepted.

About

Unofficial Golang SDK for the Africa's Talking API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published