Code copied successfuly

Conversations API

Version: v3.5

Specification Release Notes Postman Collection Other versions

The Conversations API allows you to easily send messages to your customers via messaging services like WhatsApp or Viber and still reach customers with classic SMS, with a harmonized data model over all channels.

This API is designed for 2-way messaging (sending and receiving), which allows interactive conversations with your customers.

Delivery notifications (message status updates) and inbound messages from your customers are sent by us to your system via the HTTP POST method. For details see Receiving status updates and Receiving inbound messages.

Channels

The Conversations API provides messaging services via several channels, currently:

  • WhatsApp
  • Viber
  • 2-way SMS (sending and receiving)
  • Telegram (Beta)
  • WeChat (Beta)

Note: If you want to send SMS only, check out our SMS API, which is preferred for 1-way SMS messaging.

Channel specific prerequisites

  • WhatsApp: A WhatsApp Business Account (WABA) is required in order to use this channel.
    Please request your access here.
  • Viber: A Viber Service ID is required in order to use this channel.
    Please request your access here.
  • Telegram: Please contact us for getting access to the beta program for Telegram via onboarding@tyntec.com.
  • WeChat: Please contact us for getting access to the beta program for WeChat via onboarding@tyntec.com.
  • 2-way SMS: Please contact us to get the details for the 2-way SMS setup.

Scope based access control

Conversations uses the concept of scopes to control access to different aspects of your Conversations account and channels available to you.

Scopes are devided into two distinct classes read and write.

read grants you read only access - GET http calls - .

write provides access to data modification or message submission - POST, PUT, DELETE http calls -.

Scopes are used on 2 layers, your API key account and the channels available to it.

You can inspect the scopes available to both layers by fetching the information via Configurations.

We reserve us the right to revoke any granted scope in case we do detect abusive usage of the API.

Adhered web standards

In addition to the compliance common to all our APIs, the Conversations API complies also with:

RFC 5988 is implemented to allow all API calls that return a list of resources, to make use of the following Link headers:

  • first – The first page in the resource list pagination
  • previous – The preceding page of the current page in the resource list pagination
  • current – The current page in the resource list pagination
  • next – The following page in the current page of the resource list pagination
  • last – The last page in the resource list pagination

In addition, the following custom headers are provided for convenience:

  • x-total-pages – The total number of pages in the list of requested sub-resources
  • x-total-items – The total number of items in the list of requested sub-resources
  • x-page-size – The size of a page (maximum number of items on a single page)
  • x-current-page – The page number of the current page in the list of requested sub-resources

Common operations

Version: v3.0

Specification Release Notes Other versions

In this section, you find an overview of operations common to all Conversations channels.

The Conversations API works as a wrapper for messaging on varied channels and aims to provide a common data model unified to the greatest possible extent.

Here are some guidelines on the general usage. For details about interaction on a particular channel, please refer to the channel specific section.

Sending messages

All channels use the same endpoint and generic data model for requests to send messages. However, the components of messages beyond plain text are channel specific. Some channels enforce special policies and restrictions, for example the WhatsApp channel, and you need to watch that you comply with them in the context of your use case.

For details on the channels, please refer to the channel specific section.

Media and other non-text content

Some channels allow you to attach images, video, audio, stickers, buttons or URLs. These kinds of content are channel specific.

Bulk messaging

All channels provide the functionality of sending bulks of messages. A bulk of messages is always sent via one channel to a single recipient.

Our system guarantees that the messages are sent to the recipient in the requested order.

Receiving status updates

The API allows you to automatically receive delivery notifications and status updates about messages that you sent to your channels.

For this service, you will need to provide a URL (messageStatusUrl) at your webserver, e.g. https://rest.customer.com/messagestatus/. This URL must serve a webhook able to process POST HTTP requests, which the tyntec system will fire upon events in the system, in this case upon message status updates.

You may also configure a opt-in filter on one or more MessageStatus::* event types in the tyntec application, see Webhook Configuration and Webhook Events. The set of available event types slightly varies on each channel:

Channel Accepted Dispatched Delivered Seen Channel failed Deleted
WhatsApp
Viber
Telegram
WeChat
SMS

Retries

The tyntec application will retry to post the request 2 more times in the case your webhook does not accept the request (final response codes other than 2xx).

Receiving inbound messages

The API allows you to automatically receive inbound messages sent to your channels by your customers.

Note: For the SMS channel, you need to ask us to enable 2-way interaction, see Channel specific prerequisites.

For this service, you will need to provide a URL (inboundMessageUrl) at your webserver, e.g. https://rest.customer.com/inboundmessages/. This URL must serve a webhook able to process POST HTTP requests, which the tyntec application will fire upon the events of inbound messages.

The events fired upon are of type MoMessage.

Retries

The tyntec application will retry to post the request in the case your webhook does not accept the request (final response codes other than 2xx), depending on the channel as follows:

  • WhatsApp: retries via the WhatsApp mechanism with exponential decrease in frequency of attempts that continues nearly indefinitely (attempts repeat less and less often)
  • Viber: TODO
  • WeChat: TODO
  • Telegram: TODO
  • SMS: retries every 10 seconds. Retries are paused for 10 minutes after every 100 consecutive unsuccessful delivery attempts. tyntec's application will keep trying for a maximum of 48 hours.

Base URLs

Message details

Operations on single sent messages common to all channels. They provide detailed information about sent messages.

Check message status

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/messages/{messageId}/status \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/messages/{messageId}/status HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/messages/{messageId}/status',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/messages/{messageId}/status',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/messages/{messageId}/status', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/messages/{messageId}/status', 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("https://api.tyntec.com/conversations/v3/messages/{messageId}/status");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/messages/{messageId}/status", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /messages/{messageId}/status

Check the status of a message

Parameters

Name In Type Required Description
messageId path string(uuid) true Message id provided by tyntec

Example responses

200 Response

{
  "messageId": "8540d774-4863-4d2b-b788-4ecb19412e85",
  "status": "string",
  "timestamp": "2019-08-24T14:15:22Z"
}

404 Response

{
  "type": "https://httpstatuses.com/404",
  "title": "Not Found",
  "status": 404
}

Responses

Status Meaning Description Schema
200 OK Response after the server has accepted the request MessageStatus
404 Not Found The requested element was not found Problem
default Default Default response in case of any other error. Please check the error object for details Problem

List delivery events

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/messages/{messageId}/events \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/messages/{messageId}/events HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/messages/{messageId}/events',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/messages/{messageId}/events',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/messages/{messageId}/events', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/messages/{messageId}/events', 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("https://api.tyntec.com/conversations/v3/messages/{messageId}/events");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/messages/{messageId}/events", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /messages/{messageId}/events

List the delivery events of a message

Parameters

Name In Type Required Description
messageId path string(uuid) true Message id provided by tyntec

Example responses

200 Response

{}

404 Response

{
  "type": "https://httpstatuses.com/404",
  "title": "Not Found",
  "status": 404
}

Responses

Status Meaning Description Schema
200 OK The list of delivery events MessageDeliveryEvents
404 Not Found The requested element was not found Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Inbound media

After receiving an inbound message (MoMessage event) with a media ID, this endpoint can be used to download the media file.

Download media file

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/media/{mediaId} \
  -H 'Accept: audio/*' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/media/{mediaId} HTTP/1.1
Host: api.tyntec.com
Accept: audio/*


const headers = {
  'Accept':'audio/*',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/media/{mediaId}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'audio/*',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/media/{mediaId}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'audio/*',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/media/{mediaId}', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'audio/*',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/media/{mediaId}', 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("https://api.tyntec.com/conversations/v3/media/{mediaId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"audio/*"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/media/{mediaId}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /media/{mediaId}

Retrieve the media associated with the id

Parameters

Name In Type Required Description
mediaId path string(uuid) true Media provided by tyntec

Example responses

200 Response

404 Response

{
  "status": 404
}

default Response

{
  "type": "https://docs.tyntec.com/problems/DataNotParseable",
  "title": "Data given was not parseable",
  "status": 400,
  "detail": "Unexpected end-of-input: expected close marker for Object (start marker at [Source: UNKNOWN; line: -1, column: -1) at [Source: UNKNOWN; line: 1, column: 97]\n"
}

Responses

Status Meaning Description Schema
200 OK The media associated with the id requested exists. string
404 Not Found The media associated with the id does not exists in our system Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Outbound media (Beta)

As an alternative to the download of outbound media on message requests, we enable you to upload a media file and use it later when sending messages.

After an successful upload we generate an ID which is used as an alternative to the media URL.

The uploaded media can be stored

  • as a static asset
  • only for a certain period
  • for one time usage

As this is in beta, we grant access to it only via an approved access request.

List uploaded media files

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/media \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/media HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/media',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/media',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/media', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/media', 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("https://api.tyntec.com/conversations/v3/media");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/media", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /media

Lists all uploaded media files

Example responses

200 Response

[
  {
    "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad",
    "contentType": "string",
    "validity": "2019-08-24T14:15:22Z",
    "fileName": "string",
    "fileSize": 0
  }
]

Responses

Status Meaning Description Schema
200 OK list of stored media files Inline
default Default Default response in case of any other error. Please check the error object for details Problem
Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [MediaResponse] false none none
» mediaId string(uuid) false none none
» contentType string false none none
» validity string(date-time) false none none
» fileName string false none none
» fileSize integer false none none

Upload a media file

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/conversations/v3/media \
  -H 'Content-Type: */*' \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

POST https://api.tyntec.com/conversations/v3/media HTTP/1.1
Host: api.tyntec.com
Content-Type: */*
Accept: application/json

const inputBody = 'string';
const headers = {
  'Content-Type':'*/*',
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/media',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => '*/*',
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/conversations/v3/media',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': '*/*',
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/conversations/v3/media', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => '*/*',
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/conversations/v3/media', 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("https://api.tyntec.com/conversations/v3/media");
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{"*/*"},
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/conversations/v3/media", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /media

Uploads a media file for message sending

Body parameter

Parameters

Name In Type Required Description
validity query integer false How long is the media stored in minutes.
filename query string false the name of the file
body body string(binary) true the media to be uploaded

Example responses

200 Response

{
  "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad",
  "url": "string",
  "quota": 0,
  "usage": 0
}

Responses

Status Meaning Description Schema
200 OK The media was successfully uploaded MediaUploadResponse
default Default Default response in case of any other error. Please check the error object for details Problem

Delete a media file

Code samples

# You can also use wget
curl -X DELETE https://api.tyntec.com/conversations/v3/media/{mediaId} \
  -H 'Accept: application/problem+json' \
  -H 'apikey: API_KEY'

DELETE https://api.tyntec.com/conversations/v3/media/{mediaId} HTTP/1.1
Host: api.tyntec.com
Accept: application/problem+json


const headers = {
  'Accept':'application/problem+json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/media/{mediaId}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/problem+json',
  'apikey' => 'API_KEY'
}

result = RestClient.delete 'https://api.tyntec.com/conversations/v3/media/{mediaId}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/problem+json',
  'apikey': 'API_KEY'
}

