Run a PHLO

    Run a PHLO by triggering it via an API request to the PHLO URL. The PHLO URL is available here.

    API Endpoint

    POST https://phlorunner.plivo.com/v1/account/{auth_id}/phlo/{phlo_id}

    Arguments

    URL Params

    ParamDescription/Allowed Values
    auth_idRequiredstring

    Your Plivo AUTH ID can be found when you log into the Console.

    phlo_idRequiredstring

    Unique identifier for the PHLO. PHLO ID is available here.

    Payload

    If dynamic payload is not defined in the Start node of the PHLO (as shown in the screenshot)

    No arguments need to be passed.

    payload_undefined

    Note:

    Payload will be directly defined in the Send SMS node.

    If dynamic payload is defined in the Start node of the PHLO (as shown in the screenshot)

    Values for keys defined in the Start node of PHLO are to be passed.

    ParamDescription
    from

    Value of the from key.

    to

    Value of the to key.

    payload_defined

    Note:

    Payload defined in the Start node will be accessed in the Send SMS node using liquid tags like shown in the below image.

    payload_defined

    Returns

    Returns an api_id to uniquely identify the PHLO run. This is canonically refered as phlo_run_id. The message attribute in the response provides more info about the PHLO run.

    Response

    HTTP Status Code: 201

    {
        "phlo_id": "4c1a9f23-7f56-4879-bb80-db856e1e7701",
        "api_id": "7b6f8256-07c7-4d9a-bf2a-a2cd0f05d269",
        "message": "b'Send SMS' - b'Send SMS_1' with phlo_run_uuid: 7b6f8256-07c7-4d9a-bf2a-a2cd0f05d269 executed with response: {'api_id': '81525812-3c04-11e9-aa1e-06c75f1208d2',\n 'message': 'message(s) queued',\n 'message_uuid': ['8152b05a-3c04-11e9-aa1e-06c75f1208d2']}"
    }
    
    Note:

    "message" would differ based on the node defined for PHLO trigger

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    import plivo
    
    auth_id = 'Your AUTH ID'
    auth_token = 'Your AUTH Token'
    phlo_id = 'Your PHLO ID' # https://console.plivo.com/phlo/list/
    phlo_client = plivo.phlo.RestClient(auth_id=auth_id, auth_token=auth_token)
    phlo = phlo_client.phlo.get(phlo_id)
    response = phlo.run()
    print str(response)
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    
    require 'rubygems'
    require 'plivo'
    
    include Plivo
    
    AUTH_ID = 'AUTH_ID'
    AUTH_TOKEN = 'AUTH_TOKEN'
    
    client = Phlo.new(AUTH_ID, AUTH_TOKEN)
    
    # if credentials are stored in the PLIVO_AUTH_ID and the PLIVO_AUTH_TOKEN environment variables
    # then initialize client as:
    # client = Phlo.new
    
    # run a phlo:
    begin
        phlo = client.phlo.get('phlo_id')
        #parameters set in PHLO - params
        params = {
           from: '9999999999',
           to: '0000000000'
        }
        response = phlo.run(params)
        puts response
      rescue PlivoRESTError => e
        puts 'Exception: ' + e.message
      end
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    
    var plivo = require('plivo');
    var PhloClient = plivo.PhloClient;
    
    var authId = 'auth-id';
    var authToken = 'auth-token';
    var phloId = 'PHLO_ID';
    var phloClient = phlo = null;
    var payload = {
        from: '19999999999',
        to: '18888888888'
    }
    
    // Run phlo
    phloClient = new PhloClient(authId, authToken);
    phloClient.phlo(phloId).run(payload).then(function (result) {
        console.log('Phlo run result', result);
    }).catch(function (err) {
        console.error('Phlo run failed', err);
    });
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    
    <?php
    /**
     * Example for API Request
     */
    require 'vendor/autoload.php';
    use Plivo\Resources\PHLO\PhloRestClient;
    use Plivo\Exceptions\PlivoRestException;
    $client = new PhloRestClient("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN");
    $phlo = $client->phlo->get("YOUR_PHLO_ID");
    try {
        $response = $phlo->run(["field1" => "value1", "field2" => "value2"]); // These are the fields entered in the PHLO console
        print_r($response);
    } catch (PlivoRestException $ex) {
        print_r($ex);
    }
    ?>
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    import com.plivo.api.Plivo;
    import com.plivo.api.PlivoClient;
    import com.plivo.api.exceptions.PlivoRestException;
    import com.plivo.api.models.phlo.Phlo;
    import java.io.IOException;
    
    public class Example
    {
        private static final String authId = "Your AUTH ID";
        private static final String authToken = "Your AUTH Token";
        private static PlivoClient client = new PlivoClient(authId, authToken);
        public static void main(String[] args) throws IOException, PlivoRestException
        {
            String phloId = "Your PHLO ID";
            Plivo.init(authId, authToken);
            Phlo phlo = Phlo.getter(phloId).client(client).get();
            Map<String, Object> payload = new HashMap<>();
            payload.put("phone", "+1111111111");
            payload.put("to", "+1111111112");
            PhloUpdateResponse response = Phlo.updater(phloId).payload(payload).run();
        }
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    
    using System;
    using Plivo;
    
    // without payload 
    
    namespace test_PHLO_dotnet
    {
        class Program
        {
            public static void Main(string[] args)
            {
                var phloClient = new PhloApi("auth_id", "auth_token");
                var phloID = "phlo_id";
                var phlo = phloClient.Phlo.Get(phloID);   
                Console.WriteLine(phlo.Run());
            }
        }
    }
    
    // with payload 
    
    namespace test_PHLO_dotnet
    {
        class Program
        {
            public static void Main(string[] args)
            {
                var phloClient = new PhloApi("auth_id", "auth_token");
                var phloID = "phlo_id";
                var phlo = phloClient.Phlo.Get(phloID); 
                var data = new Dictionary<string, object>
                {
                    { "from", "19999999999" },
                    { "to", "18888888888" }
    
                };  
                Console.WriteLine(phlo.Run(data));
            }
        }
    }
    
    1
    2
    
    curl -i --user AUTH_ID:AUTH_TOKEN \
      https://phlorunner.plivo.com/v1/account/{auth_id}/phlo/{phlo_id}
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    
    package main
    
    import (
    	"fmt"
    	"plivo-go"
    )
    
    // Initialize the following params with corresponding values to trigger resources
    
    const authId  = "auth_id"
    const authToken = "auth_token"
    const phloId = "phlo_id"
    
    // with payload in request
    
    func main() {
    	testPhloRunWithParams()
    }
    
    func testPhloRunWithParams() {
    	phloClient,err := plivo.NewPhloClient(authId, authToken, &plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    	phloGet, err := phloClient.Phlos.Get(phloId)
    	if err != nil {
    		panic(err)
    	}
    	//pass corresponding from and to values
    	type params map[string]interface{}
    	response, err := phloGet.Run(params{
    		"from": "111111111",
    		"to": "2222222222",
    	})
    
    	if (err != nil) {
    		println(err)
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    
    // without payload in request
    
    func main() {
    	testPhloRunWithoutParams()
    }
    
    func testPhloRunWithoutParams() {
    	phloClient,err := plivo.NewPhloClient(authId, authToken, &plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    	phloGet, err := phloClient.Phlos.Get(phloId)
    	if err != nil {
    		panic(err)
    	}
    	response, err := phloGet.Run(nil)
    	if err != nil {
    		panic(err)
    	}
    	fmt.Printf("Response: %#v\n", response)
    
    }