Skip to content

APIBrasil/apigratis-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SDK Go Lang - APIGratis by APIBrasil

Conjunto de API, para desenvolvedores.

Transforme seus projetos em solucoes inteligentes com nossa API. Com recursos como API do WhatsApp, geolocalizacao, rastreamento de encomendas, verificacao de CPF/CNPJ e mais, voce pode criar solucoes eficientes e funcionais.

Como instalar

go get github.com/jhowbhz/apigratis-sdk-go

Canais de suporte (Comunidade)

WhatsApp Group Telegram Group

Obtenha suas credenciais

https://apibrasil.com.br

Servicos de API disponiveis no SDK

Up Services available Description Free Beta Stable
Yes WhatsAppService API do WhatsApp Yes Yes Yes
Yes SMS API de SMS . Yes Yes Yes
Yes Receita Data CNPJ API Dados CNPJ Receita. No No No
Yes Receita Data CPF API Dados de CPF Serasa. No No No
Yes CorreiosService API Busca encomendas Correios Brazil. No No No
Yes CEPLocation API CEP Geolocation + IBGE Brazil. No No No
Yes VehiclesService API Placa Dados. No No No
Yes FipeService API Placa FIPE. No No No

Documentacoes

https://apibrasil.com.br/documentacoes

SMS Service

package main

import (
    "encoding/json"
    "fmt"
    "github.com/jhowbhz/apigratis-sdk-go/apigratis"
)

func main() {
    service := apigratis.NewService()

    // sendText
    send := map[string]interface{}{
        "action": "send",
        "credentials": map[string]interface{}{
            "DeviceToken": "YOUR_DEVICE_TOKEN",
            "BearerToken": "YOUR_BEARER_TOKEN",
		},
        "body": map[string]interface{}{
            "number": "5531994359434",
            "message": "Hello World for Go",
        },
    }

    payload, _ := json.Marshal(send)
    response, err := service.Sms(string(payload))

    if err != nil {
        fmt.Println("Error:", err)
        return
    }

    fmt.Println("Response:", response)
}

WhatsApp Service

package main

import (
    "encoding/json"
    "fmt"
    "github.com/jhowbhz/apigratis-sdk-go/apigratis"
)

func main() {

    service := apigratis.NewService()

    // sendText
    sendText := map[string]interface{}{
        "action": "sendText",
        "credentials": map[string]interface{}{
            "DeviceToken": "YOUR_DEVICE_TOKEN",
            "BearerToken": "YOUR_BEARER_TOKEN",
        },
        "body": map[string]interface{}{
            "text":        "Hello World for Go",
            "number":      "5531994359434",
            "time_typing": 1,
        },
    }

    payload, _ := json.Marshal(sendText)
    response, err := service.Whatsapp(string(payload))

    if err != nil {
        fmt.Println("Error:", err)
        return
    }

    fmt.Println("Response:", response)

    // sendFile
    sendFile := map[string]interface{}{
        "action": "sendFile",
        "credentials": map[string]interface{}{
            "DeviceToken": "YOUR_DEVICE_TOKEN",
            "BearerToken": "YOUR_BEARER_TOKEN",
        },
        "body": map[string]interface{}{
            "number" : "5531994359434",
            "path" : "https://assets.nagios.com/downloads/nagiosxi/docs/Installing_The_XI_Linux_Agent.pdf",
            "options" : {
                "caption": "texto do caption para arquivo",
                "createChat": True,
                "filename": "arquivo X"
            }
        },
    }

    payload, _ := json.Marshal(sendFile)
    response, err := service.Whatsapp(string(payload))

    if err != nil {
        fmt.Println("Error:", err)
        return
    }

    fmt.Println("Response:", response)
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages