SMS Notification are used to send regular updates and notification to the users. Plivo’s PHLO allows you to quickly create and configure a SMS Notifications for your business. An API call will trigger the PHLO and will enable sending SMS messages to the customers.
With PHLO, you can quickly create a workflow that suits your use case. To use PHLO, make sure to register and log on to Plivo Console.
Use the following components to create this PHLO:
When you send an API request to the PHLO, it triggers a SMS message to the user using the Send SMS component. This is a simple use case, yet it is one of the most widely used.
Note: The Callback function provides the user details required to send the SMS message.
To create this PHLO
Your complete PHLO will look like this:
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.
You can find the PHLO Run URLs on the PHLO Listing page.
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
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
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)
}
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
var plivo = require('../dist/rest/client.js');
var PhloClient = plivo.PhloClient;
var authId = 'auth-id';
var authToken = 'auth-token';
var phloId = 'PHLO_ID';
var phloClient = phlo = null;
// Run phlo
phloClient = new PhloClient(authId, authToken);
phloClient.phlo(phloId).run().then(function (result) {
console.log('Phlo run result', result);
}).catch(function (err) {
console.error('Phlo run failed', err);
});
You can install the server SDKs and setup your development environment by referring to the instructions available in the below links:
Server SDKs
Setup your development environment
You can get your Auth_ID and Auth_token from your dashboard
You can find the PHLO_ID on the PHLO Listing page.
You can also use this PHLO structure for other use cases, like: