Help us shape the future of Go! Take the 2026 Go Developer Survey

turbosms

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 1 Imported by: 0

README

turbosms-go

CI

Golang client for the TurboSMS SOAP gateway. Built on top of code generated by the gowsdl tool.

Note: SOAP is the legacy TurboSMS protocol. For new projects consider the current HTTP API, which also supports Viber messages. This library covers only the SOAP gateway.

Warning: the official SOAP endpoint works over plain HTTP (http://turbosms.in.ua) and HTTPS is not available there. Your login, password and message texts are sent unencrypted.

Install

go get github.com/wildsurfer/turbosms-go

Examples

package main

import (
	"fmt"
	"log"

	sms "github.com/wildsurfer/turbosms-go"
)

func main() {
	c := sms.NewClient("username", "password")
	r, err := c.GetCreditBalance()

	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Credit balance: %s\n", r.GetCreditBalanceResult)
}
package main

import (
	"fmt"
	"log"

	sms "github.com/wildsurfer/turbosms-go"
)

func main() {
	c := sms.NewClient("username", "password")
	r, err := c.SendSMS("testname", "+123469563457", "Test message", "")

	if err != nil {
		log.Fatal(err)
	}
	for _, s := range r.SendSMSResult.ResultArray {
		fmt.Println(s)
	}
}

Error handling

The gateway reports message level failures as text inside SendSMSResult.ResultArray. In this case err stays nil, because the SOAP call itself succeeds. For example, when the account does not have enough credits, the result array contains a string like Не хватает N кредитов для отправки SMS. The texts are localized and have no stable format, so the library does not try to parse them. Always check the returned strings after sending, do not rely on err alone.

Debug

func main() {
	c := sms.NewClient("myusername", "mypassword")
	c.Debug = true

	// ...
}

Documentation

Overview

Package turbosms is a client for the legacy TurboSMS SOAP gateway.

SOAP is the legacy TurboSMS protocol. For new projects consider the current HTTP API: https://turbosms.ua/en/api.html

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	SoapService *wsdl.ServiceSoap
	// Debug enables logging of raw SOAP requests and responses.
	Debug bool
}

Client is a TurboSMS SOAP gateway client. Create it with NewClient.

func NewClient

func NewClient(username string, password string) *Client

NewClient returns a Client that talks to the official TurboSMS SOAP endpoint using the given gateway credentials.

func (*Client) GetCreditBalance

func (c *Client) GetCreditBalance() (*wsdl.GetCreditBalanceResponse, error)

GetCreditBalance returns the current account balance in credits.

func (*Client) GetMessageStatus

func (c *Client) GetMessageStatus(msgId string) (*wsdl.GetMessageStatusResponse, error)

GetMessageStatus returns the delivery status of the message with the given id.

func (*Client) GetNewMessages

func (c *Client) GetNewMessages() (*wsdl.GetNewMessagesResponse, error)

GetNewMessages returns new incoming messages.

func (*Client) SendSMS

func (c *Client) SendSMS(sender string, destination string, text string, wappush string) (*wsdl.SendSMSResponse, error)

SendSMS sends a text message to the destination phone number.

The gateway reports message level failures, for example not enough credits, as strings inside SendSMSResult. In this case the returned error is nil, so always check the result strings.

Directories

Path Synopsis
Package wsdl contains a SOAP client and types generated from the TurboSMS WSDL by the gowsdl tool.
Package wsdl contains a SOAP client and types generated from the TurboSMS WSDL by the gowsdl tool.

Jump to

Keyboard shortcuts

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