Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
gowizzard committed Oct 22, 2021
1 parent f0eae42 commit 62a89fc
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
# gocm

[![Go](https://github.com/jjideenschmiede/gocm/actions/workflows/go.yml/badge.svg)](https://github.com/jjideenschmiede/gocm/actions/workflows/go.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/jjideenschmiede/gocm)](https://goreportcard.com/report/github.com/jjideenschmiede/gocm)
[![Go](https://github.com/jjideenschmiede/gocm/actions/workflows/go.yml/badge.svg)](https://github.com/jjideenschmiede/gocm/actions/workflows/go.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/jjideenschmiede/gocm)](https://goreportcard.com/report/github.com/jjideenschmiede/gocm) [![Go Doc](https://godoc.org/github.com/jjideenschmiede/gocm?status.svg)](https://pkg.go.dev/github.com/jjideenschmiede/gocm)

With this small library it should be possible to send SMS, WhatsApp & Co messages via [cm.com](https://www.cm.com/de-de/). And, of course, to make other functions of the API usable.

## Business Messaging

In order to send one, or more messages via the Business Messages API, you can use the following function. Here you can find an additional description from the manufacturer.

Currently the following channels can be used: **WhatsApp, Push, RCS, Viber, SMS**

```go
// Define body
body := MessageBody{
Messages: MessageBodyMessages{
Authentication: MessageBodyAuthentication{
Producttoken: "",
},
Msg: []MessageBodyMsg{},
},
}

// Create a message
body.Messages.Msg = append(body.Messages.Msg, MessageBodyMsg{
AllowedChannels: []string{"SMS"},
From: "Test",
To: []MessageBodyTo{},
Body: MessageBodyBody{
Type: "auto",
Content: "Test message",
},
})

// Add receiver
body.Messages.Msg[0].To = append(body.Messages.Msg[0].To, MessageBodyTo{
Number: "004941521234567",
})

// Send message
message, err := Message(body)
if err != nil {
fmt.Println(err)
} else {
fmt.Println(message)
}
```

0 comments on commit 62a89fc

Please sign in to comment.