Global Celular Gateway API Documentation
Send and receive text messages with just a few lines of code on Messaging, the trusted platform for cross-channel messaging.
Below are the endpoints for accessing Celular Gatewway. Learn how to integrate the API into your application.
Authorization:
- privateId *Specify privateId for site
(e.g., "Bearer example^com-SomeIdString").
Query Parameters:
- type Specify type of SMS
for Transactional OTP (e.g., type:"OTP").
for Promotional Bulk (e.g., type:"TMP").
for Informational personalized (e.g., type:"CXT").
Body Parameters:
- CC Specify which rates to show
(e.g., "US"|"IN"|"DE"). - cellId Specify array of contact number
(e.g., ["+91" + "99876543210"]). - :data Specify the mail OTP|TMP|CXT string
for Transactional OTP (e.g., OTP:"000000").
for Promotional Bulk (e.g., TMP:"sms-id-here").
for Informational personalized (e.g., CXT:"sms-here").
Route Parameters:
- :region *Please check location table here
(e.g., "WEST_3|ARAB_1|EAST_3|NORD_6").
Response based on params:
{
"success": true,
"info": "SMS OTP Sent!"
}This endpoint provides the text for sending celular sms.
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
)
func main() {
result, err := fetchData()
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
prettyJSON, _ := json.MarshalIndent(result, "", " ")
fmt.Println(string(prettyJSON))
}
func fetchData() (map[string]interface{}, error) {
// API configuration
baseURL := "https://textpress.api.koirang.com/v1/:region"
params := map[string]string{
"region": "YOUR_REGION", // Replace with actual region value
}
headers := map[string]string{
"Content-Type": "application/json",
"Authorization": "Bearer <privateId>",
}
queryParams := {"mailId":"example@domain.com","OTP":"000000"}
// Build URL
urlBuilder, err := url.Parse(baseURL)
if err != nil {
return nil, err
}
// Add path parameters
pathParams := ["region"]
path := urlBuilder.Path
for _, param := range pathParams {
path += "/" + url.PathEscape(params[param])
}
urlBuilder.Path = path
// Add query parameters
q := urlBuilder.Query()
for key, value := range queryParams {
q.Add(key, value)
}
urlBuilder.RawQuery = q.Encode()
// Create request body for POST/PUT
var reqBody []byte
if "GET" == "POST" || "GET" == "PUT" {
reqBody, err = json.Marshal({"type":"OTP"})
if err != nil {
return nil, err
}
}
// Create request
req, err := http.NewRequest("GET", urlBuilder.String(), bytes.NewBuffer(reqBody))
if err != nil {
return nil, err
}
// Set headers
for key, value := range headers {
req.Header.Set(key, value)
}
// Send request
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
// Check for errors
if resp.StatusCode >= 400 {
return nil, fmt.Errorf("HTTP error! status: %d", resp.StatusCode)
}
// Read response
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
// Parse JSON response
var result map[string]interface{}
err = json.Unmarshal(body, &result)
if err != nil {
return nil, err
}
return result, nil
}