zenvia-go-sdk

module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2021 License: MIT

README

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

  • Get authentication token
  • Create tokenized card
  • Get plans for signatures
  • Get plan by ID
  • Create plan
  • Disable plan by ID
  • Enable plan by ID

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
    // From and To with this format: PREFIX DDD NUMBER WITHOUT MASK
    zenviaAccess := zenvia.ZenviaConfig().
      ApiToken(authToken).
      From("5554999999999").
      To("5554999999999").
      Sandbox()

    zenviaSdk := zenvia.Instance(zenviaAccess)

    zenviaSdk.SendSMS("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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL