Business Communications Tools & App Development Platform | Avaya

Go Getting Started

Back

zang-go


This golang package is an open source tool built to simplify interaction with the Zang telephony platform. Zang Cloud makes adding voice and SMS to applications fun and easy.

For this libraries full documentation visit: http://zang.github.com/zang-cloud/zang-php

For more information about Zang visit: http://zang.io/products/cloud or http://docs.zang.io/aspx/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 Zang Cloud services you'll have to define authentication credentials.

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

REST

Zang REST API documentation

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

Send SMS Example

package example

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

client, _ := zang.NewClient()

response, _ := client.SendSms(map[string]string{
  "From": "E.164 Number Format",
  "To":   "E.164 Number Format",
  "Body": "SMS Body",
})

fmt.Printf("Send sms response: %+v", response)
}

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 Zang!",
  Loop:  3,
}})

fmt.Print(ixml)

will render

<?xml version="1.0"?>

<Response><Say voice="male">Welcome to Zang. This is a sample InboundXML document.</Say></Response>

Pending updates to this document

Subscribe for Updates