Przejdź do treści

Voice SMS Campaign Create

Stworzenie nowej kampanii głosowej sms o podanej konfiguracji.

POST /voice_sms_campaign

Body

{
    "data": <VoiceSMSCampaign>
}
Nazwa Rodzaj Opcjonalne Opis
data <VoiceSMSCampaign> NIE Dane Kampanii głosowej SMS

Response Body

{
    "data": <VoiceSMSCampaign>
}

Response Code

Status Opis
200 Żądanie przyjęte do realizacji
403 Nie można wykonać takiej akcji
404 Nie znaleziono zasobu

Example

curl -X POST \
$CONPEEK_URL/voice_sms_campaign \
-H 'Authorization: '$CONPEEK_KEY \
-H 'Content-Type: application/json' \
-d '{
    "data": {
        "name": "May 2020 C1",
        "project_id": 5,
        "active_calls_limit": 3,
        "attempt_count": 1,
        "attempt_interval": 1,
        "default_priority": 200,
        "heard_after_percentage": 0,
        "process_date": "ANY",
        "process_time": "ANY",
        "amd": {
        "amd_enabled": false,
        "amd_machine_announcement_id": null,
        "amd_announcement_id": null
        },
        "menu": {
        "menu_enabled": false,
        "menu_announcement_id": null,
        "condition": {},
        "menu_failure_announcement_id": null
        },
        "transfer": {
        "transfer_enabled": false,
        "transfer_number": null,
        "transfer_charge_number": null,
        "transfer_preserve_presentation": null
        }
    }    
}'
import requests
import json
import os
from urllib import parse

url = parse.urljoin(os.environ["CONPEEK_URL"], "/voice_sms_campaign")

payload = {
    "data": {
        "name": "May 2020 C1",
        "project_id": 5,
        "active_calls_limit": 3,
        "attempt_count": 1,
        "attempt_interval": 1,
        "default_priority": 200,
        "heard_after_percentage": 0,
        "process_date": "ANY",
        "process_time": "ANY",
        "amd": {
            "amd_enabled": false,
            "amd_machine_announcement_id": null
        },
        "menu": {
            "menu_enabled": false,
            "menu_announcement_id": null,
            "condition": {},
            "menu_failure_announcement_id": null
        },
        "transfer": {
            "transfer_enabled": false,
            "transfer_number": null,
            "transfer_charge_number": null,
            "transfer_preserve_presentation": null
        }
    }
}

headers = {
    'Content-Type': "application/json",
    'Authorization': os.environ["CONPEEK_KEY"]
}

response = requests.request("POST", url, data=json.dumps(payload), headers=headers)
print(response.text)
<?php
$curl = curl_init();

$payload = array(
    "data" => array(
        "name" => "May 2020 C1",
        "project_id" => 5,
        "active_calls_limit" => 3,
        "attempt_count" => 1,
        "attempt_interval" => 1,
        "default_priority" => 200,
        "heard_after_percentage" => 0,
        "process_date" => "ANY",
        "process_time" => "ANY",
        "amd" => array(
            "amd_enabled" => false,
            "amd_machine_announcement_id" => null
        ),
        "menu" => array(
            "menu_enabled" => false,
            "menu_announcement_id" => null,
            "condition" => array(),
            "menu_failure_announcement_id" => null
        ),
        "transfer" => array(
            "transfer_enabled" => false,
            "transfer_number" => null,
            "transfer_charge_number" => null,
            "transfer_preserve_presentation" => null
        )
    )
);

curl_setopt_array($curl, array(
    CURLOPT_URL => getenv("CONPEEK_URL")."/voice_sms_campaign",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => json_encode($payload),
    CURLOPT_HTTPHEADER => array(
        "Authorization: ".getenv("CONPEEK_KEY"),
        "Content-Type: application/json"
    ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #:" . $err;
} else {
    echo $response;
}

Response

200 Accepted

{
    "data": {
        "name": "May 2020 C1",
        "project_id": 5
        ...
    }
}