Api Documentation v1.0
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Api Documentation
Base URLs:
License: Apache 2.0
Authentication
- API Key (X_API_KEY)
- Parameter Name: x-api-key, in: header.
client-doc-controller
Client Doc Controller
Send Message
Code samples
# You can also use wget
curl -X POST /app.otpalerts.com/contak/entoc/send \
-H 'Content-Type: application/json' \
-H 'Accept: */*' \
-H 'x-api-key: string' \
-H 'x-api-key: API_KEY'
POST /app.otpalerts.com/contak/entoc/send HTTP/1.1
Content-Type: application/json
Accept: */*
x-api-key: string
const inputBody = '{
"phone": "91XXXXXXXXXX",
"template": {
"code": "TRANSATION_ALERT",
"model": {
"data": {},
"prefix": "string",
"subtitle": "string",
"suffix": "string",
"title": "string",
"value": "string"
}
},
"validity": 60
}';
const headers = {
'Content-Type':'application/json',
'Accept':'*/*',
'x-api-key':'string',
'x-api-key':'API_KEY'
};
fetch('/app.otpalerts.com/contak/entoc/send',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Content-Type': 'application/json',
'Accept': '*/*',
'x-api-key': 'string',
'x-api-key': 'API_KEY'
}
r = requests.post('/app.otpalerts.com/contak/entoc/send', headers = headers)
print(r.json())
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => '*/*',
'x-api-key' => 'string',
'x-api-key' => 'API_KEY'
}
result = RestClient.post '/app.otpalerts.com/contak/entoc/send',
params: {
}, headers: headers
p JSON.parse(result)
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => '*/*',
'x-api-key' => 'string',
'x-api-key' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','/app.otpalerts.com/contak/entoc/send', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("/app.otpalerts.com/contak/entoc/send");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
"x-api-key": []string{"string"},
"x-api-key": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "/app.otpalerts.com/contak/entoc/send", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
/// <<summary>>
/// Example of Http Client
/// <</summary>>
public class HttpExample
{
private HttpClient Client { get; set; }
/// <<summary>>
/// Setup http client
/// <</summary>>
public HttpExample()
{
Client = new HttpClient();
}
/// Make a dummy request
public async Task MakePostRequest()
{
string url = "/app.otpalerts.com/contak/entoc/send";
string json = @"{
""phone"": ""91XXXXXXXXXX"",
""template"": {
""code"": ""TRANSATION_ALERT"",
""model"": {
""data"": {},
""prefix"": ""string"",
""subtitle"": ""string"",
""suffix"": ""string"",
""title"": ""string"",
""value"": ""string""
}
},
""validity"": 60
}";
CustomerNote content = JsonConvert.DeserializeObject(json);
await PostAsync(content, url);
}
/// Performs a POST Request
public async Task PostAsync(CustomerNote content, string url)
{
//Serialize Object
StringContent jsonContent = SerializeObject(content);
//Execute POST request
HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
}
/// Serialize an object to Json
private StringContent SerializeObject(CustomerNote content)
{
//Serialize Object
string jsonObject = JsonConvert.SerializeObject(content);
//Create Json UTF8 String Content
return new StringContent(jsonObject, Encoding.UTF8, "application/json");
}
/// Deserialize object from request response
private async Task DeserializeObject(HttpResponseMessage response)
{
//Read body
string responseBody = await response.Content.ReadAsStringAsync();
//Deserialize Body to object
var result = JsonConvert.DeserializeObject(responseBody);
}
}
POST /entoc/send
Use this API to send E2E encrypted and structured messages to your customers.
Body parameter
{
"phone": "91XXXXXXXXXX",
"template": {
"code": "TRANSATION_ALERT",
"model": {
"data": {},
"prefix": "string",
"subtitle": "string",
"suffix": "string",
"title": "string",
"value": "string"
}
},
"validity": 60
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| x-api-key | header | string | false | API Key |
| body | body | CustomerNote | true | msg |
Example responses
200 Response
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | ApiResponse_CustomerNote_object_ |
| 201 | Created | Created | None |
| 401 | Unauthorized | Unauthorized | None |
| 403 | Forbidden | Forbidden | None |
| 404 | Not Found | Not Found | None |
Schemas
ApiFieldError
{
"body": {},
"code": "string",
"codeKey": "string",
"codes": [
"string"
],
"description": "string",
"descriptionKey": "string",
"field": "string",
"obzect": "string",
"possibleValues": [
{}
]
}
ApiFieldError
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| body | object | true | none | none |
| code | string | true | none | none |
| codeKey | string | true | none | none |
| codes | [string] | true | none | none |
| description | string | true | none | none |
| descriptionKey | string | true | none | none |
| field | string | true | none | none |
| obzect | string | true | none | none |
| possibleValues | [object] | true | none | none |
ContakModel
{
"data": {},
"prefix": "string",
"subtitle": "string",
"suffix": "string",
"title": "string",
"value": "string"
}
ContakModel
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| data | object | true | none | none |
| prefix | string | true | none | none |
| subtitle | string | true | none | none |
| suffix | string | true | none | none |
| title | string | true | none | none |
| value | string | true | none | none |
CustomerNote
{
"phone": "91XXXXXXXXXX",
"template": {
"code": "TRANSATION_ALERT",
"model": {
"data": {},
"prefix": "string",
"subtitle": "string",
"suffix": "string",
"title": "string",
"value": "string"
}
},
"validity": 60
}
CustomerNote
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| phone | string | true | none | Phone number of customer with ISD Code |
| template | CustomerNoteTemplate | true | none | none |
| validity | integer(int64) | true | none | Message validtity in Seconds |
CustomerNoteTemplate
{
"code": "TRANSATION_ALERT",
"model": {
"data": {},
"prefix": "string",
"subtitle": "string",
"suffix": "string",
"title": "string",
"value": "string"
}
}
CustomerNoteTemplate
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| code | string | true | none | Code of template |
| model | ContakModel | true | none | none |
ApiResponse_CustomerNote_object_
{
"data": {
"phone": "91XXXXXXXXXX",
"template": {
"code": "TRANSATION_ALERT",
"model": {
"data": {},
"prefix": "string",
"subtitle": "string",
"suffix": "string",
"title": "string",
"value": "string"
}
},
"validity": 60
},
"details": [
{}
],
"error": "string",
"errors": [
{
"body": {},
"code": "string",
"codeKey": "string",
"codes": [
"string"
],
"description": "string",
"descriptionKey": "string",
"field": "string",
"obzect": "string",
"possibleValues": [
{}
]
}
],
"exception": "string",
"extra": {},
"logs": [
"string"
],
"message": "This is success message in plain english",
"messageKey": "MESSAGE_SUCCESS:MOBILE:12",
"meta": {},
"params": {},
"path": "/postman/email/send",
"query": {},
"redirectUrl": "/go/to/some/other/url.html",
"results": [
{
"phone": "91XXXXXXXXXX",
"template": {
"code": "TRANSATION_ALERT",
"model": {
"data": {},
"prefix": "string",
"subtitle": "string",
"suffix": "string",
"title": "string",
"value": "string"
}
},
"validity": 60
}
],
"status": 200,
"statusKey": "SUCCESS",
"timestamp": 1541276788518,
"traceid": "string",
"warningKey": "string",
"warnings": [
{
"body": {},
"code": "string",
"codeKey": "string",
"codes": [
"string"
],
"description": "string",
"descriptionKey": "string",
"field": "string",
"obzect": "string",
"possibleValues": [
{}
]
}
]
}
ApiResponse«CustomerNote,object»
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| data | CustomerNote | true | none | none |
| details | [object] | true | none | none |
| error | string | true | none | none |
| errors | [ApiFieldError] | true | none | none |
| exception | string | true | none | none |
| extra | object | true | none | none |
| logs | [string] | true | none | none |
| message | string | true | none | none |
| messageKey | string | true | none | none |
| meta | object | true | none | none |
| params | object | true | none | none |
| path | string | true | none | none |
| query | object | true | none | none |
| redirectUrl | string | true | none | none |
| results | [CustomerNote] | true | none | none |
| status | string | true | none | none |
| statusKey | string | true | none | none |
| timestamp | integer(int64) | true | none | none |
| traceid | string | true | none | none |
| warningKey | string | true | none | none |
| warnings | [ApiFieldError] | true | none | none |