Sending outbound messages
To send messages using Powerpack:
Log in to the Plivo console and navigate to Messaging > Powerpacks to view all of your Powerpacks.
Copy the Powerpack ID for the Powerpack you wish to use.
Enter the Powerpack ID for powerpack_uuid in the Send SMS API request.
Code samples
1
2
3
4
5
6
7
8
import plivo
client = plivo . RestClient ( '<auth_id>' , '<auth_token>' )
message_created = client . messages . create (
powerpack_uuid = '<powerpack_uuid>' ,
dst = '<destination_number>' ,
text = 'Test Message'
)
1
2
3
4
5
6
7
8
9
10
11
12
13
require 'rubygems'
require 'plivo'
include Plivo
client = RestClient . new ( "<auth_id>" , "<auth_token>" )
response = client . messages . create (
nil ,
[ destination_number ],
'Test Message' ,
powerpack_uuid: '<powerpack_uuid>'
)
puts response
1
2
3
4
5
6
7
8
9
10
let plivo = require ( ' plivo ' );
let client = new plivo . Client ( ' <auth_id> ' , ' <auth_token> ' );
client . messages . create ({
powerpackUUID : " <powerpack_uuid> " ,
dst : ' <destination_number> ' ,
text : ' Test Message ' ,
},). then ( function ( message_created ) {
console . log ( message_created )
})
1
2
3
4
5
6
7
8
9
10
11
12
13
require 'vendor/autoload.php' ;
use Plivo\RestClient ;
$client = new RestClient ( '<auth_id>' , '<auth_token>' );
$message_created = $client -> messages -> create (
[
"powerpack_uuid" => "<powerpack_uuid>" ,
"dst" => "<destination_number>" ,
"text" => "Hello, this is a sample text" ,
"url" => "https://<yourdomain>.com/sms_status/" ,
]
);
print_r ( $message_created );
1
2
3
4
5
6
7
8
9
10
11
12
13
package com.plivo.api ;
import com.plivo.api.models.message.Message ;
import com.plivo.api.exceptions.PlivoRestException ;
import java.io.IOException ;
import java.util.Collections ;
class Example {
public static void main ( String [] args ) throws IOException , PlivoRestException {
Plivo . init ( "<auth_id>" , "<auth_token>" );
Message . creator ( "<powerpack_uuid>" , "<destination_number>" ), "Test Message" ). create ();
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main
import (
"fmt"
"github.com/plivo/plivo-go/v7"
)
func main () {
client , err := plivo . NewClient ( "<auth_id>" , "<auth_token>" , & plivo . ClientOptions {})
if err != nil {
fmt . Print ( "Error" , err . Error ())
return
}
client . Messages . Create ( plivo . MessageCreateParams {
PowerpackUUID : "<powerpack_uuid>" ,
Dst : "<destination_number>" ,
Text : "Test Message" ,
})
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using System ;
using System.Collections.Generic ;
using Plivo ;
internal class Program
{
public static void Main ( string [] args )
{
var api = new PlivoApi ( "<auth_id>" , "<auth_token>" );
var response = api . Message . Create (
powerpack_uuid : "<powerpack_uuid>" ,
dst : new List < String >{ "<destination_number>" },
text : "Test Message"
);
Console . WriteLine ( response );
}
}