Skip to content

Session channels

This endpoint returns project channels given a session.

API key

You must add the x-api-key: your-api-key from the admin panel settings to the headers

Endpoint

GET https://api.kod.mobi/session/channels

Request

If you have a valid session, you should pass it to the request as session_id query parameter to get the actual channels.

Query params

Param Type Description Required
session_id ulid Valid session id false

Response

The Response will be an array of SessionChannel

SessionChannel

Param Type Description
name string Channel name
type Channel Channel type
is_active boolean User status on the channel. ex: on telegram bot
timeout number | min:0 | max:60 Channel block timeout
image_url string | url Channel image url
link string | url Channel link url, ex: to telegram bot

Example

Session ID is an optional parameter, if you don't have it you can skip it

curl --location 'https://api.kod.mobi/session/channels?session_id=<replace me>' \
  --header 'x-api-key: <replace me>'
const headers = new Headers();
headers.append('x-api-key', '<replace me>');

const requestOptions: RequestInit = {
  method: 'GET',
  headers,
  redirect: 'follow',
};

fetch(
  'https://api.kod.mobi/session/channels?session_id=<replace me>',
  requestOptions,
)
  .then((response) => response.json())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
1
2
3
4
5
6
7
8
9
<?php

$client = new \GuzzleHttp\Client();
$headers = [
  'x-api-key' => '<replace me>'
];
$request = new Request('GET', 'https://api.kod.mobi/session/channels?session_id=<replace me>', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
package main

import (
    "fmt"
    "io"
    "net/http"
)

func main() { 
    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://api.kod.mobi/session/channels?session_id=<replace me>", nil)

    if err != nil {
        panic(err)
    }
    req.Header.Add("x-api-key", "<replace me>")

    res, err := client.Do(req)
    if err != nil {
        fmt.Println(err)
        return
    }
    defer res.Body.Close()

    body, err := io.ReadAll(res.Body)
    if err != nil {
        panic(err)
    }
    fmt.Println(string(body))
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("x-api-key", "<replace me>".into());

    let request = client.request(reqwest::Method::GET, "https://api.kod.mobi/session/channels?session_id=<replace me>")
        .headers(headers);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}

Example output

[
    {
        "name": "Whatsapp",
        "type": "whatsapp",
        "is_active": true,
        "timeout": 0,
        "image_url": "https://storage.kod.mobi/icons/whatsapp.svg",
        "link": "https://kod.mobi"
    },
    {
        "name": "Telegram",
        "type": "telegram",
        "is_active": false,
        "timeout": 0,
        "image_url": "https://storage.kod.mobi/icons/telegram.svg",
        "link": "https://t.me/my-tg-bot"
    },
    {
        "name": "SMS",
        "type": "sms",
        "is_active": false,
        "timeout": 0,
        "image_url": "https://storage.kod.mobi/icons/sms.svg",
        "link": "https://kod.mobi"
    },
    {
        "name": "Email",
        "type": "email",
        "is_active": true,
        "timeout": 0,
        "image_url": "https://storage.kod.mobi/icons/email.svg",
        "link": "https://kod.mobi"
    }
]