r = requests.delete('https://api.tyntec.com/conversations/v3/media/{mediaId}', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/problem+json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://api.tyntec.com/conversations/v3/media/{mediaId}', 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("https://api.tyntec.com/conversations/v3/media/{mediaId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
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{
        "Accept": []string{"application/problem+json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "https://api.tyntec.com/conversations/v3/media/{mediaId}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

DELETE /media/{mediaId}

Deletes a prior uploaded media.

Parameters

Name In Type Required Description
mediaId path string(uuid) true Media provided by tyntec

Example responses

default Response

{
  "type": "https://docs.tyntec.com/problems/DataNotParseable",
  "title": "Data given was not parseable",
  "status": 400,
  "detail": "Unexpected end-of-input: expected close marker for Object (start marker at [Source: UNKNOWN; line: -1, column: -1) at [Source: UNKNOWN; line: 1, column: 97]\n"
}

Responses

Status Meaning Description Schema
204 No Content The assiciated media was successfully deleted None
default Default Default response in case of any other error. Please check the error object for details Problem

Schemas

MessageRequest

{
  "to": "+123234234",
  "from": "545345345",
  "channel": "whatsapp",
  "whatsapp": {
    "contentType": "text",
    "text": "A simple text message"
  }
}

The message you would like to send

Properties

Name Type Required Restrictions Description
to string true none The receipient of the messages
The format depends on the specific channel
from string true none The sender of the messages. The format depends on the specific channel.
channel string true none Channel selected for delivery.
overrides MessageRequestOverrides false none Overrides of defaults for this message
context string false none Context for this particular message
content object false none content of the message. Refer to the channel specifics

MessageRequestOverrides

{
  "notificationCallbackUrl": "https://en4u5fpprib5i.x.pipedream.net"
}

Overrides of defaults for this message

Properties

Name Type Required Restrictions Description
notificationCallbackUrl string false none When present this url is used for sending the delivery notifications to your webhook.
Can be used for debugging use cases or individual routings.

MessageResponse

{
  "messageId": "77185196-664a-43ec-b14a-fe97036c697f",
  "acceptedAt": "2019-08-24T14:15:22Z"
}

Properties

Name Type Required Restrictions Description
messageId string(uuid) true none Global unique Message Id reference
acceptedAt string(date-time) true none Point in time when the API confirms that the message request was accepted

MessageStatus

{
  "messageId": "8540d774-4863-4d2b-b788-4ecb19412e85",
  "status": "string",
  "timestamp": "2019-08-24T14:15:22Z"
}

Properties

Name Type Required Restrictions Description
messageId string(uuid) false none Global unique Message Id reference
status string false none Current status of the message
timestamp string(date-time) false none Point in time when status has been entered

MessageDeliveryEvents

{}

Properties

None

BulkMessageRequest

{}

Properties

None

BulkMessageResponse

{
  "bulkId": "string",
  "messageIds": [
    "string"
  ]
}

Properties

Name Type Required Restrictions Description
bulkId string false none none
messageIds [string] false none none

MediaUploadResponse

{
  "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad",
  "url": "string",
  "quota": 0,
  "usage": 0
}

Properties

Name Type Required Restrictions Description
mediaId string(uuid) true none none
url string true none none
quota integer true none none
usage integer true none none

MediaResponse

{
  "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad",
  "contentType": "string",
  "validity": "2019-08-24T14:15:22Z",
  "fileName": "string",
  "fileSize": 0
}

Properties

Name Type Required Restrictions Description
mediaId string(uuid) false none none
contentType string false none none
validity string(date-time) false none none
fileName string false none none
fileSize integer false none none

Problem

{
  "type": "https://docs.tyntec.com/problems/DataNotParseable",
  "title": "Data given was not parseable",
  "status": 400,
  "detail": "Unexpected end-of-input: expected close marker for Object (start marker at [Source: UNKNOWN; line: -1, column: -1) at [Source: UNKNOWN; line: 1, column: 97]\n"
}

The problem object follows the RFC-7807 (https://tools.ietf.org/html/rfc7807)

Properties

Name Type Required Restrictions Description
type string true none A URI reference [RFC3986] that identifies the problem type
title string true none A short, human-readable summary of the problem type.
status string true none The HTTP status code (RFC7231, Section 6) generated by the origin server for this occurrence of the problem.
detail string true none A human-readable explanation specific to this occurrence of the problem.

WhatsApp

Version: v3.3

Specification Release Notes Other versions

Conversations allows you to easily send messages to your customers via WhatsApp

Channel specific pre-conditions

  • WhatsApp : A WhatsApp Business Account is required in order to use this channel. Please request access here

Base URLs

Messaging

In this section, we guide you on how to send messages, get information about the status and the events happening during delivery.

Send a message

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/conversations/v3/messages \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

POST https://api.tyntec.com/conversations/v3/messages HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "from": "a cool business",
  "to": "some number",
  "channel": "WhatsApp",
  "content": {
    "contentType": "text",
    "text": "hi there"
  },
  "context": "my-message-reference"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/messages',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/conversations/v3/messages',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/conversations/v3/messages', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/conversations/v3/messages', 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("https://api.tyntec.com/conversations/v3/messages");
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{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/conversations/v3/messages", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /messages

Send messages via this path.

Body parameter

{
  "from": "a cool business",
  "to": "some number",
  "channel": "WhatsApp",
  "content": {
    "contentType": "text",
    "text": "hi there"
  },
  "context": "my-message-reference"
}

Parameters

Name In Type Required Description
body body MessageRequest true The message you would like to send

Example responses

202 Response

{
  "messageId": "77185196-664a-43ec-b14a-fe97036c697f",
  "acceptedAt": "2019-08-24T14:15:22Z"
}

400 Response

{
  "status": 400,
  "violations": [
    {
      "field": "validate.request.whatsapp.contentType",
      "message": "must not be empty"
    }
  ],
  "title": "Constraint Violation"
}

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

Responses

Status Meaning Description Schema
202 Accepted Response after the server has accepted the request MessageResponse
400 Bad Request The request does not match our expectations. Please check the Problems object for details Problem
403 Forbidden You attempting to use a number that is not assigned to your account Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Send a bulk message

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/conversations/v3/bulks \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

POST https://api.tyntec.com/conversations/v3/bulks HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "to": "+1233423454",
  "from": "+1233423454",
  "channel": "WhatsApp",
  "messages": [
    {
      "contentType": "text",
      "text": "string",
      "renderUrlPreview": false
    },
    {
      "contentType": "text",
      "text": "string",
      "renderUrlPreview": false
    }
  ]
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/bulks',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/conversations/v3/bulks',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/conversations/v3/bulks', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/conversations/v3/bulks', 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("https://api.tyntec.com/conversations/v3/bulks");
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{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/conversations/v3/bulks", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /bulks

Send bulk messages. Bulk messages are defined as ordered messages to one receiver.

Body parameter

{
  "to": "+1233423454",
  "from": "+1233423454",
  "channel": "WhatsApp",
  "messages": [
    {
      "contentType": "text",
      "text": "string",
      "renderUrlPreview": false
    },
    {
      "contentType": "text",
      "text": "string",
      "renderUrlPreview": false
    }
  ]
}

Parameters

Name In Type Required Description
body body BulkMessageRequest true The message bulk you would like to send

Example responses

202 Response

{
  "bulkId": "string",
  "messageIds": [
    "string"
  ]
}

400 Response

{
  "status": 400,
  "violations": [
    {
      "field": "validate.request.whatsapp.contentType",
      "message": "must not be empty"
    }
  ],
  "title": "Constraint Violation"
}

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

Responses

Status Meaning Description Schema
202 Accepted Response after the server has accepted the request BulkMessageResponse
400 Bad Request The request does not match our expectations. Please check the Problems object for details Problem
403 Forbidden You attempting to use a number that is not assigned to your account Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Mark a message as read

Code samples

# You can also use wget
curl -X PUT https://api.tyntec.com/conversations/v3/channels/whatsapp/messages/{message-id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/problem+json' \
  -H 'apikey: API_KEY'

PUT https://api.tyntec.com/conversations/v3/channels/whatsapp/messages/{message-id} HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/problem+json

const inputBody = '{
  "status": "read"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/problem+json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/messages/{message-id}',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/problem+json',
  'apikey' => 'API_KEY'
}

result = RestClient.put 'https://api.tyntec.com/conversations/v3/channels/whatsapp/messages/{message-id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/problem+json',
  'apikey': 'API_KEY'
}

r = requests.put('https://api.tyntec.com/conversations/v3/channels/whatsapp/messages/{message-id}', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/problem+json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PUT','https://api.tyntec.com/conversations/v3/channels/whatsapp/messages/{message-id}', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/messages/{message-id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
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{"application/problem+json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PUT", "https://api.tyntec.com/conversations/v3/channels/whatsapp/messages/{message-id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PUT /channels/whatsapp/messages/{message-id}

Marks a previously received WhatsApp message as read

Body parameter

{
  "status": "read"
}

Parameters

Name In Type Required Description
body body WhatsAppMessageStatusUpdate true The status change to execute
message-id path string true The ID of the MoMessage

Example responses

404 Response

{
  "status": 404,
  "title": "Not Found"
}

default Response

{
  "type": "https://docs.tyntec.com/problems/DataNotParseable",
  "title": "Data given was not parseable",
  "status": 400,
  "detail": "Unexpected end-of-input: expected close marker for Object (start marker at [Source: UNKNOWN; line: -1, column: -1) at [Source: UNKNOWN; line: 1, column: 97]\n"
}

Responses

Status Meaning Description Schema
200 OK Message was successfully marked as read. None
404 Not Found No MoMessage found for the given Message ID. Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Account management

Account management grants you access to information about the WhatsApp accounts provisioned to you.

At the moment, it does not support requesting new WhatsApp accounts or editing existing ones.

The subresources of a WhatsApp account can only be managed by API accounts with the respective scopes.

Manageable subresources are:

  • templates

Read access to an account is available for all accounts that are associated with a phone number and thus eligible for sending messages.

List accounts

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /channels/whatsapp/accounts

Lists all WhatsApp accounts managed by these access credentials.

If the phone number query parameter is set, only the phone numbers account is listed.

Parameters

Name In Type Required Description
phone-number query integer false Phone number used for WhatsApp messaging.

Example responses

200 Response

[
  {
    "whatsAppAccountId": "5637b8a7-51e1-47be-ad0b-b242453dcc1b",
    "whatsAppAccountName": "Swagger Sample Account",
    "businessName": "Swagger Sample business",
    "templateNamespace": "c9468969-a3a3-4c17-95f7-1e8b2902ed74",
    "facebookBusinessManagerId": 1791147717848878,
    "accountStatus": {
      "messageOnBehalf": "PENDING"
    },
    "managedBy": {
      "accountName": "tynteccpaas"
    }
  }
]

Responses

Status Meaning Description Schema
200 OK Returned a list of WhatsApp accounts WhatsAppAccounts
default Default Default response in case of any other error. Please check the error object for details Problem

Response Headers

Status Header Type Format Description
200 x-total-pages integer How many pages are available
200 x-total-items integer How many items are available in total
200 x-page-size integer Maximum number of items per page
200 x-current-page integer The current page
200 Link undefined Links describing pagination

Read an account

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id} \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /channels/whatsapp/accounts/{whatsapp-account-id}

Returns details of a WhatsApp account.

Parameters

Name In Type Required Description
whatsapp-account-id path string true WhatsApp account ID

Example responses

200 Response

{
  "whatsAppAccountId": "5637b8a7-51e1-47be-ad0b-b242453dcc1b",
  "whatsAppAccountName": "Swagger Sample Account",
  "businessName": "Swagger Sample business",
  "templateNamespace": "c9468969-a3a3-4c17-95f7-1e8b2902ed74",
  "facebookBusinessManagerId": 1791147717848878,
  "accountStatus": {
    "messageOnBehalf": "PENDING"
  },
  "managedBy": {
    "accountName": "tynteccpaas"
  }
}

404 Response

{
  "status": 404,
  "title": "WhatsApp account unknown"
}

Responses

Status Meaning Description Schema
200 OK Returned a WhatsApp account WhatsAppAccount
404 Not Found The WhatsApp account does not exist. Problem
default Default Default response in case of any other error. Please check the error object for details Problem

List phone numbers

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/phone-numbers \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/phone-numbers HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/phone-numbers',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/phone-numbers',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/phone-numbers', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/phone-numbers', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/phone-numbers");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/phone-numbers", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /channels/whatsapp/accounts/{whatsapp-account-id}/phone-numbers

Lists all phone numbers of a WhatsApp account.

Parameters

Name In Type Required Description
whatsapp-account-id path string true WhatsApp account ID

Example responses

200 Response

[
  {
    "phoneNumber": 4912345678,
    "displayPhonenumber": "+49 123 45678",
    "verifiedName": "Swagger Sample",
    "qualityRating": "YELLOW",
    "status": "FLAGGED",
    "whatsAppAccountId": "5637b8a7-51e1-47be-ad0b-b242453dcc1b",
    "managedBy": {
      "accountName": "tyntecscpaas"
    },
    "messagingVia": {
      "accountName": "messagingcpaas"
    }
  }
]

404 Response

{
  "status": 404,
  "title": "WhatsApp account unknown"
}

Responses

Status Meaning Description Schema
200 OK Returned phone numbers of a WhatsApp account WhatsAppPhoneNumbers
404 Not Found The WhatsApp account does not exist. Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Response Headers

Status Header Type Format Description
200 x-total-pages integer How many pages are available
200 x-total-items integer How many items are available in total
200 x-page-size integer Maximum number of items per page
200 x-current-page integer The current page
200 Link undefined Links describing pagination

Template management

Template management enables you to interact with the templates defined for your WhatsApp account.

You can specify examples for the parameters on each localization. This is advised to increase the chance of acceptance of templates. If you use examples, all dynamic parts of the template, like media header or body parameters must be specified.

It's advised to do this at least for the media templates, as WhatsApp has changed the policies due abuse of media headers to distribute spam / inappropriate content.

We support creating or deleting templates and adding new localizations to an existing template.

Due to restrictions by WhatsApp, editing is not supported yet.

List templates

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /channels/whatsapp/accounts/{whatsapp-account-id}/templates

Lists all templates of your WhatsApp account.

Parameters

Name In Type Required Description
whatsapp-account-id path string true WhatsApp account ID

Example responses

200 Response

[
  {
    "whatsAppAccountId": "5637b8a7-51e1-47be-ad0b-b242453dcc1b",
    "name": "swagger_test",
    "category": "TICKET_UPDATE",
    "localizations": [
      {
        "status": "REJECTED",
        "rejectionReason": "For this example",
        "language": "en",
        "components": [
          {
            "type": "BODY",
            "text": "Hello {{1}}! How is going?"
          },
          {
            "type": "FOOTER",
            "text": "Your specification team!"
          }
        ]
      }
    ]
  }
]

404 Response

{
  "status": 404,
  "title": "WhatsApp account unknown"
}

Responses

Status Meaning Description Schema
200 OK Returned the templates WhatsAppTemplates
404 Not Found The WhatsApp account does not exist. Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Response Headers

Status Header Type Format Description
200 x-total-pages integer How many pages are available
200 x-total-items integer How many items are available in total
200 x-page-size integer Maximum number of items per page
200 x-current-page integer The current page
200 Link undefined Links describing pagination

Submit a template for review

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/problem+json' \
  -H 'apikey: API_KEY'

POST https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/problem+json

const inputBody = '{
  "name": "welcome",
  "category": "AUTO_REPLY",
  "localizations": [
    {
      "language": "en",
      "components": [
        {
          "type": "BODY",
          "text": "Hi {{1}},\n\nwelcome at our support.\nHow can we help you?\n\nYour support team\n"
        }
      ]
    }
  ]
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/problem+json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/problem+json',
  'apikey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/problem+json',
  'apikey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/problem+json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates");
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{"application/problem+json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /channels/whatsapp/accounts/{whatsapp-account-id}/templates

Creates a new template that is submitted for review to Facebook.

Body parameter

{
  "name": "welcome",
  "category": "AUTO_REPLY",
  "localizations": [
    {
      "language": "en",
      "components": [
        {
          "type": "BODY",
          "text": "Hi {{1}},\n\nwelcome at our support.\nHow can we help you?\n\nYour support team\n"
        }
      ]
    }
  ]
}

Parameters

Name In Type Required Description
body body WhatsAppTemplateRequest true The template to be submitted
whatsapp-account-id path string true WhatsApp account ID
Detailed description

body: The template to be submitted

Example responses

400 Response

{
  "status": 400,
  "violations": [
    {
      "field": "validate.request.whatsapp.contentType",
      "message": "must not be empty"
    }
  ],
  "title": "Constraint Violation"
}

404 Response

{
  "status": 404,
  "title": "WhatsApp account unknown"
}

default Response

{
  "type": "https://docs.tyntec.com/problems/DataNotParseable",
  "title": "Data given was not parseable",
  "status": 400,
  "detail": "Unexpected end-of-input: expected close marker for Object (start marker at [Source: UNKNOWN; line: -1, column: -1) at [Source: UNKNOWN; line: 1, column: 97]\n"
}

Responses

Status Meaning Description Schema
201 Created The requested resource was created. None
400 Bad Request The request does not match our expectations. Please check the Problems object for details Problem
404 Not Found The WhatsApp account does not exist. Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Response Headers

Status Header Type Format Description
201 Location string Location URI of the newly created resource

Read a template

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id} \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}

Returns details of a template in your WhatsApp account.

Parameters

Name In Type Required Description
whatsapp-account-id path string true WhatsApp account ID
template-id path string true Referenced template

Example responses

200 Response

{
  "whatsAppAccountId": "5637b8a7-51e1-47be-ad0b-b242453dcc1b",
  "name": "swagger_test",
  "category": "TICKET_UPDATE",
  "localizations": [
    {
      "status": "REJECTED",
      "rejectionReason": "For this example",
      "language": "en",
      "components": [
        {
          "type": "BODY",
          "text": "Hello {{1}}! How is going?"
        },
        {
          "type": "FOOTER",
          "text": "Your specification team!"
        }
      ]
    }
  ]
}

404 Response

{
  "status": 404,
  "title": "WhatsApp account unknown"
}

Responses

Status Meaning Description Schema
200 OK Returned the template from your account WhatsAppTemplateResponse
404 Not Found The WhatsApp account does not exist. Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Delete a template

Code samples

# You can also use wget
curl -X DELETE https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id} \
  -H 'Accept: application/problem+json' \
  -H 'apikey: API_KEY'

DELETE https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id} HTTP/1.1
Host: api.tyntec.com
Accept: application/problem+json


const headers = {
  'Accept':'application/problem+json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/problem+json',
  'apikey' => 'API_KEY'
}

result = RestClient.delete 'https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/problem+json',
  'apikey': 'API_KEY'
}

r = requests.delete('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/problem+json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
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{
        "Accept": []string{"application/problem+json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

DELETE /channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}

Deletes the template from your WhatsApp account.

After deleting the template, a 30-days grace period is starting. This is indicated by the expiresAt property of the localizations.

Parameters

Name In Type Required Description
whatsapp-account-id path string true WhatsApp account ID
template-id path string true Referenced template

Example responses

404 Response

{
  "status": 404,
  "title": "WhatsApp account unknown"
}

default Response

{
  "type": "https://docs.tyntec.com/problems/DataNotParseable",
  "title": "Data given was not parseable",
  "status": 400,
  "detail": "Unexpected end-of-input: expected close marker for Object (start marker at [Source: UNKNOWN; line: -1, column: -1) at [Source: UNKNOWN; line: 1, column: 97]\n"
}

Responses

Status Meaning Description Schema
204 No Content Deletion of the template is pending now. None
404 Not Found The WhatsApp account does not exist. Problem
default Default Default response in case of any other error. Please check the error object for details Problem

List localizations

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations

Lists localizations of a template.

Parameters

Name In Type Required Description
whatsapp-account-id path string true WhatsApp account ID
template-id path string true Referenced template

Example responses

200 Response

[
  {
    "status": "DELETED",
    "rejectionReason": "not yet",
    "language": "en",
    "components": [
      {
        "type": "BODY",
        "text": "Hello {{1}}! How is going?"
      }
    ],
    "createdAt": "2020-02-15T23:28:34.442Z",
    "lastUpdated": "2020-02-15T25:28:34.442Z",
    "expiresAt": "2020-03-15T23:28:34.442Z",
    "qualityScore": {
      "score": "RED",
      "reasons": [
        "Users are choosing \"didn't sign up\" as a reason for blocking this phone number. Businesses must obtain opt-in before sending notifications. Please review your opt-in flow(s) and see our Business Policy for more detail."
      ]
    }
  }
]

404 Response

{
  "status": 404,
  "title": "WhatsApp account unknown"
}

Responses

Status Meaning Description Schema
200 OK Returned localizations of the template. Inline
404 Not Found The WhatsApp account does not exist. Problem
default Default Default response in case of any other error. Please check the error object for details Problem
Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [LocalizationResponse] false none [Localization of a template]
» status string true none Status the localization.
» rejectionReason string false none Descriptive text in the case the status is REJECTED
» language LanguageCode true none Supported language codes, according to Supported Languages
» components [anyOf] true none Set of components defining a template

anyOf

Name Type Required Restrictions Description
»» anonymous WhatsAppTemplateHeaderComponentResponse false none Header component of a template
»»» type string true none Component type
»»» format string true none Which kind of header
»»» text string false none Text based part of format "TEXT

or

Name Type Required Restrictions Description
»» anonymous WhatsAppTemplateBodyComponentResponse false none Body component of a template
»»» type string true none Component type
»»» text string true none Specification of the body text

or

Name Type Required Restrictions Description
»» anonymous WhatsAppTemplateFooterComponentResponse false none Footer component of a template
»»» type string true none Component type
»»» text string true none Specification of the footer text

continued

Name Type Required Restrictions Description
» createdAt string(date-time) true none At which point in time the template was created
» lastUpdated string(date-time) true none At which point in time the last update happened
» expiresAt string(date-time) false none When does the localization expire.
Only present when a template was deleted.
» qualityScore QualityScore false none The quality score provided by WhatsApp and calculated from user feedback on your messages
»» score string true none The current scoring
»» reasons [string] false none Textual description why the quality score is set to the value.
Only present when score is YELLOW or RED
Enumerated values
Property Value
status REQUESTED
status SUBMIT_FAILED
status PENDING
status APPROVED
status REJECTED
status DELETION_PENDING
status DELETED
status SUBMITTED
language af
language ar
language az
language bg
language bn
language ca
language cs
language da
language de
language el
language en
language en_GB
language en_US
language es
language es_AR
language es_ES
language es_MX
language et
language fa
language fi
language fil
language fr
language ga
language gu
language ha
language he
language hi
language hr
language hu
language ID
language it
language ja
language kk
language kn
language ko
language lo
language lt
language lv
language mk
language ml
language mr
language ms
language nb
language nl
language pa
language pl
language pt_BR
language pt_PT
language ro
language ru
language sk
language sl
language sq
language sr
language sv
language sw
language ta
language te
language th
language tr
language uk
language ur
language uz
language vi
language zh_CN
language zh_HK
language zh_TW
language zu
type HEADER
format IMAGE
format TEXT
format DOCUMENT
format VIDEO
type BODY
type FOOTER
score unknown
score GREEN
score YELLOW
score RED

Add a localization

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/problem+json' \
  -H 'apikey: API_KEY'

POST https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/problem+json

const inputBody = '{
  "language": "en",
  "components": [
    {
      "type": "BODY",
      "text": "string"
    }
  ]
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/problem+json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/problem+json',
  'apikey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/problem+json',
  'apikey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/problem+json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations");
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{"application/problem+json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/conversations/v3/channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /channels/whatsapp/accounts/{whatsapp-account-id}/templates/{template-id}/localizations

Adds a localization to a template. The localization will be separately reviewed by Facebook.

Body parameter

{
  "language": "en",
  "components": [
    {
      "type": "BODY",
      "text": "string"
    }
  ]
}

Parameters

Name In Type Required Description
body body LocalizationRequest true The localization to be submitted
whatsapp-account-id path string true WhatsApp account ID
template-id path string true Referenced template
Detailed description

body: The localization to be submitted

Example responses

400 Response

{
  "status": 400,
  "violations": [
    {
      "field": "validate.request.whatsapp.contentType",
      "message": "must not be empty"
    }
  ],
  "title": "Constraint Violation"
}

404 Response

{
  "status": 404,
  "title": "WhatsApp account unknown"
}

default Response

{
  "type": "https://docs.tyntec.com/problems/DataNotParseable",
  "title": "Data given was not parseable",
  "status": 400,
  "detail": "Unexpected end-of-input: expected close marker for Object (start marker at [Source: UNKNOWN; line: -1, column: -1) at [Source: UNKNOWN; line: 1, column: 97]\n"
}

Responses

Status Meaning Description Schema
201 Created The requested resource was created. None
400 Bad Request The request does not match our expectations. Please check the Problems object for details Problem
404 Not Found The WhatsApp account does not exist. Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Response Headers

Status Header Type Format Description
201 Location string Location URI of the newly created resource

Phone Number insights

Phone Number insights allow you to get information about the status of a phone number in your account.

It also provides read access to the templates usable with the phone number.

List phone numbers

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /channels/whatsapp/phone-numbers

Lists all phone numbers accessible for the given credentials.

Example responses

200 Response

[
  {
    "phoneNumber": 4912345678,
    "displayPhonenumber": "+49 123 45678",
    "verifiedName": "Swagger Sample",
    "qualityRating": "YELLOW",
    "status": "FLAGGED",
    "whatsAppAccountId": "5637b8a7-51e1-47be-ad0b-b242453dcc1b",
    "managedBy": {
      "accountName": "tyntecscpaas"
    },
    "messagingVia": {
      "accountName": "messagingcpaas"
    }
  }
]

Responses

Status Meaning Description Schema
200 OK Phone numbers assigned to your account WhatsAppPhoneNumbers
default Default Default response in case of any other error. Please check the error object for details Problem

Response Headers

Status Header Type Format Description
200 x-total-pages integer How many pages are available
200 x-total-items integer How many items are available in total
200 x-page-size integer Maximum number of items per page
200 x-current-page integer The current page
200 Link undefined Links describing pagination

Read a phone number

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number} \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number} HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /channels/whatsapp/phone-numbers/{phone-number}

Returns details about a phone number.

Parameters

Name In Type Required Description
phone-number path integer true Phone number used for WhatsApp messaging.

Example responses

200 Response

{
  "phoneNumber": 4912345678,
  "displayPhonenumber": "+49 123 45678",
  "verifiedName": "Swagger Sample",
  "qualityRating": "YELLOW",
  "status": "FLAGGED",
  "whatsAppAccountId": "5637b8a7-51e1-47be-ad0b-b242453dcc1b",
  "managedBy": {
    "accountName": "tyntecscpaas"
  },
  "messagingVia": {
    "accountName": "messagingcpaas"
  }
}

404 Response

{
  "status": 404,
  "title": "Phone number unknown"
}

Responses

Status Meaning Description Schema
200 OK Returned the details about the phone number WhatsAppPhoneNumber
404 Not Found The phone number does not exist. Problem
default Default Default response in case of any other error. Please check the error object for details Problem

List available templates

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/templates \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/templates HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/templates',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/templates',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/templates', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/templates', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/templates");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/templates", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /channels/whatsapp/phone-numbers/{phone-number}/templates

Lists all available templates for a phone number

Parameters

Name In Type Required Description
phone-number path integer true Phone number used for WhatsApp messaging.

Example responses

200 Response

[
  {
    "whatsAppAccountId": "5637b8a7-51e1-47be-ad0b-b242453dcc1b",
    "name": "swagger_test",
    "category": "TICKET_UPDATE",
    "localizations": [
      {
        "status": "REJECTED",
        "rejectionReason": "For this example",
        "language": "en",
        "components": [
          {
            "type": "BODY",
            "text": "Hello {{1}}! How is going?"
          },
          {
            "type": "FOOTER",
            "text": "Your specification team!"
          }
        ]
      }
    ]
  }
]

404 Response

{
  "status": 404,
  "title": "Phone number unknown"
}

Responses

Status Meaning Description Schema
200 OK Returned templates available for the phone number WhatsAppTemplates
404 Not Found The phone number does not exist. Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Response Headers

Status Header Type Format Description
200 x-total-pages integer How many pages are available
200 x-total-items integer How many items are available in total
200 x-page-size integer Maximum number of items per page
200 x-current-page integer The current page
200 Link undefined Links describing pagination

Profile management

Profile management allows you to read and update profile settings of your WhatsApp phone numbers.

Read the profile

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /channels/whatsapp/phone-numbers/{phone-number}/settings/profile

Returns profile settings of a WhatsApp phone number

Parameters

Name In Type Required Description
phone-number path integer true Phone number used for WhatsApp messaging.

Example responses

200 Response

{
  "address": "Hofmannstrasse 25 - 27, 81379 Munich, Germany",
  "description": "tyntec WhatsApp Business API Demo",
  "email": "support@tyntec.com",
  "websites": [
    "https://www.tyntec.com",
    "https://api.tyntec.com/reference"
  ],
  "vertical": "Professional Services",
  "about": "Hey there! I am using WhatsApp."
}

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

404 Response

{
  "status": 404,
  "title": "Phone number unknown"
}

Responses

Status Meaning Description Schema
200 OK Returned the current profile settings WhatsAppProfile
403 Forbidden You attempting to use a number that is not assigned to your account Problem
404 Not Found The phone number does not exist. Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Update the profile

Code samples

# You can also use wget
curl -X PATCH https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/problem+json' \
  -H 'apikey: API_KEY'

PATCH https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/problem+json

const inputBody = '{
  "address": "Hofmannstrasse 25 - 27, 81379 Munich, Germany",
  "description": "tyntec WhatsApp Business API Demo",
  "email": "support@tyntec.com",
  "websites": [
    "https://www.tyntec.com",
    "https://api.tyntec.com/reference"
  ],
  "vertical": "Professional Services",
  "about": "Hey there! I am using WhatsApp."
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/problem+json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile',
{
  method: 'PATCH',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/problem+json',
  'apikey' => 'API_KEY'
}

result = RestClient.patch 'https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/problem+json',
  'apikey': 'API_KEY'
}

r = requests.patch('https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/problem+json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PATCH','https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
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{"application/problem+json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PATCH", "https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/profile", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PATCH /channels/whatsapp/phone-numbers/{phone-number}/settings/profile

Updates the WhatsApp client profile.

Supports also selective updates.

To remove a particular field, set its value to an empty string.

Body parameter

{
  "address": "Hofmannstrasse 25 - 27, 81379 Munich, Germany",
  "description": "tyntec WhatsApp Business API Demo",
  "email": "support@tyntec.com",
  "websites": [
    "https://www.tyntec.com",
    "https://api.tyntec.com/reference"
  ],
  "vertical": "Professional Services",
  "about": "Hey there! I am using WhatsApp."
}

Parameters

Name In Type Required Description
body body WhatsAppProfile true Information in order to create the group
phone-number path integer true Phone number used for WhatsApp messaging.

Example responses

400 Response

{
  "status": 400,
  "title": "Profile update failed.",
  "code": 1009
}

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

404 Response

{
  "status": 404,
  "title": "Phone number unknown"
}

default Response

{
  "type": "https://docs.tyntec.com/problems/DataNotParseable",
  "title": "Data given was not parseable",
  "status": 400,
  "detail": "Unexpected end-of-input: expected close marker for Object (start marker at [Source: UNKNOWN; line: -1, column: -1) at [Source: UNKNOWN; line: 1, column: 97]\n"
}

Responses

Status Meaning Description Schema
204 No Content Profile updated None
400 Bad Request Profile update failed. In the case a partial update failed: retrieve the current profile, change the required information and retry with the whole profile. Inline
403 Forbidden You attempting to use a number that is not assigned to your account Problem
404 Not Found The phone number does not exist. Problem
default Default Default response in case of any other error. Please check the error object for details Problem
Response Schema

Status Code 400

Name Type Required Restrictions Description
» code string false none error code

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo \
  -H 'Accept: image/png' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo HTTP/1.1
Host: api.tyntec.com
Accept: image/png


const headers = {
  'Accept':'image/png',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'image/png',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'image/png',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'image/png',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"image/png"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /channels/whatsapp/phone-numbers/{phone-number}/settings/logo

Returns the current logo assigned to a WhatsApp phone number profile.

Parameters

Name In Type Required Description
phone-number path integer true Phone number used for WhatsApp messaging.
format query string false The format in which the icon should be returned
Enumerated values
Parameter Value
format link
format binary

Example responses

200 Response

{
  "link": "https://pps.whatsapp.net/v/123123"
}

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

404 Response

{
  "status": 404,
  "title": "Phone number unknown"
}

Responses

Status Meaning Description Schema
200 OK Returned the current logo WhatsAppProfileLogoLink
403 Forbidden You attempting to use a number that is not assigned to your account Problem
404 Not Found The phone number does not exist. Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Code samples

# You can also use wget
curl -X PUT https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo \
  -H 'Content-Type: image/png' \
  -H 'Accept: application/problem+json' \
  -H 'apikey: API_KEY'

PUT https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo HTTP/1.1
Host: api.tyntec.com
Content-Type: image/png
Accept: application/problem+json

const inputBody = 'string';
const headers = {
  'Content-Type':'image/png',
  'Accept':'application/problem+json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'image/png',
  'Accept' => 'application/problem+json',
  'apikey' => 'API_KEY'
}

result = RestClient.put 'https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'image/png',
  'Accept': 'application/problem+json',
  'apikey': 'API_KEY'
}

r = requests.put('https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'image/png',
    'Accept' => 'application/problem+json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PUT','https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo', 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("https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
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{"image/png"},
        "Accept": []string{"application/problem+json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PUT", "https://api.tyntec.com/conversations/v3/channels/whatsapp/phone-numbers/{phone-number}/settings/logo", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PUT /channels/whatsapp/phone-numbers/{phone-number}/settings/logo

Updates the logo assigned to a WhatsApp phone number profile.

The logo must have a minimal edge size of 500 pixels and must not exceed 5 MB in size.

The recommended size is 640x640 pixels.

Body parameter

Parameters

Name In Type Required Description
body body string(binary) true Image that should be used as the profile logo
phone-number path integer true Phone number used for WhatsApp messaging.
format query string false The format in which the icon should be returned
Enumerated values
Parameter Value
format link
format binary

Example responses

400 Response

{
  "status": 400,
  "violations": [
    {
      "field": "validate.request.whatsapp.contentType",
      "message": "must not be empty"
    }
  ],
  "title": "Constraint Violation"
}

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

404 Response

{
  "status": 404,
  "title": "Phone number unknown"
}

default Response

{
  "type": "https://docs.tyntec.com/problems/DataNotParseable",
  "title": "Data given was not parseable",
  "status": 400,
  "detail": "Unexpected end-of-input: expected close marker for Object (start marker at [Source: UNKNOWN; line: -1, column: -1) at [Source: UNKNOWN; line: 1, column: 97]\n"
}

Responses

Status Meaning Description Schema
204 No Content Updated the logo successfully None
400 Bad Request The request does not match our expectations. Please check the Problems object for details Problem
403 Forbidden You attempting to use a number that is not assigned to your account Problem
404 Not Found The phone number does not exist. Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Phone Number Configurations

List all phone numbers configured as Inbound (aka 2-way) Phone Numbers.

List Configurations

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp', 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("https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /configurations/channels/whatsapp

List all WhatsApp channels available to your API account

Example responses

200 Response

[
  {
    "channel": "whatsapp",
    "scopes": [
      "messages:read",
      "profile:read",
      "callbacks:write",
      "callbacks:read"
    ],
    "id": {
      "phoneNumber": 12341234
    },
    "callback": {
      "callbackVersion": 2.11,
      "inboundMessageUrl": "https://your.server.com/inbound",
      "messageStatusUrl": "https://your.server.com/status",
      "eventFilter": [
        "MessageStatus::accepted",
        "MessageStatus::delivered"
      ]
    }
  }
]

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

Responses

Status Meaning Description Schema
200 OK A list of WhatsApp phone number configurations WhatsAppChannelResponses
403 Forbidden You attempting to use a number that is not assigned to your account Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Read one configuration

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number} \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

GET https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number} HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number}', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number}', 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("https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /configurations/channels/whatsapp/phone-numbers/{phone-number}

Returns the specific configuration

Parameters

Name In Type Required Description
phone-number path integer true Phone number used for WhatsApp messaging.

Example responses

200 Response

{
  "channel": "whatsapp",
  "scopes": [
    "messages:read",
    "profile:read",
    "callbacks:write",
    "callbacks:read"
  ],
  "id": {
    "phoneNumber": 12341234
  },
  "callback": {
    "callbackVersion": 2.11,
    "inboundMessageUrl": "https://your.server.com/inbound",
    "messageStatusUrl": "https://your.server.com/status",
    "eventFilter": [
      "MessageStatus::accepted",
      "MessageStatus::delivered"
    ]
  }
}

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

Responses

Status Meaning Description Schema
200 OK WhatsApp phone number configuration WhatsAppChannelResponse
403 Forbidden You attempting to use a number that is not assigned to your account Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Callback configuration

In this section, we guide you on how to configure the callbacks on a per channel bases.

Update the callback

Code samples

# You can also use wget
curl -X PUT https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number}/callbacks \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apikey: API_KEY'

PUT https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number}/callbacks HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "callbackVersion": 2.11,
  "inboundMessageUrl": "string",
  "messageStatusUrl": "string",
  "eventFilter": []
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apikey':'API_KEY'

};

fetch('https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number}/callbacks',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apikey' => 'API_KEY'
}

result = RestClient.put 'https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number}/callbacks',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apikey': 'API_KEY'
}

