textfully

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 6 Imported by: 0

README

Textfully Go SDK

Go Reference Build codecov Release


The official Go SDK for Textfully — The Open Source Twilio Alternative.

Installation

go get github.com/gtfol/textfully-go/v1

Setup

First, you need to generate an API key from the Textfully Dashboard.

Quick Start

import (
    "log"
    "github.com/gtfol/textfully-go/v1"
)

func main() {
    // Set your API key
    client := textfully.New("tx_apikey")

    // Send a message
    _, err := client.Send(
        "+16175555555", // verified phone number
        "Hello, world!",
    )
    if err != nil {
        log.Fatal(err)
    }
}

Contributing

Contributing to the Go library is a great way to get involved with the Textfully community. Reach out to us on Discord or through email at textfully@gtfol.inc if you want to get involved.

Documentation

Index

Constants

View Source
const Version = "0.1.0"

Version is the current version of the SDK

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int    `json:"-"`        // HTTP status code
	Type       string `json:"type"`     // Error type
	Message    string `json:"message"`  // Error message
	Response   string `json:"response"` // Raw response body (if parsing failed)
}

APIError represents an error returned by the API

func (*APIError) Error

func (e *APIError) Error() string

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a Textfully API client

func New

func New(apiKey string) *Client

New creates a new Textfully client with the given API key

func (*Client) Send

func (c *Client) Send(phoneNumber, text string) (*MessageResponse, error)

Send sends a text message

type MessageRequest

type MessageRequest struct {
	PhoneNumber string `json:"phone_number"`
	Text        string `json:"text"`
}

MessageRequest represents a text message to be sent

type MessageResponse

type MessageResponse struct {
	ID        string    `json:"id"`         // Unique message ID
	Status    string    `json:"status"`     // Message status (queued, sent, delivered, failed)
	CreatedAt time.Time `json:"created_at"` // Timestamp when message was created
}

MessageResponse represents the API response for a sent message

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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