How-to · 3 min read
Receive an OTP in Go
A concurrent-friendly Go example for provisioning a number and reading the verification code, with a clean poll loop.
Install with go get github.com/evesescom/go-sdk, then:
client := eveses.New(os.Getenv("EVESES_KEY"))
order, _ := client.Orders.Create(ctx, &eveses.OrderParams{
Country: "ua", Mode: "activation", Service: "telegram",
})
fmt.Println("number:", order.Phone)
// poll for the code (or use a webhook in production)
for {
o, _ := client.Orders.SMS(ctx, order.OrderID)
if len(o.SMS) > 0 {
fmt.Println("code:", o.SMS[0].OTP)
break
}
time.Sleep(1500 * time.Millisecond)
}
client.Orders.Finish(ctx, order.OrderID)
Go's concurrency makes it easy to provision many numbers at once — fan out Orders.Create across goroutines, each with its own Idempotency-Key, and collect codes via a channel.
Ready to build? Create a free Eveses account, top up a wallet, and grab your API key — no KYC. See the API docs or live pricing.
FAQ
▸How do I receive an SMS code in Go?
go get github.com/evesescom/go-sdk, create an order, then poll Orders.SMS or register a webhook.
▸Can I provision many numbers concurrently?
Yes — fan out Orders.Create across goroutines, each with its own idempotency key, and collect codes via a channel.
Related guides