A Go client library for interacting with the Message Gateway Transport API. This client provides methods for managing channels, templates, and message operations in a messaging platform.
go get github.com/retailcrm/transport-api-client-go
package main
import (
"github.com/retailcrm/transport-api-client-go"
"log"
)
func main() {
client, err := transport_api_client.NewClientWithResponses(
"https://mg-s1.retailcrm.pro/api/bot/v1/",
transport_api_client.WithTransportToken("TRANSPORT_TOKEN"),
)
if err != nil {
log.Fatalf("Error creating client: %v", err)
return
}
}
response, err := client.SendMessageWithResponse(
context.Background(),
transport_api_client.SendMessageJSONRequestBody{},
)
if err != nil {
log.Fatalf("Error sending message: %v", err)
}
if response.JSONDefault != nil {
log.Printf("Error: %s", response.JSONDefault.Errors[0])
}
if response.JSON200 != nil {
log.Printf("Message id: %d", response.JSON200.MessageId)
}