- 📱 About The Project
- 🌟 Features
- ⚙️ Prerequisites
- 📦 Installation
- 🛠️ Usage Examples
- 📚 API Reference
- 🤝 Contributing
- 📄 License
This is a Go client library for interfacing with the SMS Gateway for Android™ API. It provides a simple and efficient way to integrate SMS functionality into your Go applications, with features like message sending, status checking, and webhook management.
Key value propositions:
- Lightweight and easy to integrate
- Comprehensive API coverage
- Built with Go best practices
- Send SMS messages with a simple method call.
- Check the state of sent messages.
- Webhooks management.
- Customizable base URL for use with local, cloud or private servers.
Before you begin, ensure you have met the following requirements:
- You have a basic understanding of Go.
- You have Go installed on your local machine.
To install the SMS Gateway API Client in the existing project, run this command in your terminal:
go get github.com/android-sms-gateway/client-go
Here's how to get started with the SMS Gateway API Client:
- Import the
github.com/android-sms-gateway/client-go/smsgateway
package. - Create a new client with configuration using the
smsgateway.NewClient()
method. - Use the
Send()
method to send an SMS message. - Use the
GetState()
method to check the status of a sent message.
package main
import (
"context"
"log"
"os"
"github.com/android-sms-gateway/client-go/smsgateway"
)
func main() {
// Create a client with configuration from environment variables.
client := smsgateway.NewClient(smsgateway.Config{
User: os.Getenv("ASG_USERNAME"),
Password: os.Getenv("ASG_PASSWORD"),
})
// Create a message to send.
message := smsgateway.Message{
TextMessage: &smsgateway.TextMessage{
Text: "Hello, doctors!",
},
PhoneNumbers: []string{
"+15555550100",
"+15555550101",
},
}
// Send the message and get the response.
status, err := client.Send(context.Background(), message)
if err != nil {
log.Fatalf("failed to send message: %v", err)
}
log.Printf("Send message response: %+v", status)
// Get the state of the message and print the response.
status, err = client.GetState(context.Background(), status.ID)
if err != nil {
log.Fatalf("failed to get state: %v", err)
}
log.Printf("Get state response: %+v", status)
}
For more information on the API endpoints and data structures, please consult the SMS Gateway for Android API documentation.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the Apache-2.0 License. See LICENSE
for more information.