Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.

README.rst

zang-go

This golang package is an open source tool built to simplify interaction with the Avaya CPaaS telephony platform. Avaya OneCloud™️ CPaaS makes adding voice and SMS to applications fun and easy.

For more information about Avaya CPaaS, please visit: Avaya OneCloud™️ CPaaS

To read the official documentation, please visit: Avaya CPaaS Docs.

Installation

Clone the repo, and install via go get:

$ go get -u github.com/zang-cloud/zang-go

Usage

Authorization

In order to authorize against Avaya OneCloud™️ CPaaS services you'll have to define authentication credentials.

export ZANG_CLOUD_ACCOUNT_SID="{YourAccountSid}"
export ZANG_CLOUD_AUTH_TOKEN="{YourAccessToken}"

Import

import (
    zang "github.com/zang-cloud/zang-go"
)

Logging

In order to use the Avaya OneCloud CPaaS library, logging must be initialized:

package main
import (
    log "github.com/sirupsen/logrus"
    zang "github.com/zang-cloud/zang-go"
)
func init() {
    log.SetLevel(log.DebugLevel)
    formatter := &log.TextFormatter{
            FullTimestamp: true,
    }
        log.SetFormatter(formatter)
}

REST

See the Avaya CPaaS REST API documentation for more information.

**NOTE: ** Please go through tests for specific endpoint to see the example

Send SMS Example

func sendsms() {
    client, err := zang.NewClient()
    if err != nil {
            log.Errorln("Client creation failed:", err)
            return
        }
        log.Debugln("Sending request")
        response, err := client.SendSms(map[string]string{
            "From": "E164 From",
            "To":   "E164 To",
            "Body": "Test Body,
    })

 func main() {
    os.Setenv("ZANG_CLOUD_ACCOUNT_SID", "{YourAccountSid}")
    os.Setenv("ZANG_CLOUD_AUTH_TOKEN", "{YourAccessToken}")
        sendsms()
}

InboundXML

InboundXML is an XML dialect which enables you to control phone call flow. For more information please visit the Zang InboundXML documentation.

<Say> Example

ixml, err := New(Response{Say: &Say{
  Voice: "female",
  Value: "Welcome to Avaya CPaaS!",
  Loop:  3,
}})

fmt.Print(ixml)

will render

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Response>
    <Say loop="3" voice="female" language="en">Welcome to Avaya CPaaS!</Say>
</Response>

About

Zang Cloud Golang API Helper

Resources

License

Releases

No releases published

Packages

No packages published

Languages