Before you start
- You need Kotlin/JVM installed on your machine.
- You need a Rewrite API key with the required permissions.
Set up REWRITE_API_KEY environment variable
Set up your Rewrite API key in your environment variables.
.env
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Learn how to use the Kotlin SDK to send SMS with the API.
dependencies {
implementation("io.github.rewritetoday:rewrite-kotlin:x.y.z")
}
REWRITE_API_KEY=rw...
import com.rewritetoday.sdk.Rewrite
import com.rewritetoday.sdk.models.messages.SendOptions
fun main() {
val rewrite = Rewrite(System.getenv("REWRITE_API_KEY"))
val params = SendOptions(
to = "+1234567890",
content = "Your OTP code is 478201"
)
val message = rewrite.messages.send(params)
println(message)
}