Skip to content

booscaaa/zenvia-go-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zenvia API - Golang SDK

Zenvia API (2.0)

Reference Release Software License Test status Coverage


Why?

This project is part of my personal portfolio, so, I'll be happy if you could provide me any feedback about the project, code, structure or anything that you can report that could make me a better developer!

Email-me: [email protected]

Connect with me at LinkedIn.


Functionalities

  • Send single SMS

Getting Started

Prerequisites

To run this project in the development mode, you'll need to have a basic environment to run:

  • A Golang SDK, that can be found here.

Installing

$ go get github.com/booscaaa/zenvia-go-sdk

Create a config.json file inside your project like this

The access api_token can be found into Zenvia account

{
  "zenvia": {
    "api_token": "api token"
  }
}


Create main.go file

package main

import (
    "fmt"

    "github.com/booscaaa/zenvia-go-sdk/zenvia"
    "github.com/spf13/viper"
)

func init() {
    viper.SetConfigFile(`config.json`)
    err := viper.ReadInConfig()
    if err != nil {
        panic(err)
    }
}

func main() {
    // Get configuration variavables
    authToken := viper.GetString("zenvia.auth_token")

    // Configure Sandbox access into Zenvia api

    zenviaAccess := zenvia.ZenviaConfig().
      ApiToken(authToken).
      Sandbox()

    zenviaSdk := zenvia.Instance(zenviaAccess)

    // From and To with this format: PREFIX DDD NUMBER WITHOUT MASK
    zenviaSdk.SendSingleSMS("5554999999999", "5554999999999", "Message")

    //see more examples into examples folder
}

Running local

go run main.go



Api application built With




Contributing

You can send how many PR's do you want, I'll be glad to analyze and accept them! And if you have any question about the project...

Email-me: [email protected]

Connect with me at LinkedIn

Thank you!

License

This project is licensed under the MIT License - see the LICENSE.md file for details