πŸ“ž Send Voice Notifications

This guide will get you sending voice call notifications quickly with Pingram. Here’s how.

INFO

You DON’T need another 3rd-party like Twilio. Through our partnerships, we allocate and manage any required telecom infrastructure for you.

Install the SDK:

npm install pingram
pip install pingram-python
composer require pingram/php
go get github.com/pingram-io/pingram-go
dotnet add package Pingram

Add the Pingram dependency to your pom.xml. Check Maven Central for the latest version.

<dependencies>
    <dependency>
        <groupId>io.pingram</groupId>
        <artifactId>pingram</artifactId>
        <version>0.1.0</version>
    </dependency>
</dependencies>
gem install pingram

Or add to your Gemfile: gem 'pingram'

Now, send an automated call notification from your backend:

TIP

Use your API key (pingram_sk_...). You can find it in the Environments section of the Pingram dashboard.

import { Pingram } from 'pingram';

// Initialize with API key
const pingram = new Pingram({
  apiKey: 'pingram_sk_...' // Your secret API key
});

// Send call notification
await pingram.send({
  type: 'urgent_alert',
  to: {
    number: '+16175551212' // Replace using format [+][country code][area code][local number]
  },
  call: {
    message: 'This is an urgent alert from Acme Corp.'
  }
});
import asyncio
from pingram import Pingram

async def send_call():
    async with Pingram(api_key="pingram_sk_...") as client:
        await client.send({
            "type": "urgent_alert",
            "to": {
                "number": "+16175551212"  # Replace using format [+][country code][area code][local number]
            },
            "call": {
                "message": "This is an urgent alert from Acme Corp."
            }
        })

# Run the async function
asyncio.run(send_call())
use Pingram\Client;
use Pingram\Model\SenderPostBody;

$client = new Client('pingram_sk_...');

$body = new SenderPostBody([
    'type' => 'urgent_alert',
    'to' => [
        'id' => 'user123',
        'number' => '+16175551212'  // Replace using format [+][country code][area code][local number]
    ],
    'call' => [
        'message' => 'This is an urgent alert from Acme Corp.'
    ]
]);
$client->send($body);
package main

import (
    "context"
    "log"

    pingram "github.com/pingram-io/pingram-go"
)

func main() {
    client := pingram.NewClient("pingram_sk_...") // Your secret API key

    body := pingram.SenderPostBody{
        Type: pingram.PtrString("urgent_alert"),
        User: &pingram.GetUsersResponseUsersInner{
            Id:     "user123",
            Number: pingram.PtrString("+16175551212"), // Replace using format [+][country code][area code][local number]
        },
        Call: pingram.NewSenderPostBodySmsAutoReply("This is an urgent alert from Acme Corp."),
    }

    _, _, err := client.DefaultAPI.Send(context.Background()).SenderPostBody(body).Execute()
    if err != nil {
        log.Fatal(err)
    }
}
using Pingram;
using Pingram.Model;

var client = new PingramClient("your_api_key");
var body = new SenderPostBody
{
    Type = "urgent_alert",
    To = new SenderPostBodyTo { Id = "user123", Number = "+16175551212" }, // Replace using format [+][country code][area code][local number]
    Call = new SenderPostBodySmsAutoReply("This is an urgent alert from Acme Corp.")
};
await client.SendAsync(body);
package com.example;

import io.pingram.Pingram;
import io.pingram.model.*;

public class Example {
    public static void main(String[] args) {
        Pingram pingram = new Pingram("pingram_sk_..."); // Your secret API key

        SenderPostBodyTo to = new SenderPostBodyTo()
            .id("user123")
            .number("+16175551212"); // Replace using format [+][country code][area code][local number]

        SenderPostBody body = new SenderPostBody()
            .type("urgent_alert")
            .to(to)
            .call(new SenderPostBodyCall()
                .message("This is an urgent alert from Acme Corp.")
            );

        SenderPostResponse response = pingram.send(body);
        System.out.println("Tracking ID: " + response.getTrackingId());
    }
}
require 'pingram'

client = Pingram::Client.new(api_key: 'pingram_sk_...')
body = Pingram::SenderPostBody.new(
  type: 'urgent_alert',
  to: { id: 'user123', number: '+16175551212' },
  call: { message: 'This is an urgent alert from Acme Corp.' }
)
client.send(body)

You’re All Set!

πŸŽ‰ Congrats! You’re now sending automated voice call notifications!

For more advanced features like sender phone numbers, delivery tracking, and regulatory compliance, check out our Automated Voice Calls Channel documentation.