Set up Your Dotnet Dev Environment for PHLO
In this guide, you will learn how to set up a development environment in under 5 minutes to trigger a PHLO.
Prerequisites
Install .NET Framework and the Plivo Nuget package
You must set up and install Dotnet Framework(.NET Framework 4.6 or higher) and Plivo’s Dotnet SDK to trigger a PHLO. Here’s how.
Install Dotnet Framework
Operating System | Instructions |
---|---|
OS X & Linux | You would already have Dotnet Framework installed, you can check this by running the command dotnet --version in the terminal. If you do not have it installed, you can install it from here. |
Windows | To install Dotnet Framework on Windows you can follow the instructions from here. |
Install Plivo .NET Package using Visual Studio
- Create a new project in Visual Studio
- Choose a Template for the new project
- Install the Plivo Nuget package
Trigger a PHLO
Once you have created and configured your PHLO, copy the PHLO Run URL. You can integrate a PHLO into your application workflow by making an API request to the PHLO URL with the required payload.
With Static Payload
You can choose to either configure the mandatory params required for a PHLO while creating the PHLO itself or, you can pass the params as payload while triggering the PHLO from your app.
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using System;
using Plivo;
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 Dynamic Payload
To use dynamic values for the parameters, you can use the liquid templating params while creating the PHLO and pass the values while triggering the PHLO.
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
using Plivo;
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", "+14157778888" },
{ "to", "+14157778889" }
};
Console.WriteLine(phlo.Run(data));
}
}
}
You can get your Auth_ID and Auth_token from your dashboard
You can find the PHLO_ID on the PHLO Listing page.