https://github.com/sofyan48/go-viro
https://github.com/sofyan48/go-viro
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/sofyan48/go-viro
- Owner: sofyan48
- Created: 2022-07-28T14:45:25.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-07-29T08:18:00.000Z (over 3 years ago)
- Last Synced: 2025-02-19T14:07:48.690Z (about 1 year ago)
- Language: Go
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GOLANG API FOR VIRO SMS
Unofficial VIRO SMS API
## How To Use
Install package via go module
``` bash
go get github.com/sofyan48/go-viro
```
Create Client
---
``` golang
package main
import (
"fmt"
"github.com/sofyan48/go-viro"
"github.com/sofyan48/go-viro/entity"
)
func main() {
client := viro.NewViro("testing", "API_KEY")
}
```
Send Single SMS
---
``` golang
func single(client *viro.Viro) {
res, err := client.SMS().Single("62812479xxxx", "text to send").Send()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res)
}
```
Send Advance SMS
---
``` golang
func advance(client *viro.Viro) {
post1 := entity.AdvancePayload{
To: "08124793xxxx",
Text: "Text To Send",
}
postsData := []entity.AdvancePayload{}
postsData = append(postsData, post1)
postsData = append(postsData, post1)
res, err := client.SMS().Advance(postsData).Send()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res)
}
```
Send Multi SMS
---
``` golang
func multi(client *viro.Viro) {
post1 := entity.MultiPayload{
To: []string{
"081247930699",
"081247930699",
},
Text: "Text To Send",
}
postsData := []entity.MultiPayload{}
postsData = append(postsData, post1)
postsData = append(postsData, post1)
res, err := client.SMS().Multi(postsData).Send()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res)
}
```