r = requests.put('https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number}/callbacks', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apikey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PUT','https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number}/callbacks', 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("https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number}/callbacks");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
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{"application/json"},
        "apikey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PUT", "https://api.tyntec.com/conversations/v3/configurations/channels/whatsapp/phone-numbers/{phone-number}/callbacks", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PUT /configurations/channels/whatsapp/phone-numbers/{phone-number}/callbacks

Update the callback settings of a specific whatsapp channel.

Body parameter

{
  "callbackVersion": 2.11,
  "inboundMessageUrl": "string",
  "messageStatusUrl": "string",
  "eventFilter": []
}

Parameters

Name In Type Required Description
body body ChannelCallback false none
phone-number path integer true Phone number used for WhatsApp messaging.

Example responses

200 Response

{
  "channel": "whatsapp",
  "scopes": [
    "messages:read",
    "profile:read",
    "callbacks:write",
    "callbacks:read"
  ],
  "id": {
    "phoneNumber": 12341234
  },
  "callback": {
    "callbackVersion": 2.11,
    "inboundMessageUrl": "https://your.server.com/inbound",
    "messageStatusUrl": "https://your.server.com/status",
    "eventFilter": [
      "MessageStatus::accepted",
      "MessageStatus::delivered"
    ]
  }
}

400 Response

