Launching outbound call scenarios through API

2020-04-13 10:31:04
38611
0
Blog picture

To run a scenario through the API, you need to perform four simple steps: 

  1.  Get an API token
  2. Buy a phone number or verify your own 
  3. Enter a scenario into the Voximplant Kit editor 
  4. Run the scenario

Let’s break down these steps one by one. 

In order to use the API you will need to generate an API token in your personal account. 

Go to Integration, then enter the API Tokens area and click on Add API tokens. Enter the name of the API token in the dropdown window and press Save.

An API token will appear in this section. You can see it or copy it by pressing the respective icon to the left of the token. 



You can make API requests using these authorization parameters:  

  • domain – your account name
  • access_token – API token

After this, you need to buy or add a Voximplant Kit telephone number. This can be done in the Number section.

Then go to Create a Scenario. Enter Scenarios in the top navigation bar and look for the Outbound tab. Click on New Scenario, select a template or a pre-made scenario. 

After you have created a scenario, verified your telephone and received an API token you can run your scenario. 

 

Example of a PHP code

<?php

// Your Voximplant Kit account name
define('KIT_DOMAIN', "YOUR DOMAIN NAME HERE");

// API Token
define('KIT_ACCESS_TOKEN', "YOUR API TOKEN HERE");

// ID of your CallerID number ID
define('KIT_CALLERID_PHONE_ID', "CALLERID PHONE ID HERE");

// Voximplant Kit scenario id
define('KIT_SCENARIO_ID', "SCENARIO ID HERE");

// Voximplant Kit API url
define('KIT_API_URL', "https://kitapi-eu.voximplant.com/api/v3");

// Client data for using in scenario
$client_data = [
    'phone' => 'CLIENT PHONE NUMBER HERE',
    'client_name' => 'CLIENT NAME HERE'
];

// API Request parameters
$run_scenario_data = [
    'domain' => KIT_DOMAIN,
    'access_token' => KIT_ACCESS_TOKEN,
    'scenario_id' => KIT_SCENARIO_ID,
    'phone_number_id' => KIT_CALLERID_PHONE_ID,
    'phone' => $client_data['phone'],
    'variables' => json_encode([
        'client_name' => $client_data['client_name']
    ])
];

// HTTP Request to run the scenario
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, KIT_API_URL . "scenario/runScenario");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $run_scenario_data);
$returned = curl_exec($ch);
curl_close ($ch);
Sign Up for a free Voximplant developer account or talk to our experts

Add your comment

Name*
Email*
Message

Your comment has been added and will be published after moderation.

Recommended posts

5 Tactics to Strengthen Your Contact Center Operations with Technology

5 Tactics to Strengthen Your Contact Center Operations with Technology

In our fast-paced, digitally focused world, customers want personalized service at lightning speed. A Hubspot survey of 1,000 customers found that 90% of people expect a response from a live customer service agent in ten minutes or less. Because expectations are so high, the pressure is on for customer service agents to consistently provide quick, high-quality customer experiences. Offering an elevated level of service with such a fast turnaround is next to impossible with manual support alone. And even if you have some digital tools in your tech stack, traditional contact center technology can fall short when it comes to efficiency. That’s why choosing no-fuss technology that automates your contact center’s routine operations is essential for making tasks more manageable for your agents.

Where CPaaS Deploy their Networks - a Comparison

Where CPaaS Deploy their Networks - a Comparison

A couple weeks ago, Amazon Web Services (AWS) experienced an outage in its US-EAST-1 region. As so many services rely on AWS, this outage had a broader impact, causing outages and various issues with Amazon’s own Ring services, online retailers, and even the New York City MTA. In addition, a couple major Communications Platform as a Service (CPaaS) providers also reported issues (Voximplant was not impacted), potentially impacting the communications of many of their customers.  With this in mind, now is a good time to look at how CPaaS offers leverage public cloud infrastructure and review the factors involved in providing reliable, high quality communications services. In this post we will review the public cloud infrastructure used by several major CPaaS vendors and discuss the implications of their choices.