{
  "status": 400,
  "violations": [
    {
      "field": "validate.request.whatsapp.contentType",
      "message": "must not be empty"
    }
  ],
  "title": "Constraint Violation"
}

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

Responses

Status Meaning Description Schema
200 OK WhatsApp phone number configuration WhatsAppChannelResponse
400 Bad Request The request does not match our expectations. Please check the Problems object for details Problem
403 Forbidden You attempting to use a number that is not assigned to your account Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Schemas

Problem

{
  "type": "https://docs.tyntec.com/problems/DataNotParseable",
  "title": "Data given was not parseable",
  "status": 400,
  "detail": "Unexpected end-of-input: expected close marker for Object (start marker at [Source: UNKNOWN; line: -1, column: -1) at [Source: UNKNOWN; line: 1, column: 97]\n"
}

The problem object follows the RFC-7807 (https://tools.ietf.org/html/rfc7807)

Properties

Name Type Required Restrictions Description
type string true none A URI reference [RFC3986] that identifies the problem type
title string true none A short, human-readable summary of the problem type.
status string true none The HTTP status code (RFC7231, Section 6) generated by the origin server for this occurrence of the problem.
detail string true none A human-readable explanation specific to this occurrence of the problem.

MessageResponse

{
  "messageId": "77185196-664a-43ec-b14a-fe97036c697f",
  "acceptedAt": "2019-08-24T14:15:22Z"
}

Properties

Name Type Required Restrictions Description
messageId string(uuid) true none Global unique Message Id reference
acceptedAt string(date-time) true none Point in time when the API confirms that the message request was accepted

BulkMessageResponse

{
  "bulkId": "string",
  "messageIds": [
    "string"
  ]
}

Properties

Name Type Required Restrictions Description
bulkId string false none none
messageIds [string] false none none

MessageRequest

{
  "to": "+123234234",
  "from": "545345345",
  "channel": "whatsapp",
  "whatsapp": {
    "contentType": "text",
    "text": "A simple text message"
  }
}

The message you would like to send

Properties

Name Type Required Restrictions Description
to string true none The receipient of the messages
The format depends on the specific channel
from string true none The sender of the messages. The format depends on the specific channel.
channel string true none Channel selected for delivery.
context string false none Context for this particular message
content any false none none

oneOf

Name Type Required Restrictions Description
» anonymous WhatsAppTextContent false none Plain text message

xor

Name Type Required Restrictions Description
» anonymous WhatsAppImageContent false none Image message

xor

Name Type Required Restrictions Description
» anonymous WhatsAppDocumentContent false none Document message

xor

Name Type Required Restrictions Description
» anonymous WhatsAppVideoContent false none Video message

xor

Name Type Required Restrictions Description
» anonymous WhatsAppAudioContent false none Audio message

xor

Name Type Required Restrictions Description
» anonymous WhatsAppStickerContent false none Sticker message

xor

Name Type Required Restrictions Description
» anonymous WhatsAppLocationContent false none Location message

xor

Name Type Required Restrictions Description
» anonymous WhatsAppContactsContent false none Message with contacts

xor

Name Type Required Restrictions Description
» anonymous WhatsAppTemplateContent false none Templated message

xor

Name Type Required Restrictions Description
» anonymous WhatsAppInteractiveContent false none Interactive message (buttons & lists)

BulkMessageRequest

{
  "to": "+1233423454",
  "from": "+1233423454",
  "channel": "WhatsApp",
  "messages": [
    {
      "contentType": "text",
      "text": "string",
      "renderUrlPreview": false
    },
    {
      "contentType": "text",
      "text": "string",
      "renderUrlPreview": false
    }
  ]
}

The bulk of messages you would like to send

Properties

Name Type Required Restrictions Description
to string true none The receipient of the messages
The format depends on the specific channel
from string true none The sender of the messages. The format depends on the specific channel.
channel string true none Channel selected for delivery.
messages [oneOf] true none none

oneOf

Name Type Required Restrictions Description
» anonymous WhatsAppTextContent false none Plain text message

xor

Name Type Required Restrictions Description
» anonymous WhatsAppImageContent false none Image message

xor

Name Type Required Restrictions Description
» anonymous WhatsAppDocumentContent false none Document message

xor

Name Type Required Restrictions Description
» anonymous WhatsAppVideoContent false none Video message

xor

Name Type Required Restrictions Description
» anonymous WhatsAppAudioContent false none Audio message

xor

Name Type Required Restrictions Description
» anonymous WhatsAppStickerContent false none Sticker message

xor

Name Type Required Restrictions Description
» anonymous WhatsAppLocationContent false none Location message

xor

Name Type Required Restrictions Description
» anonymous WhatsAppContactsContent false none Message with contacts

xor

Name Type Required Restrictions Description
» anonymous WhatsAppTemplateContent false none Templated message

WhatsAppTextContent

{
  "contentType": "text",
  "text": "string",
  "renderUrlPreview": false
}

Plain text message

Properties

Name Type Required Restrictions Description
contentType string true none Determines the type of the message. Always text.
text string true none Text to be sent
renderUrlPreview boolean false none In case a URL is present on the text should a preview tried to be rendered
Enumerated values
Property Value
contentType text

WhatsAppImageContent

{
  "contentType": "image",
  "image": {
    "caption": "string",
    "url": "string",
    "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
  }
}

Image message

Properties

Name Type Required Restrictions Description
contentType string true none Determines the type of the message. Always image.
image WhatsAppImage true none Image media specification
Enumerated values
Property Value
contentType image

WhatsAppDocumentContent

{
  "contentType": "document",
  "document": {
    "caption": "string",
    "filename": "string",
    "url": "string",
    "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
  }
}

Document message

Properties

Name Type Required Restrictions Description
contentType string true none Determines the type of the message. Always document.
document WhatsAppDocument true none Document media specification
Enumerated values
Property Value
contentType document

WhatsAppVideoContent

{
  "contentType": "video",
  "video": {
    "caption": "string",
    "url": "string",
    "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
  }
}

Video message

Properties

Name Type Required Restrictions Description
contentType string true none Determines the type of the message. Always video.
video WhatsAppVideo true none Video media specification
Enumerated values
Property Value
contentType video

WhatsAppAudioContent

{
  "contentType": "audio",
  "audio": {
    "url": "string",
    "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
  }
}

Audio message

Properties

Name Type Required Restrictions Description
contentType string true none Determines the type of the message. Always audio.
audio WhatsAppAudio true none Audio media specification
Enumerated values
Property Value
contentType audio

WhatsAppStickerContent

{
  "contentType": "sticker",
  "sticker": {
    "url": "string",
    "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
  }
}

Sticker message

Properties

Name Type Required Restrictions Description
contentType string true none Determines the type of the message. Always sticker.
sticker WhatsAppSticker true none Sticker media specification
Enumerated values
Property Value
contentType sticker

WhatsAppLocationContent

{
  "contentType": "location",
  "location": {
    "longitude": 7.4954884,
    "latitude": 51.5005765,
    "name": "tyntec GmbH",
    "address": "tyntec GmbH, Semerteichstraße, Dortmund"
  }
}

Location message

Properties

Name Type Required Restrictions Description
contentType string true none Determines the type of the message. Always location.
location WhatsAppLocation true none Location received or send
Enumerated values
Property Value
contentType location

WhatsAppContactsContent

{
  "contentType": "contacts",
  "contacts": [
    {
      "birthday": "2018-01-01",
      "addresses": [
        {
          "city": "Dortmund",
          "country": "Germany",
          "countryCode": "de",
          "state": "NRW",
          "street": "string",
          "type": "WORK",
          "zip": 44231
        }
      ],
      "emails": [
        {
          "email": "whatsapp@tyntec.com",
          "type": "WORK"
        }
      ],
      "ims": [
        {
          "service": "WhatsApp",
          "userId": 123123123
        }
      ],
      "name": {
        "prefix": "Mr.",
        "firstName": "Peter",
        "middleName": "Michael",
        "lastName": "Tyntec",
        "suffix": "senior",
        "formattedName": "Mr. Peter Michael Tyntec senior"
      },
      "org": {
        "company": "tyntec GmbH",
        "department": "Development",
        "title": "API Guardian"
      },
      "phones": [
        {
          "phone": "+49 231 477 90 813",
          "type": "WORK"
        }
      ],
      "urls": [
        {
          "url": "https://www.tyntec.com",
          "type": "WORK"
        }
      ]
    }
  ]
}

Message with contacts

Properties

Name Type Required Restrictions Description
contentType string true none Determines the type of the message. Always contacts.
contacts [Contact] true none [Contact object]
Enumerated values
Property Value
contentType contacts

WhatsAppTemplateContent

{
  "contentType": "template",
  "template": {
    "templateId": "string",
    "templateLanguage": "string",
    "components": {
      "header": [
        {
          "type": "text",
          "text": "string",
          "example": {
            "text": "John Doe"
          }
        }
      ],
      "body": [
        {
          "type": "text",
          "text": "string",
          "example": {
            "texts": [
              "John Doe",
              "Order ID 123"
            ]
          }
        }
      ],
      "button": [
        {
          "type": "quick_reply",
          "index": 0,
          "payload": "string"
        }
      ]
    }
  }
}

Templated message

Properties

Name Type Required Restrictions Description
contentType string true none Determines the type of the message. Always template.
template WhatsAppTemplate true none none
Enumerated values
Property Value
contentType template

WhatsAppInteractiveContent

{
  "contentType": "interactive",
  "interactive": {
    "type": "buttons",
    "components": {
      "header": {
        "type": "text",
        "text": "Your request is queued"
      },
      "body": {
        "type": "text",
        "text": "How would you rate your bot experience"
      },
      "footer": {
        "type": "text",
        "text": "Your service bot"
      },
      "buttons": [
        {
          "type": "reply",
          "reply": {
            "payload": "987298-40980jvkdm9-234234234",
            "title": "Poor"
          }
        },
        {
          "type": "reply",
          "reply": {
            "payload": "987298-dsfgjlkhgdf-dg09u834334",
            "title": "OK"
          }
        },
        {
          "type": "reply",
          "reply": {
            "payload": "9080923445nlkjß0_gß0923845083245dfg",
            "title": "Good"
          }
        }
      ]
    }
  }
}

Interactive message (buttons & lists)

Properties

Name Type Required Restrictions Description
contentType string true none Determines the type of the message. Always interactive.
interactive any true none none

oneOf

Name Type Required Restrictions Description
» anonymous WhatsAppInteractiveButtonMessage false none Interactive message type

xor

Name Type Required Restrictions Description
» anonymous WhatsAppInteractiveListMessage false none Interactive message type
Enumerated values
Property Value
contentType interactive

WhatsAppInteractiveFooterContent

{
  "contentType": "text",
  "text": "string"
}

Footer of an interactive message

Properties

Name Type Required Restrictions Description
contentType string true none Determines the type of the message. Always text.
text string true none Footer to be displayed on the message
Enumerated values
Property Value
contentType text

WhatsAppInteractiveTextContent

{
  "contentType": "text",
  "text": "string"
}

Message body of an interactive message

Properties

Name Type Required Restrictions Description
contentType string true none Determines the type of the message. Always text.
text string true none Text body of the message
Enumerated values
Property Value
contentType text

BaseMedia

{
  "url": "string",
  "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
}

Base object handling media definitions for sending.

One of both properties url or mediaId must be set

Properties

Name Type Required Restrictions Description
url string false none the url of the location where the media is stored
mediaId string(uuid) false none Media id of a previously uploaded media

WhatsAppImage

{
  "caption": "string",
  "url": "string",
  "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
}

Image media specification

Properties

Name Type Required Restrictions Description
caption string false none none

WhatsAppDocument

{
  "caption": "string",
  "filename": "string",
  "url": "string",
  "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
}

Document media specification

Properties

Name Type Required Restrictions Description
caption string false none none
filename string false none none

WhatsAppVideo

{
  "caption": "string",
  "url": "string",
  "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
}

Video media specification

Properties

Name Type Required Restrictions Description
caption string false none none

WhatsAppAudio

{
  "url": "string",
  "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
}

Audio media specification

Properties

None

WhatsAppSticker

{
  "url": "string",
  "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
}

Sticker media specification

Properties

None

WhatsAppLocation

{
  "longitude": 7.4954884,
  "latitude": 51.5005765,
  "name": "tyntec GmbH",
  "address": "tyntec GmbH, Semerteichstraße, Dortmund"
}

Location received or send

Properties

Name Type Required Restrictions Description
longitude number(double) true none Longitude part of the coordinate
latitude integer(double) true none Latitude part of the coordinate
name string false none Optional name
address string false none Optional address, will only be rendered if name is set

Contact

{
  "birthday": "2018-01-01",
  "addresses": [
    {
      "city": "Dortmund",
      "country": "Germany",
      "countryCode": "de",
      "state": "NRW",
      "street": "string",
      "type": "WORK",
      "zip": 44231
    }
  ],
  "emails": [
    {
      "email": "whatsapp@tyntec.com",
      "type": "WORK"
    }
  ],
  "ims": [
    {
      "service": "WhatsApp",
      "userId": 123123123
    }
  ],
  "name": {
    "prefix": "Mr.",
    "firstName": "Peter",
    "middleName": "Michael",
    "lastName": "Tyntec",
    "suffix": "senior",
    "formattedName": "Mr. Peter Michael Tyntec senior"
  },
  "org": {
    "company": "tyntec GmbH",
    "department": "Development",
    "title": "API Guardian"
  },
  "phones": [
    {
      "phone": "+49 231 477 90 813",
      "type": "WORK"
    }
  ],
  "urls": [
    {
      "url": "https://www.tyntec.com",
      "type": "WORK"
    }
  ]
}

Contact object

Properties

Name Type Required Restrictions Description
birthday string false none Birthday of the contact
addresses [Address] false none List of addresses assigned to the contact
emails [Email] false none List of emails assigned to the contact
ims [IMS] false none List of IMS accounts assigned to the contact
name Name false none The name of a contact. Apart from the property formattedName at least one of the other must be set
org Organisation false none Organisation associated with the contact
phones [ContactPhone] false none List of phone numbers assigned to the contact
urls [ContactUrl] false none List of urls assigned to the contact

Address

{
  "city": "Dortmund",
  "country": "Germany",
  "countryCode": "de",
  "state": "NRW",
  "street": "string",
  "type": "WORK",
  "zip": 44231
}

Address of a contact

Properties

Name Type Required Restrictions Description
city string false none City name
country string false none Full country name
countryCode string false none Two-letter code abbreviation
state string false none State abbreviation
street string false none Street name and number
type string false none Type of the address
zip string false none ZIP or postal code

Email

{
  "email": "whatsapp@tyntec.com",
  "type": "WORK"
}

Email of the contact

Properties

Name Type Required Restrictions Description
email string false none Email address
type string false none Type of the email

IMS

{
  "service": "WhatsApp",
  "userId": 123123123
}

IMS of the contact

Properties

Name Type Required Restrictions Description
service string false none Type of the email
userId string false none IMS user id

Name

{
  "prefix": "Mr.",
  "firstName": "Peter",
  "middleName": "Michael",
  "lastName": "Tyntec",
  "suffix": "senior",
  "formattedName": "Mr. Peter Michael Tyntec senior"
}

The name of a contact. Apart from the property formattedName at least one of the other must be set

Properties

Name Type Required Restrictions Description
prefix string false none Prefix of the contacts name
firstName string false none First name of the contact
middleName string false none Middle name of the contact
lastName string false none Last name of the contact
suffix string false none Suffix of the contacts name
formattedName string true none Completely formatted name

Organisation

{
  "company": "tyntec GmbH",
  "department": "Development",
  "title": "API Guardian"
}

Organisation associated with the contact

Properties

Name Type Required Restrictions Description
company string false none Name of the contact's company
department string false none Name of the contact's department
title string false none Contact's business title

ContactPhone

{
  "phone": "+49 231 477 90 813",
  "type": "WORK"
}

Phone entry of a contact

Properties

Name Type Required Restrictions Description
phone string false none Phone number
type string false none Type of phone number

ContactUrl

{
  "url": "https://www.tyntec.com",
  "type": "WORK"
}

URL of a contact

Properties

Name Type Required Restrictions Description
url string false none URL of a contact
type string false none Type of URL

WhatsAppTemplate

{
  "templateId": "string",
  "templateLanguage": "string",
  "components": {
    "header": [
      {
        "type": "text",
        "text": "string",
        "example": {
          "text": "John Doe"
        }
      }
    ],
    "body": [
      {
        "type": "text",
        "text": "string",
        "example": {
          "texts": [
            "John Doe",
            "Order ID 123"
          ]
        }
      }
    ],
    "button": [
      {
        "type": "quick_reply",
        "index": 0,
        "payload": "string"
      }
    ]
  }
}

Properties

Name Type Required Restrictions Description
templateId string true none none
templateLanguage string true none none
components WhatsAppTemplateComponents false none none

WhatsAppTemplateComponents

{
  "header": [
    {
      "type": "text",
      "text": "string",
      "example": {
        "text": "John Doe"
      }
    }
  ],
  "body": [
    {
      "type": "text",
      "text": "string",
      "example": {
        "texts": [
          "John Doe",
          "Order ID 123"
        ]
      }
    }
  ],
  "button": [
    {
      "type": "quick_reply",
      "index": 0,
      "payload": "string"
    }
  ]
}

Properties

Name Type Required Restrictions Description
header [oneOf] false none none

oneOf

Name Type Required Restrictions Description
» anonymous WhatsAppTemplateTextHeaderComponent false none none

xor

Name Type Required Restrictions Description
» anonymous WhatsAppTemplateImageHeaderComponent false none none

xor

Name Type Required Restrictions Description
» anonymous WhatsAppTemplateVideoHeaderComponent false none none

xor

Name Type Required Restrictions Description
» anonymous WhatsAppTemplateDocumentHeaderComponent false none none

xor

Name Type Required Restrictions Description
» anonymous WhatsAppTemplateLocationHeaderComponent false none none

continued

Name Type Required Restrictions Description
body [WhatsAppTemplateTextBodyComponent] false none [Body parameter replacement of a template]
button any false none none

oneOf

Name Type Required Restrictions Description
» anonymous WhatsAppQuickReplyButtons false none none

xor

Name Type Required Restrictions Description
» anonymous WhatsAppCallToActionButtons false none none

WhatsAppTemplateTextHeaderComponent

{
  "type": "text",
  "text": "string",
  "example": {
    "text": "John Doe"
  }
}

Properties

Name Type Required Restrictions Description
type string true none none
text string true none none
example WhatsAppTemplateTextHeaderComponentExample false none Example of the header text
Enumerated values
Property Value
type text

WhatsAppTemplateTextHeaderComponentExample

{
  "text": "John Doe"
}

Example of the header text

Properties

Name Type Required Restrictions Description
text string false none Example text

WhatsAppTemplateImageHeaderComponent

{
  "type": "image",
  "image": {
    "url": "string",
    "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
  }
}

Properties

Name Type Required Restrictions Description
type string true none none
image WhatsAppTemplateMediaHeader true none Media header specification
Enumerated values
Property Value
type image

WhatsAppTemplateVideoHeaderComponent

{
  "type": "video",
  "video": {
    "url": "string",
    "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
  }
}

Properties

Name Type Required Restrictions Description
type string true none none
video WhatsAppTemplateMediaHeader true none Media header specification
Enumerated values
Property Value
type video

WhatsAppTemplateDocumentHeaderComponent

{
  "type": "document",
  "document": {
    "filename": "Test PDF",
    "url": "string",
    "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
  }
}

Properties

Name Type Required Restrictions Description
type string true none none
document WhatsAppTemplateDocumentHeader true none Document media specification
Enumerated values
Property Value
type document

WhatsAppTemplateLocationHeaderComponent

{
  "type": "document",
  "location": {
    "longitude": 7.4954884,
    "latitude": 51.5005765,
    "name": "tyntec GmbH",
    "address": "tyntec GmbH, Semerteichstraße, Dortmund"
  }
}

Properties

Name Type Required Restrictions Description
type string true none none
location WhatsAppLocation true none Location received or send
Enumerated values
Property Value
type document

WhatsAppTemplateMediaHeader

{
  "url": "string",
  "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
}

Media header specification

Properties

None

WhatsAppTemplateDocumentHeader

{
  "filename": "Test PDF",
  "url": "string",
  "mediaId": "5a8ffac5-2288-485d-b463-90c3cd9941ad"
}

Document media specification

Properties

Name Type Required Restrictions Description
filename string false none Additional info for the filename to be displayed.

WhatsAppTemplateTextBodyComponent

{
  "type": "text",
  "text": "string",
  "example": {
    "texts": [
      "John Doe",
      "Order ID 123"
    ]
  }
}

Body parameter replacement of a template

Properties

Name Type Required Restrictions Description
type string true none none
text string true none none
example WhatsAppTemplateTextBodyComponentExample false none Examples of the body parameters.
Enumerated values
Property Value
type text

WhatsAppTemplateTextBodyComponentExample

{
  "texts": [
    "John Doe",
    "Order ID 123"
  ]
}

Examples of the body parameters.

Properties

Name Type Required Restrictions Description
texts [string] false none Examples of the body parameters

WhatsAppQuickReplyButtons

[
  {
    "type": "quick_reply",
    "index": 0,
    "payload": "string"
  }
]

Properties

Name Type Required Restrictions Description
anonymous [QuickReplyButtonComponent] false none [This type can be used up to three times]

WhatsAppCallToActionButtons

[
  {
    "type": "url",
    "index": 0,
    "text": "string"
  }
]

Properties

Name Type Required Restrictions Description
anonymous [UrlButtonComponent] false none [This type can be used up to one time]

QuickReplyButtonComponent

{
  "type": "quick_reply",
  "index": 0,
  "payload": "string"
}

This type can be used up to three times

Properties

Name Type Required Restrictions Description
type string true none Determines the type of the button. Always quick_reply.
index number true none Determines the index of the button that should be enhanced with the payload.
payload string true none Payload for this quick reply button. Sent back on the MoMessage::PostBack event
Enumerated values
Property Value
type quick_reply

UrlButtonComponent

{
  "type": "url",
  "index": 0,
  "text": "string"
}

This type can be used up to one time

Properties

Name Type Required Restrictions Description
type string true none Determines the type of the buttpon. Always url.
index number true none Determines the index of the button that should be enhanced with a custom parameter
text string true none Which text should be append to a dynamic URL. Note the requested templates url button must end with {{1}}.
Enumerated values
Property Value
type url

WhatsAppInteractiveButtonMessage

{
  "type": "buttons",
  "components": {
    "header": {
      "type": "text",
      "text": "Your request is queued"
    },
    "body": {
      "type": "text",
      "text": "How would you rate your bot experience"
    },
    "footer": {
      "type": "text",
      "text": "Your service bot"
    },
    "buttons": [
      {
        "type": "reply",
        "reply": {
          "payload": "987298-40980jvkdm9-234234234",
          "title": "Poor"
        }
      },
      {
        "type": "reply",
        "reply": {
          "payload": "987298-dsfgjlkhgdf-dg09u834334",
          "title": "OK"
        }
      },
      {
        "type": "reply",
        "reply": {
          "payload": "9080923445nlkjß0_gß0923845083245dfg",
          "title": "Good"
        }
      }
    ]
  }
}

Interactive message type

Properties

Name Type Required Restrictions Description
type string true none none
components WhatsAppInteractiveButtonComponents true none none
Enumerated values
Property Value
type buttons

WhatsAppInteractiveListMessage

{
  "type": "list",
  "components": {
    "header": {
      "type": "text",
      "text": "Choose your menu"
    },
    "body": {
      "type": "text",
      "text": "Hi Sarah, select your menu from the bottom list. Dressings and toppings are selected later on"
    },
    "footer": {
      "type": "text",
      "text": "Your tyntec food team"
    },
    "list": {
      "title": "Your menu",
      "sections": [
        {
          "title": "Vegan",
          "rows": [
            {
              "title": "Green dream",
              "payload": "green-dream-34987-234897234-234",
              "description": "A bowl full of tasty leaves, soy beans and cucumber"
            },
            {
              "title": "Rainbow meets rice",
              "payload": "rainbow-meets-rice-34987-234897234-234",
              "description": "A colorful selection of vegetables on a cozy bed of basmati rice"
            }
          ]
        },
        {
          "title": "Vegetarian",
          "rows": [
            {
              "title": "Italo Classic",
              "payload": "italo-classic-34987-234897234-234",
              "description": "Slices of tomates, with plucked pieces of mozzarella and basil leaves"
            },
            {
              "title": "Egg & Peas",
              "payload": "egg-and-peas-34987-234897234-234",
              "description": "Tasty slices of eggs, on a whole wheat pasta salad with peas"
            }
          ]
        }
      ]
    }
  }
}

Interactive message type

Properties

Name Type Required Restrictions Description
type string true none none
components WhatsAppInteractiveListComponents true none List message component. It can have at most 10 rows distributed over at most 10 sections
Enumerated values
Property Value
type list

WhatsAppInteractiveButtonComponents

{
  "header": {
    "type": "text",
    "text": "string",
    "example": {
      "text": "John Doe"
    }
  },
  "body": {
    "contentType": "text",
    "text": "string"
  },
  "footer": {
    "contentType": "text",
    "text": "string"
  },
  "buttons": [
    {
      "type": "reply",
      "reply": {
        "payload": "string",
        "title": "string"
      }
    }
  ]
}

Properties

Name Type Required Restrictions Description
header any false none none

oneOf

Name Type Required Restrictions Description
» anonymous WhatsAppTemplateTextHeaderComponent false none none

xor

Name Type Required Restrictions Description
» anonymous WhatsAppTemplateImageHeaderComponent false none none

xor

Name Type Required Restrictions Description
» anonymous WhatsAppTemplateVideoHeaderComponent false none none

xor

Name Type Required Restrictions Description
» anonymous WhatsAppTemplateDocumentHeaderComponent false none none

continued

Name Type Required Restrictions Description
body WhatsAppInteractiveTextContent true none Message body of an interactive message
footer WhatsAppInteractiveFooterContent false none Footer of an interactive message
buttons [WhatsAppInteractiveButton] true none [Interactive message button]

WhatsAppInteractiveButton

{
  "type": "reply",
  "reply": {
    "payload": "string",
    "title": "string"
  }
}

Interactive message button

Properties

Name Type Required Restrictions Description
type string true none Type of the button. Always "reply"
reply object true none Reply button specification
» payload string true none ID of the reply button. Must be unique within the same messaging request
» title string true none Caption or title of the button
Enumerated values
Property Value
type reply

WhatsAppInteractiveListComponents

{
  "header": {
    "type": "text",
    "text": "string",
    "example": {
      "text": "John Doe"
    }
  },
  "body": {
    "contentType": "text",
    "text": "string"
  },
  "footer": {
    "contentType": "text",
    "text": "string"
  },
  "list": {
    "title": "Choose from this list",
    "sections": [
      {
        "title": "string",
        "rows": [
          {
            "payload": "string",
            "title": "string",
            "description": "string"
          }
        ]
      }
    ]
  }
}

List message component. It can have at most 10 rows distributed over at most 10 sections

Properties

Name Type Required Restrictions Description
header WhatsAppTemplateTextHeaderComponent false none none
body WhatsAppInteractiveTextContent true none Message body of an interactive message
footer WhatsAppInteractiveFooterContent false none Footer of an interactive message
list WhatsAppInteractiveListContent true none Definition of a WhatsApp interactive list

WhatsAppInteractiveListContent

{
  "title": "Choose from this list",
  "sections": [
    {
      "title": "string",
      "rows": [
        {
          "payload": "string",
          "title": "string",
          "description": "string"
        }
      ]
    }
  ]
}

Definition of a WhatsApp interactive list

Properties

Name Type Required Restrictions Description
title string true none none
sections [WhatsAppListSection] true none Sections of the list message

WhatsAppListSection

{
  "title": "string",
  "rows": [
    {
      "payload": "string",
      "title": "string",
      "description": "string"
    }
  ]
}

Section of a list message.

Properties

Name Type Required Restrictions Description
title string false none Title of the section mandatory in case of multiple sections
rows [WhatsAppListSectionRow] true none Items of the section

WhatsAppListSectionRow

{
  "payload": "string",
  "title": "string",
  "description": "string"
}

Row item of a list message

Properties

Name Type Required Restrictions Description
payload string true none ID of the item, must be unique within the request
title string true none Caption of the item in the list
description string false none Optional description of the item

WhatsAppProfile

{
  "address": "Hofmannstrasse 25 - 27, 81379 Munich, Germany",
  "description": "tyntec WhatsApp Business API Demo",
  "email": "support@tyntec.com",
  "websites": [
    "https://www.tyntec.com",
    "https://api.tyntec.com/reference"
  ],
  "vertical": "Professional Services",
  "about": "Hey there! I am using WhatsApp."
}

The current profile of a WhatsApp number.

Properties

Name Type Required Restrictions Description
address string false none Address of the business
description string false none Brief introduction of the business
email string false none Contact mail address
websites [string] false none Websites of the business
vertical string false none Industry of the business
about string false none Text to display in the About section of your profile
Enumerated values
Property Value
vertical Automotive
vertical Beauty, Spa and Salon
vertical Clothing and Apparel
vertical Education
vertical Entertainment
vertical Event Planning and Service
vertical Finance and Banking
vertical Food and Grocery
vertical Public Service
vertical Hotel and Lodging
vertical Medical and Health
vertical Non-profit
vertical Professional Services
vertical Shopping and Retail
vertical Travel and Transportation
vertical Restaurant
vertical Other

WhatsAppMessageStatusUpdate

{
  "status": "read"
}

Change in the message status of a previously sent WhatsApp message

Properties

Name Type Required Restrictions Description
status string false none WhatsApp message status
Enumerated values
Property Value
status read
{
  "link": "https://pps.whatsapp.net/v/123123"
}

Link to the profile logo

Properties

Name Type Required Restrictions Description
link string true none Link to the profile logo

WhatsAppAccounts

[
  {
    "whatsAppAccountId": "5637b8a7-51e1-47be-ad0b-b242453dcc1b",
    "whatsAppAccountName": "Swagger Sample Account",
    "businessName": "Swagger Sample business",
    "templateNamespace": "c9468969-a3a3-4c17-95f7-1e8b2902ed74",
    "facebookBusinessManagerId": 1791147717848878,
    "accountStatus": {
      "messageOnBehalf": "PENDING"
    },
    "managedBy": {
      "accountName": "tynteccpaas"
    }
  }
]

List of WhatsApp Business Accounts. Might be empty

Properties

Name Type Required Restrictions Description
anonymous [WhatsAppAccount] false none List of WhatsApp Business Accounts. Might be empty

WhatsAppAccount

{
  "whatsAppAccountId": "5637b8a7-51e1-47be-ad0b-b242453dcc1b",
  "whatsAppAccountName": "Swagger Sample Account",
  "businessName": "Swagger Sample business",
  "templateNamespace": "c9468969-a3a3-4c17-95f7-1e8b2902ed74",
  "facebookBusinessManagerId": 1791147717848878,
  "accountStatus": {
    "messageOnBehalf": "PENDING"
  },
  "managedBy": {
    "accountName": "tynteccpaas"
  }
}

A WhatsApp Business Account

Properties

Name Type Required Restrictions Description
whatsAppAccountId string(uuid) true none ID of the WhatsApp Business Account
whatsAppAccountName string false none Name of the WhatsApp Business Account
businessName string false none Name of the business owning the Facebook Business Manager
templateNamespace string false none Template namespace assigned to the WhatsApp Business Account.

This is used internally and here stated for completeness.
facebookBusinessManagerId string false none The Facebook Business Manager ID provided by Facebook
whatsAppBusinessAccountId string false none The WhatsApp Business Account ID provided by WhatsApp
accountStatus WhatsAppAccountStatus false none Status information for the WhatsApp account
managedBy CPaaSAccount false none Account that can manage (edit, ...) an entity

WhatsAppPhoneNumbers

[
  {
    "phoneNumber": 4912345678,
    "displayPhonenumber": "+49 123 45678",
    "verifiedName": "Swagger Sample",
    "qualityRating": "YELLOW",
    "status": "FLAGGED",
    "whatsAppAccountId": "5637b8a7-51e1-47be-ad0b-b242453dcc1b",
    "managedBy": {
      "accountName": "tyntecscpaas"
    },
    "messagingVia": {
      "accountName": "messagingcpaas"
    }
  }
]

List of phone numbers at WhatsApp. Might be empty

Properties

Name Type Required Restrictions Description
anonymous [WhatsAppPhoneNumber] false none List of phone numbers at WhatsApp. Might be empty

WhatsAppPhoneNumber

{
  "phoneNumber": 4912345678,
  "displayPhonenumber": "+49 123 45678",
  "verifiedName": "Swagger Sample",
  "qualityRating": "YELLOW",
  "status": "FLAGGED",
  "whatsAppAccountId": "5637b8a7-51e1-47be-ad0b-b242453dcc1b",
  "managedBy": {
    "accountName": "tyntecscpaas"
  },
  "messagingVia": {
    "accountName": "messagingcpaas"
  }
}

A phone number assigned to a WhatsApp Business Account

Properties

Name Type Required Restrictions Description
phoneNumber string false none The phone number
displayPhoneNumber string false none The phone number as it is displayed in the app
verifiedName string false none The name shown aside to the number.

This name will be shown immediately for Official Business Accounts.
qualityRating string false none The current quality rating of the phone number.

A RED rating will lead to the flagged status if the number keeps receiving
negative feedback from users.
status string false none Status of the number
whatsAppAccountId string(uuid) false none ID of the WhatsApp Business Account the number belongs to.
managedBy CPaaSAccount false none Account that can manage (edit, ...) an entity
messagingVia CPaaSAccount false none Account that must be used for messaging
messagingTier string false none Which messaging tier the number is currently on
qualityScore QualityScore false none The quality score provided by WhatsApp and calculated from user feedback on your messages
Enumerated values
Property Value
qualityRating GREEN
qualityRating RED
qualityRating YELLOW
status CONNECTED
status PENDING
status FLAGGED
status RESTRICTED
status OFFLINE
messagingTier TIER_NOT_SET
messagingTier TIER_1K
messagingTier TIER_10K
messagingTier TIER_100K

CPaaSAccount

{
  "name": "someaccount"
}

The CPaaS account behind the API key

Properties

Name Type Required Restrictions Description
accountName string false none Name of the CPaaSAccount

WhatsAppTemplateRequest

{
  "name": "string",
  "category": "ACCOUNT_UPDATE",
  "localizations": [
    {
      "language": "en",
      "components": [
        {
          "type": "BODY",
          "text": "string"
        }
      ]
    }
  ]
}

Request for an additional WhatsApp template

Properties

Name Type Required Restrictions Description
name string true none Name of the template
category TemplateCategory true none Category of the template
localizations [LocalizationRequest] true none Localizations of the template

LocalizationRequest

{
  "language": "en",
  "components": [
    {
      "type": "BODY",
      "text": "string"
    }
  ]
}

Request for a new localization of a template

Properties

Name Type Required Restrictions Description
language LanguageCode true none Supported language codes, according to Supported Languages
components any true none Components defining the template

oneOf

Name Type Required Restrictions Description
» anonymous NotificationTemplateRequest false none Request for a standard template (notification) without rich media components

xor

Name Type Required Restrictions Description
» anonymous RichMediaTemplateRequest false none Rich media template definition. Must contain at least the body component

NotificationTemplateRequest

[
  {
    "type": "BODY",
    "text": "string"
  }
]

Request for a standard template (notification) without rich media components

Properties

Name Type Required Restrictions Description
type string true none Template component type. Always BODY
text string true none Template text (1--1024 chars)
Enumerated values
Property Value
type BODY

RichMediaTemplateRequest

[
  {
    "type": "HEADER",
    "format": "TEXT",
    "text": "Hi {{1}}",
    "example": {
      "text": "John Doe"
    }
  }
]

Rich media template definition. Must contain at least the body component

Properties

anyOf

Name Type Required Restrictions Description
anonymous WhatsAppTemplateHeaderComponentRequest false none Header component of a template

or

Name Type Required Restrictions Description
anonymous WhatsAppTemplateBodyComponentRequest false none Body component of a template

or

Name Type Required Restrictions Description
anonymous WhatsAppTemplateFooterComponentRequest false none Footer component of a template

or

Name Type Required Restrictions Description
anonymous WhatsAppTemplateButtonComponentRequest false none Button component of a template

WhatsAppTemplateHeaderComponentRequest

{
  "type": "HEADER",
  "format": "TEXT",
  "text": "Hi {{1}}",
  "example": {
    "text": "John Doe"
  }
}

Header component of a template

Properties

oneOf

Name Type Required Restrictions Description
anonymous WhatsAppTemplateTextHeaderComponentRequest false none Text header component of a template

xor

Name Type Required Restrictions Description
anonymous WhatsAppTemplateMediaHeaderComponentRequest false none Media header component of a template

xor

Name Type Required Restrictions Description
anonymous WhatsAppTemplateLocationHeaderComponentRequest false none Location header component of a template

WhatsAppTemplateTextHeaderComponentRequest

{
  "type": "HEADER",
  "format": "TEXT",
  "text": "Hi {{1}}",
  "example": {
    "text": "John Doe"
  }
}

Text header component of a template

Properties

Name Type Required Restrictions Description
type string true none Determines the type of the component. Always HEADER
format string true none Which kind of header
text string true none Text that should be displayed as header. Can contain 1 variable
example WhatsAppTemplateTextHeaderComponentRequestExample false none Example of the header text
Enumerated values
Property Value
type HEADER
format TEXT

WhatsAppTemplateTextHeaderComponentRequestExample

{
  "text": "John Doe"
}

Example of the header text

Properties

Name Type Required Restrictions Description
text string false none Example text

WhatsAppTemplateLocationHeaderComponentRequest

{
  "type": "HEADER",
  "format": "LOCATION"
}

Location header component of a template

Properties

Name Type Required Restrictions Description
type string true none Determines the type of the component. Always HEADER
format string true none Which kind of header
Enumerated values
Property Value
type HEADER
format LOCATION

WhatsAppTemplateMediaHeaderComponentRequest

{
  "type": "HEADER",
  "format": "IMAGE",
  "example": {
    "url": "https://www.my.com/image.jpg"
  }
}

Media header component of a template

Properties

Name Type Required Restrictions Description
type string true none Determines the type of the component. Always HEADER
format string true none Which kind of header
example WhatsAppTemplateMediaHeaderComponentRequestExample false none Example of a media
Enumerated values
Property Value
type HEADER
format IMAGE
format DOCUMENT
format VIDEO

WhatsAppTemplateMediaHeaderComponentRequestExample

{
  "url": "https://www.my.com/image.jpg"
}

Example of a media

Properties

Name Type Required Restrictions Description
url string false none URL of the example media file

WhatsAppTemplateBodyComponentRequest

{
  "type": "BODY",
  "text": "Hi {{1}}, your order {{2}} is shipped",
  "example": {
    "texts": [
      "John Doe",
      123
    ]
  }
}

Body component of a template

Properties

Name Type Required Restrictions Description
type string true none Determines the type of the component. Always BODY
text string true none Specification of the body text (1--1024 chars)
example WhatsAppTemplateBodyComponentRequestExample false none Examples of the body parameters. All parameters of the body must have an example
Enumerated values
Property Value
type BODY

WhatsAppTemplateBodyComponentRequestExample

{
  "texts": [
    "John Doe",
    "Order ID 123"
  ]
}

Examples of the body parameters. All parameters of the body must have an example

Properties

Name Type Required Restrictions Description
texts [string] true none Examples of the body parameters

WhatsAppTemplateFooterComponentRequest

{
  "type": "FOOTER",
  "text": "The specification team"
}

Footer component of a template

Properties

Name Type Required Restrictions Description
type string true none Determines the type of the component
text string true none Specification of the footer text (1--60 chars)
Enumerated values
Property Value
type FOOTER

WhatsAppTemplateButtonComponentRequest

{
  "type": "BUTTONS",
  "buttons": [
    {
      "type": "QUICK_REPLY",
      "text": "I liked it!"
    }
  ]
}

Button component of a template

Properties

Name Type Required Restrictions Description
type string true none Determines the type of the component
buttons any true none none

oneOf

Name Type Required Restrictions Description
» anonymous WhatsAppQuickReplyButtonsRequest false none Quick Reply buttons

xor

Name Type Required Restrictions Description
» anonymous WhatsAppCallToActionButtonsRequest false none Call to action buttons. At most one of each button type can be used.
Enumerated values
Property Value
type BUTTONS

WhatsAppQuickReplyButtonsRequest

[
  {
    "type": "QUICK_REPLY",
    "text": "I liked it!"
  }
]

Quick Reply buttons

Properties

Name Type Required Restrictions Description
anonymous [WhatsAppQuickReplyButton] false none Quick Reply buttons

WhatsAppQuickReplyButton

{
  "type": "QUICK_REPLY",
  "text": "I liked it!"
}

Quick reply button, when clicked the caption and the dynamic payload is returned.

Properties

Name Type Required Restrictions Description
type string true none Type of this button
text string true none Caption of the button
Enumerated values
Property Value
type QUICK_REPLY

WhatsAppCallToActionButtonsRequest

[
  {
    "type": "URL",
    "text": "Your invoice",
    "url": "https://www.myservice.com/invoices/{{1}}",
    "example": {
      "url": "https://www.myservice.com/invoices/9424a5c5-9089-4142-9cd2-0365383ce387.pdf"
    }
  }
]

Call to action buttons. At most one of each button type can be used.

Properties

anyOf

Name Type Required Restrictions Description
anonymous WhatsAppURLButton false none Call to action button that opens the specified URL when clicked

or

Name Type Required Restrictions Description
anonymous WhatsAppPhoneNumberButton false none Call to action button that initiates a call when clicked

WhatsAppURLButton

{
  "type": "URL",
  "text": "Your invoice",
  "url": "https://www.myservice.com/invoices/{{1}}",
  "example": {
    "url": "https://www.myservice.com/invoices/9424a5c5-9089-4142-9cd2-0365383ce387.pdf"
  }
}

Call to action button that opens the specified URL when clicked

Properties

Name Type Required Restrictions Description
type string true none Type of this button
text string true none Caption of the button
url string false none the URL that will be openend when clicking on the button. Can contain 1 parameter at the end.
example WhatsAppURLButtonExample false none Example for a dynamic URL button.
Enumerated values
Property Value
type URL

WhatsAppURLButtonExample

{
  "url": "https://www.myservice.com/invoices/9424a5c5-9089-4142-9cd2-0365383ce387.pdf"
}

Example for a dynamic URL button.

Properties

Name Type Required Restrictions Description
url string false none Example for a dynamic URL button. Must start with the same base url as the url button

WhatsAppPhoneNumberButton

{
  "type": "PHONE_NUMBER",
  "text": "Call us",
  "phoneNumber": "+4923147790813"
}

Call to action button that initiates a call when clicked

Properties

Name Type Required Restrictions Description
type string true none Type of this button
text string true none Caption of this button
phoneNumber string false none Phone number that will be called when clicking on the button.
Enumerated values
Property Value
type PHONE_NUMBER

WhatsAppTemplates

[
  {
    "whatsAppAccountId": "5637b8a7-51e1-47be-ad0b-b242453dcc1b",
    "name": "swagger_test",
    "category": "TICKET_UPDATE",
    "localizations": [
      {
        "status": "REJECTED",
        "rejectionReason": "For this example",
        "language": "en",
        "components": [
          {
            "type": "BODY",
            "text": "Hello {{1}}! How is going?"
          },
          {
            "type": "FOOTER",
            "text": "Your specification team!"
          }
        ]
      }
    ]
  }
]

List of WhatsApp templates

Properties

Name Type Required Restrictions Description
anonymous [WhatsAppTemplateResponse] false none List of WhatsApp templates

WhatsAppTemplateResponse

{
  "whatsAppAccountId": "5637b8a7-51e1-47be-ad0b-b242453dcc1b",
  "name": "swagger_test",
  "category": "TICKET_UPDATE",
  "localizations": [
    {
      "status": "REJECTED",
      "rejectionReason": "For this example",
      "language": "en",
      "components": [
        {
          "type": "BODY",
          "text": "Hello {{1}}! How is going?"
        },
        {
          "type": "FOOTER",
          "text": "Your specification team!"
        }
      ]
    }
  ]
}

WhatsApp template

Properties

Name Type Required Restrictions Description
whatsAppAccountId string(uuid) false none ID of the WhatsApp Business Account the template belongs to.
templateName string false none Name of the template
templateId string false none ID of the template
category TemplateCategory false none Category of the template
localízations [LocalizationResponse] false none List of localizations of this templates

LocalizationResponse

{
  "status": "DELETED",
  "rejectionReason": "not yet",
  "language": "en",
  "components": [
    {
      "type": "BODY",
      "text": "Hello {{1}}! How is going?"
    }
  ],
  "createdAt": "2020-02-15T23:28:34.442Z",
  "lastUpdated": "2020-02-15T25:28:34.442Z",
  "expiresAt": "2020-03-15T23:28:34.442Z",
  "qualityScore": {
    "score": "RED",
    "reasons": [
      "Users are choosing \"didn't sign up\" as a reason for blocking this phone number. Businesses must obtain opt-in before sending notifications. Please review your opt-in flow(s) and see our Business Policy for more detail."
    ]
  }
}

Localization of a template

Properties

Name Type Required Restrictions Description
status string true none Status the localization.
rejectionReason string false none Descriptive text in the case the status is REJECTED
language LanguageCode true none Supported language codes, according to Supported Languages
components [anyOf] true none Set of components defining a template

anyOf

Name Type Required Restrictions Description
» anonymous WhatsAppTemplateHeaderComponentResponse false none Header component of a template

or

Name Type Required Restrictions Description
» anonymous WhatsAppTemplateBodyComponentResponse false none Body component of a template

or

Name Type Required Restrictions Description
» anonymous WhatsAppTemplateFooterComponentResponse false none Footer component of a template

continued

Name Type Required Restrictions Description
createdAt string(date-time) true none At which point in time the template was created
lastUpdated string(date-time) true none At which point in time the last update happened
expiresAt string(date-time) false none When does the localization expire.
Only present when a template was deleted.
qualityScore QualityScore false none The quality score provided by WhatsApp and calculated from user feedback on your messages
Enumerated values
Property Value
status REQUESTED
status SUBMIT_FAILED
status PENDING
status APPROVED
status REJECTED
status DELETION_PENDING
status DELETED
status SUBMITTED

WhatsAppTemplateHeaderComponentResponse

{
  "type": "HEADER",
  "format": "IMAGE",
  "text": "Hi {{1}}!"
}

Header component of a template

Properties

Name Type Required Restrictions Description
type string true none Component type
format string true none Which kind of header
text string false none Text based part of format "TEXT
Enumerated values
Property Value
type HEADER
format IMAGE
format TEXT
format DOCUMENT
format VIDEO

WhatsAppTemplateBodyComponentResponse

{
  "type": "BODY",
  "text": "Hi {{1}}! Enjoy the spec!"
}

Body component of a template

Properties

Name Type Required Restrictions Description
type string true none Component type
text string true none Specification of the body text
Enumerated values
Property Value
type BODY

WhatsAppTemplateFooterComponentResponse

{
  "type": "FOOTER",
  "text": "The specification team"
}

Footer component of a template

Properties

Name Type Required Restrictions Description
type string true none Component type
text string true none Specification of the footer text
Enumerated values
Property Value
type FOOTER

TemplateCategory

"ACCOUNT_UPDATE"

Category of the template

Properties

Name Type Required Restrictions Description
anonymous string false none Category of the template
Enumerated values
Property Value
anonymous ACCOUNT_UPDATE
anonymous ALERT_UPDATE
anonymous APPOINTMENT_UPDATE
anonymous AUTO_REPLY
anonymous ISSUE_RESOLUTION
anonymous PAYMENT_UPDATE
anonymous PERSONAL_FINANCE_UPDATE
anonymous RESERVATION_UPDATE
anonymous SHIPPING_UPDATE
anonymous TICKET_UPDATE
anonymous TRANSPORTATION_UPDATE

LanguageCode

"en"

Supported language codes, according to Supported Languages

Properties

Name Type Required Restrictions Description
anonymous string false none Supported language codes, according to Supported Languages
Enumerated values
Property Value
anonymous af
anonymous ar
anonymous az
anonymous bg
anonymous bn
anonymous ca
anonymous cs
anonymous da
anonymous de
anonymous el
anonymous en
anonymous en_GB
anonymous en_US
anonymous es
anonymous es_AR
anonymous es_ES
anonymous es_MX
anonymous et
anonymous fa
anonymous fi
anonymous fil
anonymous fr
anonymous ga
anonymous gu
anonymous ha
anonymous he
anonymous hi
anonymous hr
anonymous hu
anonymous ID
anonymous it
anonymous ja
anonymous kk
anonymous kn
anonymous ko
anonymous lo
anonymous lt
anonymous lv
anonymous mk
anonymous ml
anonymous mr
anonymous ms
anonymous nb
anonymous nl
anonymous pa
anonymous pl
anonymous pt_BR
anonymous pt_PT
anonymous ro
anonymous ru
anonymous sk
anonymous sl
anonymous sq
anonymous sr
anonymous sv
anonymous sw
anonymous ta
anonymous te
anonymous th
anonymous tr
anonymous uk
anonymous ur
anonymous uz
anonymous vi
anonymous zh_CN
anonymous zh_HK
anonymous zh_TW
anonymous zu

WhatsAppAccountStatus

{
  "messageOnBehalf": "APPROVED"
}

Status information for the WhatsApp account

Properties

Name Type Required Restrictions Description
messageOnBehalf string false none Indicates the status of a message on behalf request
Enumerated values
Property Value
messageOnBehalf PENDING
messageOnBehalf APPROVED
messageOnBehalf DENIED

PaginationLinkRelation

"first"

What kind of relation is this link.

The relations are defined as follows:

  • first – The first page in the resource list pagination
  • previous – The preceding page in the resource list pagination
  • current – The current page in the resource list pagination
  • next – The following page in the resource list pagination
  • last – The last page in the resource list pagination

Properties

Name Type Required Restrictions Description
anonymous string false none What kind of relation is this link.

The relations are defined as follows:

- first – The first page in the resource list pagination
- previous – The preceding page in the resource list pagination
- current – The current page in the resource list pagination
- next – The following page in the resource list pagination
- last – The last page in the resource list pagination
Enumerated values
Property Value
anonymous first
anonymous previous
anonymous current
anonymous next
anonymous last

WhatsAppChannelResponse

{
  "channel": "whatsapp",
  "scopes": [
    "messages:read",
    "profile:read",
    "callbacks:write",
    "callbacks:read"
  ],
  "id": {
    "phoneNumber": 12341234
  },
  "callback": {
    "callbackVersion": 2.11,
    "inboundMessageUrl": "https://your.server.com/inbound",
    "messageStatusUrl": "https://your.server.com/status",
    "eventFilter": [
      "MessageStatus::accepted",
      "MessageStatus::delivered"
    ]
  }
}

Properties

Name Type Required Restrictions Description
id object false none Definition of the Phone Number Id
» phoneNumber string false none none

WhatsAppChannelResponses

[
  {
    "channel": "whatsapp",
    "scopes": [
      "messages:read",
      "profile:read",
      "callbacks:write",
      "callbacks:read"
    ],
    "id": {
      "phoneNumber": 12341234
    },
    "callback": {
      "callbackVersion": 2.11,
      "inboundMessageUrl": "https://your.server.com/inbound",
      "messageStatusUrl": "https://your.server.com/status",
      "eventFilter": [
        "MessageStatus::accepted",
        "MessageStatus::delivered"
      ]
    }
  }
]

Properties

Name Type Required Restrictions Description
id object false none Definition of the Phone Number Id
» phoneNumber string false none none

allOf

Name Type Required Restrictions Description
anonymous object false none General channel configuration
» channel string false none none
» scopes [string] false none none
» callback object false none Configuration of callbacks to your system
»» callbackVersion string false none Event version to be used.
»» inboundMessageUrl string false none Webhook for events related to inbound messages
»» messageStatusUrl string false none Webhook for events related to message status changes
»» eventFilter [string] false none List of status events to listen on. If empty all events are submitted.
» name string false none none
Enumerated values
Property Value
callbackVersion 2.11

ChannelCallback

{
  "callbackVersion": 2.11,
  "inboundMessageUrl": "string",
  "messageStatusUrl": "string",
  "eventFilter": []
}

Configuration of callbacks to your system

Properties

Name Type Required Restrictions Description
callbackVersion string false none Event version to be used.
inboundMessageUrl string false none Webhook for events related to inbound messages
messageStatusUrl string false none Webhook for events related to message status changes
eventFilter [string] false none List of status events to listen on. If empty all events are submitted.
Enumerated values
Property Value
callbackVersion 2.11

QualityScore

{
  "score": "RED",
  "reasons": [
    "Users are choosing \"didn't sign up\" as a reason for blocking this phone number. Businesses must obtain opt-in before sending notifications. Please review your opt-in flow(s) and see our Business Policy for more detail."
  ]
}

The quality score provided by WhatsApp and calculated from user feedback on your messages

Properties

Name Type Required Restrictions Description
score string true none The current scoring
reasons [string] false none Textual description why the quality score is set to the value.
Only present when score is YELLOW or RED
Enumerated values
Property Value
score unknown
score GREEN
score YELLOW
score RED

Viber

Version: v3.0

Specification Release Notes Other versions

Conversations allows you to easily send messages to your customers via Viber.

Channel specific pre-conditions

  • Viber : A Viber Service id is required in order to use this channel. Please request access here

Viber defines different service types and capabilities. The service types limit the possible content combinations.

The following content / service type combinations are valid

Service Type Text Image Text & Button Text & Button & Image
One way
Two way
Session

Base URLs

Messaging

In this section we guide you on how to send messages, get information about the status and the events happening during the delivery.

Send a message

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/conversations/v3/messages \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

POST https://api.tyntec.com/conversations/v3/messages HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "to": "+123234234",
  "from": "545345345",
  "channel": "viber",
  "messagePurpose": "promotion",
  "content": {
    "contentType": "text",
    "text": "A simple text message"
  }
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('https://api.tyntec.com/conversations/v3/messages',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.post 'https://api.tyntec.com/conversations/v3/messages',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('https://api.tyntec.com/conversations/v3/messages', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/conversations/v3/messages', 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("https://api.tyntec.com/conversations/v3/messages");
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{"application/json"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/conversations/v3/messages", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /messages

Send messages via this path.

Body parameter

{
  "to": "+123234234",
  "from": "545345345",
  "channel": "viber",
  "messagePurpose": "promotion",
  "content": {
    "contentType": "text",
    "text": "A simple text message"
  }
}

Parameters

Name In Type Required Description
body body MessageRequest true The message you would like to send

Example responses

202 Response

{
  "messageId": "77185196-664a-43ec-b14a-fe97036c697f",
  "acceptedAt": "2019-08-24T14:15:22Z"
}

400 Response

{
  "status": 400,
  "violations": [
    {
      "field": "validate.request.content.contentType",
      "message": "must not be empty"
    }
  ],
  "title": "Constraint Violation"
}

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

Responses

Status Meaning Description Schema
202 Accepted Response after the server has accepted the request MessageResponse
400 Bad Request The request does not match our expectations. Please check the Problems object for details Problem
403 Forbidden You attempting to use a number that is not assigned to your account Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Send a bulk message

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/conversations/v3/bulks \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

POST https://api.tyntec.com/conversations/v3/bulks HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "to": "+1233423454",
  "from": "+1233423454",
  "messagePurpose": "promotion",
  "channel": "viber",
  "messages": [
    {
      "contentType": "text",
      "text": "string"
    },
    {
      "contentType": "image",
      "image": {
        "url": "string"
      }
    },
    {
      "components": {
        "body": [
          {
            "contentType": "text",
            "text": "string"
          }
        ]
      }
    }
  ]
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('https://api.tyntec.com/conversations/v3/bulks',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.post 'https://api.tyntec.com/conversations/v3/bulks',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('https://api.tyntec.com/conversations/v3/bulks', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/conversations/v3/bulks', 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("https://api.tyntec.com/conversations/v3/bulks");
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{"application/json"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/conversations/v3/bulks", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /bulks

Send bulk messages. Bulk messages are defined as ordered messages to one receiver.

Body parameter

{
  "to": "+1233423454",
  "from": "+1233423454",
  "messagePurpose": "promotion",
  "channel": "viber",
  "messages": [
    {
      "contentType": "text",
      "text": "string"
    },
    {
      "contentType": "image",
      "image": {
        "url": "string"
      }
    },
    {
      "components": {
        "body": [
          {
            "contentType": "text",
            "text": "string"
          }
        ]
      }
    }
  ]
}

Parameters

Name In Type Required Description
body body BulkMessageRequest true The message bulk you would like to send

Example responses

202 Response

{
  "bulkId": "string",
  "messageIds": [
    "string"
  ]
}

400 Response

{
  "status": 400,
  "violations": [
    {
      "field": "validate.request.content.contentType",
      "message": "must not be empty"
    }
  ],
  "title": "Constraint Violation"
}

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

Responses

Status Meaning Description Schema
202 Accepted Response after the server has accepted the request BulkMessageResponse
400 Bad Request The request does not match our expectations. Please check the Problems object for details Problem
403 Forbidden You attempting to use a number that is not assigned to your account Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Service IDs

List all Service IDs configured for your API account.

List Service IDs

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/configurations/channels/viber \
  -H 'Accept: application/json'

GET https://api.tyntec.com/conversations/v3/configurations/channels/viber HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json'

};

fetch('https://api.tyntec.com/conversations/v3/configurations/channels/viber',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/configurations/channels/viber',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://api.tyntec.com/conversations/v3/configurations/channels/viber', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/configurations/channels/viber', 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("https://api.tyntec.com/conversations/v3/configurations/channels/viber");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/configurations/channels/viber", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /configurations/channels/viber

List all Viber channels available to your API account

Example responses

200 Response

[
  {
    "channel": "viber",
    "scopes": [
      "messages:read",
      "callbacks:write",
      "callbacks:read"
    ],
    "id": {
      "serviceId": 1234
    },
    "name": "Your Company",
    "callback": {
      "callbackVersion": 2.11,
      "inboundMessageUrl": "https://your.server.com/inbound",
      "messageStatusUrl": "https://your.server.com/status",
      "eventFilter": [
        "MessageStatus::accepted",
        "MessageStatus::delivered"
      ]
    }
  }
]

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

Responses

Status Meaning Description Schema
200 OK A list of Viber channel configurations ViberChannelResponses
403 Forbidden You attempting to use a number that is not assigned to your account Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Read a configuration

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id} \
  -H 'Accept: application/json'

GET https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json'

};

fetch('https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id}', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id}', 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("https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /configurations/channels/viber/service-ids/{service-id}

Returns the specific channel configuration

Parameters

Name In Type Required Description
service-id path integer true Service ID used of a Viber Channel.

Example responses

200 Response

{
  "channel": "viber",
  "scopes": [
    "messages:read",
    "callbacks:write",
    "callbacks:read"
  ],
  "id": {
    "serviceId": 1234
  },
  "name": "Your Company",
  "callback": {
    "callbackVersion": 2.11,
    "inboundMessageUrl": "https://your.server.com/inbound",
    "messageStatusUrl": "https://your.server.com/status",
    "eventFilter": [
      "MessageStatus::accepted",
      "MessageStatus::delivered"
    ]
  }
}

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

Responses

Status Meaning Description Schema
200 OK A Viber channel configuration ViberChannelResponse
403 Forbidden You attempting to use a number that is not assigned to your account Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Callback configuration

In this section, we guide you on how to configure the callbacks on a per channel bases.

Update the callback

Code samples

# You can also use wget
curl -X PUT https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id}/callbacks \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

PUT https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id}/callbacks HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "callbackVersion": 2.11,
  "inboundMessageUrl": "string",
  "messageStatusUrl": "string",
  "eventFilter": []
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id}/callbacks',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.put 'https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id}/callbacks',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.put('https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id}/callbacks', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PUT','https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id}/callbacks', 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("https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id}/callbacks");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
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{"application/json"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PUT", "https://api.tyntec.com/conversations/v3/configurations/channels/viber/service-ids/{service-id}/callbacks", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PUT /configurations/channels/viber/service-ids/{service-id}/callbacks

Update the callback settings of a specific viber channel.

Body parameter

{
  "callbackVersion": 2.11,
  "inboundMessageUrl": "string",
  "messageStatusUrl": "string",
  "eventFilter": []
}

Parameters

Name In Type Required Description
body body ChannelCallback false none
service-id path integer true Service ID used of a Viber Channel.

Example responses

200 Response

{
  "channel": "viber",
  "scopes": [
    "messages:read",
    "callbacks:write",
    "callbacks:read"
  ],
  "id": {
    "serviceId": 1234
  },
  "name": "Your Company",
  "callback": {
    "callbackVersion": 2.11,
    "inboundMessageUrl": "https://your.server.com/inbound",
    "messageStatusUrl": "https://your.server.com/status",
    "eventFilter": [
      "MessageStatus::accepted",
      "MessageStatus::delivered"
    ]
  }
}

400 Response

{
  "status": 400,
  "violations": [
    {
      "field": "validate.request.content.contentType",
      "message": "must not be empty"
    }
  ],
  "title": "Constraint Violation"
}

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

Responses

Status Meaning Description Schema
200 OK A Viber channel configuration ViberChannelResponse
400 Bad Request The request does not match our expectations. Please check the Problems object for details Problem
403 Forbidden You attempting to use a number that is not assigned to your account Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Schemas

Problem

{
  "type": "https://docs.tyntec.com/problems/DataNotParseable",
  "title": "Data given was not parseable",
  "status": 400,
  "detail": "Unexpected end-of-input: expected close marker for Object (start marker at [Source: UNKNOWN; line: -1, column: -1) at [Source: UNKNOWN; line: 1, column: 97]\n"
}

The problem object follows the RFC-7807 (https://tools.ietf.org/html/rfc7807)

Properties

Name Type Required Restrictions Description
type string true none A URI reference [RFC3986] that identifies the problem type
title string true none A short, human-readable summary of the problem type.
status string true none The HTTP status code (RFC7231, Section 6) generated by the origin server for this occurrence of the problem.
detail string true none A human-readable explanation specific to this occurrence of the problem.

MessageResponse

{
  "messageId": "77185196-664a-43ec-b14a-fe97036c697f",
  "acceptedAt": "2019-08-24T14:15:22Z"
}

Properties

Name Type Required Restrictions Description
messageId string(uuid) true none Global unique Message Id reference
acceptedAt string(date-time) true none Point in time when the API confirms that the message request was accepted

BulkMessageResponse

{
  "bulkId": "string",
  "messageIds": [
    "string"
  ]
}

Properties

Name Type Required Restrictions Description
bulkId string false none none
messageIds [string] false none none

MessageRequest

{
  "to": "+123234234",
  "from": "545345345",
  "channel": "viber",
  "messagePurpose": "promotion",
  "content": {
    "contentType": "text",
    "text": "A simple text message"
  }
}

The message you would like to send

Properties

Name Type Required Restrictions Description
to string true none The receipient of the messages
The format depends on the specific channel
from string true none The Viber service id the message origins from
messagePurpose string true none The purpose of the message
channel string true none Channel selected for delivery.
overrides object false none Overrides of defaults for this message
» notificationCallbackUrl string false none When present this url is used for sending the delivery notifications to your webhook.
Can be used for debugging use cases or individual routings.
context string false none Context for this particular message
content any false none none

oneOf

Name Type Required Restrictions Description
» anonymous ViberTextContent false none none

xor

Name Type Required Restrictions Description
» anonymous ViberImageContent false none none

xor

Name Type Required Restrictions Description
» anonymous ViberComponentsContent false none none
Enumerated values
Property Value
messagePurpose promotion
messagePurpose transaction

BulkMessageRequest

{
  "to": "+1233423454",
  "from": "+1233423454",
  "messagePurpose": "promotion",
  "channel": "viber",
  "messages": [
    {
      "contentType": "text",
      "text": "string"
    },
    {
      "contentType": "image",
      "image": {
        "url": "string"
      }
    },
    {
      "components": {
        "body": [
          {
            "contentType": "text",
            "text": "string"
          }
        ]
      }
    }
  ]
}

The bulk of messages you would like to send

Properties

Name Type Required Restrictions Description
to string true none The receipient of the messages
The format depends on the specific channel
from string true none The sender of the messages. The format depends on the specific channel.
messagePurpose string true none The purpose of the message
channel string true none Channel selected for delivery.
messages [any] true none none
Enumerated values
Property Value
messagePurpose promotion
messagePurpose transaction

ViberTextContent

{
  "contentType": "text",
  "text": "string"
}

Properties

Name Type Required Restrictions Description
contentType string false none none
text string false none none
Enumerated values
Property Value
contentType text

ViberImageContent

{
  "contentType": "image",
  "image": {
    "url": "string"
  }
}

Properties

Name Type Required Restrictions Description
contentType string false none none
image ViberImage false none none
Enumerated values
Property Value
contentType image

ViberButtonContent

{
  "contentType": "button",
  "button": {
    "caption": "string",
    "url": "string"
  }
}

Properties

Name Type Required Restrictions Description
contentType string false none none
button ViberButton false none none
Enumerated values
Property Value
contentType button

ViberComponentsContent

{
  "components": {
    "body": [
      {
        "contentType": "text",
        "text": "string"
      }
    ]
  }
}

Properties

Name Type Required Restrictions Description
components object false none none
» body [anyOf] false none none

anyOf

Name Type Required Restrictions Description
»» anonymous ViberTextContent false none none

or

Name Type Required Restrictions Description
»» anonymous ViberImageContent false none none

or

Name Type Required Restrictions Description
»» anonymous ViberButtonContent false none none

ViberImage

{
  "url": "string"
}

Properties

Name Type Required Restrictions Description
url string false none none

ViberButton

{
  "caption": "string",
  "url": "string"
}

Properties

Name Type Required Restrictions Description
caption string false none none
url string false none none

ViberChannelResponse

{
  "channel": "viber",
  "scopes": [
    "messages:read",
    "callbacks:write",
    "callbacks:read"
  ],
  "id": {
    "serviceId": 1234
  },
  "name": "Your Company",
  "callback": {
    "callbackVersion": 2.11,
    "inboundMessageUrl": "https://your.server.com/inbound",
    "messageStatusUrl": "https://your.server.com/status",
    "eventFilter": [
      "MessageStatus::accepted",
      "MessageStatus::delivered"
    ]
  }
}

Properties

Name Type Required Restrictions Description
id object false none Definition of the Viber Service id
» serviceId string false none none
config object false none none
» serviceType string true none none
Enumerated values
Property Value
serviceType session
serviceType two-way
serviceType one-way

ViberChannelResponses

[
  {
    "channel": "viber",
    "scopes": [
      "messages:read",
      "callbacks:write",
      "callbacks:read"
    ],
    "id": {
      "serviceId": 1234
    },
    "name": "Your Company",
    "callback": {
      "callbackVersion": 2.11,
      "inboundMessageUrl": "https://your.server.com/inbound",
      "messageStatusUrl": "https://your.server.com/status",
      "eventFilter": [
        "MessageStatus::accepted",
        "MessageStatus::delivered"
      ]
    }
  }
]

Properties

Name Type Required Restrictions Description
id object false none Definition of the Viber Service id
» serviceId string false none none
config object false none none
» serviceType string true none none

allOf

Name Type Required Restrictions Description
anonymous object false none General channel configuration
» channel string false none none
» scopes [string] false none none
» callback object false none Configuration of callbacks to your system
»» callbackVersion string false none Event version to be used.
»» inboundMessageUrl string false none Webhook for events related to inbound messages
»» messageStatusUrl string false none Webhook for events related to message status changes
»» eventFilter [string] false none List of status events to listen on. If empty all events are submitted.
» name string false none none
Enumerated values
Property Value
serviceType session
serviceType two-way
serviceType one-way
callbackVersion 2.11

ChannelCallback

{
  "callbackVersion": 2.11,
  "inboundMessageUrl": "string",
  "messageStatusUrl": "string",
  "eventFilter": []
}

Configuration of callbacks to your system

Properties

Name Type Required Restrictions Description
callbackVersion string false none Event version to be used.
inboundMessageUrl string false none Webhook for events related to inbound messages
messageStatusUrl string false none Webhook for events related to message status changes
eventFilter [string] false none List of status events to listen on. If empty all events are submitted.
Enumerated values
Property Value
callbackVersion 2.11

Telegram (Beta)

Version: v3.0

Specification Release Notes Other versions

Conversations allows you to easily reach out and communicate with your clients via Telegram Bots.

For beta access please reach out to onboarding@tyntec.com

Base URLs

Messaging

In this section we guide you on how to send messages, get information about the status and the events happening during the delivery.

Send a message

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/conversations/v3/messages \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

POST https://api.tyntec.com/conversations/v3/messages HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "to": "+123234234",
  "from": "545345345",
  "channel": "telegram",
  "telegram": {
    "contentType": "text",
    "text": "A simple text message"
  }
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('https://api.tyntec.com/conversations/v3/messages',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.post 'https://api.tyntec.com/conversations/v3/messages',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('https://api.tyntec.com/conversations/v3/messages', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/conversations/v3/messages', 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("https://api.tyntec.com/conversations/v3/messages");
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{"application/json"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/conversations/v3/messages", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /messages

Send messages via this path.

Body parameter

{
  "to": "+123234234",
  "from": "545345345",
  "channel": "telegram",
  "telegram": {
    "contentType": "text",
    "text": "A simple text message"
  }
}

Parameters

Name In Type Required Description
body body MessageRequest true The message you would like to send

Example responses

202 Response

{
  "messageId": "77185196-664a-43ec-b14a-fe97036c697f",
  "acceptedAt": "2019-08-24T14:15:22Z"
}

400 Response

{
  "status": 400,
  "violations": [
    {
      "field": "validate.request.content.contentType",
      "message": "must not be empty"
    }
  ],
  "title": "Constraint Violation"
}

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

Responses

Status Meaning Description Schema
202 Accepted Response after the server has accepted the request MessageResponse
400 Bad Request The request does not match our expectations. Please check the Problems object for details Problem
403 Forbidden You attempting to use a number that is not assigned to your account Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Send a bulk message

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/conversations/v3/bulks \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

POST https://api.tyntec.com/conversations/v3/bulks HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "to": "+1233423454",
  "from": "+1233423454",
  "channel": "telegram",
  "messages": [
    {
      "contentType": "text",
      "text": "string"
    },
    {
      "contentType": "image",
      "image": {
        "url": "string",
        "caption": "string"
      }
    }
  ]
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('https://api.tyntec.com/conversations/v3/bulks',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.post 'https://api.tyntec.com/conversations/v3/bulks',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('https://api.tyntec.com/conversations/v3/bulks', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/conversations/v3/bulks', 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("https://api.tyntec.com/conversations/v3/bulks");
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{"application/json"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/conversations/v3/bulks", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /bulks

Send bulk messages. Bulk messages are defined as ordered messages to one receiver.

Body parameter

{
  "to": "+1233423454",
  "from": "+1233423454",
  "channel": "telegram",
  "messages": [
    {
      "contentType": "text",
      "text": "string"
    },
    {
      "contentType": "image",
      "image": {
        "url": "string",
        "caption": "string"
      }
    }
  ]
}

Parameters

Name In Type Required Description
body body BulkMessageRequest true The message bulk you would like to send

Example responses

202 Response

{
  "bulkId": "string",
  "messageIds": [
    "string"
  ]
}

400 Response

{
  "status": 400,
  "violations": [
    {
      "field": "validate.request.content.contentType",
      "message": "must not be empty"
    }
  ],
  "title": "Constraint Violation"
}

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

Responses

Status Meaning Description Schema
202 Accepted Response after the server has accepted the request BulkMessageResponse
400 Bad Request The request does not match our expectations. Please check the Problems object for details Problem
403 Forbidden You attempting to use a number that is not assigned to your account Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Telegram IDs

List all Telegram IDs configured for your API account.

List Telegram IDs

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/configurations/channels/telegram \
  -H 'Accept: application/json'

GET https://api.tyntec.com/conversations/v3/configurations/channels/telegram HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json'

};

fetch('https://api.tyntec.com/conversations/v3/configurations/channels/telegram',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/configurations/channels/telegram',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://api.tyntec.com/conversations/v3/configurations/channels/telegram', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/configurations/channels/telegram', 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("https://api.tyntec.com/conversations/v3/configurations/channels/telegram");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/configurations/channels/telegram", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /configurations/channels/telegram

List all Telegram channels available to your API account

Example responses

200 Response

[
  {
    "channel": "telegram",
    "scopes": [
      "messages:read",
      "callbacks:write",
      "callbacks:read"
    ],
    "id": {
      "telegramId": 12341234
    },
    "name": "your bot!",
    "credentials": {
      "botToken": "987923hrbnhjfedf87z324:fsdhf8n2r543j4hgr"
    },
    "callback": {
      "callbackVersion": 2.11,
      "inboundMessageUrl": "https://your.server.com/inbound",
      "messageStatusUrl": "https://your.server.com/status",
      "eventFilter": [
        "MessageStatus::accepted",
        "MessageStatus::dispatched"
      ]
    }
  }
]

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

Responses

Status Meaning Description Schema
200 OK A list of Telegram channel configurations TelegramChannelResponses
403 Forbidden You attempting to use a number that is not assigned to your account Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Read a configuration

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/conversations/v3/configurations/channels/telegram/telegram-ids/{telegram-id} \
  -H 'Accept: application/json'

GET https://api.tyntec.com/conversations/v3/configurations/channels/telegram/telegram-ids/{telegram-id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json


const headers = {
  'Accept':'application/json'

};

fetch('https://api.tyntec.com/conversations/v3/configurations/channels/telegram/telegram-ids/{telegram-id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get 'https://api.tyntec.com/conversations/v3/configurations/channels/telegram/telegram-ids/{telegram-id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://api.tyntec.com/conversations/v3/configurations/channels/telegram/telegram-ids/{telegram-id}', params={

}, headers = headers)

print r.json()

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/conversations/v3/configurations/channels/telegram/telegram-ids/{telegram-id}', 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("https://api.tyntec.com/conversations/v3/configurations/channels/telegram/telegram-ids/{telegram-id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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{
        "Accept": []string{"application/json"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/conversations/v3/configurations/channels/telegram/telegram-ids/{telegram-id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /configurations/channels/telegram/telegram-ids/{telegram-id}

Returns the specific channel configuration

Parameters

Name In Type Required Description
telegram-id path string true Telegram Bot ID used for Telegram messaging.

Example responses

200 Response

{
  "channel": "telegram",
  "scopes": [
    "messages:read",
    "callbacks:write",
    "callbacks:read"
  ],
  "id": {
    "telegramId": 12341234
  },
  "name": "your bot!",
  "credentials": {
    "botToken": "987923hrbnhjfedf87z324:fsdhf8n2r543j4hgr"
  },
  "callback": {
    "callbackVersion": 2.11,
    "inboundMessageUrl": "https://your.server.com/inbound",
    "messageStatusUrl": "https://your.server.com/status",
    "eventFilter": [
      "MessageStatus::accepted",
      "MessageStatus::dispatched"
    ]
  }
}

403 Response

{
  "type": "https://httpstatuses.com/403",
  "title": "Forbidden",
  "status": 403
}

Responses

Status Meaning Description Schema
200 OK A Telegram ID configuration TelegramChannelResponse
403 Forbidden You attempting to use a number that is not assigned to your account Problem
default Default Default response in case of any other error. Please check the error object for details Problem

Callback configuration

In this section, we guide you on how to configure the callbacks on a per channel bases.

Update the callback

Code samples

# You can also use wget
curl -X PUT https://api.tyntec.com/conversations/v3/configurations/channels/telegram/telegram-ids/{telegram-id}/callbacks \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

PUT https://api.tyntec.com/conversations/v3/configurations/channels/telegram/telegram-ids/{telegram-id}/callbacks HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "callbackVersion": 2.11,
  "inboundMessageUrl": "string",
  "messageStatusUrl": "string",
  "eventFilter": []
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('https://api.tyntec.com/conversations/v3/configurations/channels/telegram/telegram-ids/{telegram-id}/callbacks',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.put 'https://api.tyntec.com/conversations/v3/configurations/channels/telegram/telegram-ids/{telegram-id}/callbacks',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.put('https://api.tyntec.com/conversations/v3/configurations/channels/telegram/telegram-ids/{telegram-id}/callbacks', params={

}, headers = headers)

print r.json()