🚀 Send Multi-Channel Notifications

Overview

This guide will get you sending notifications across multiple channels at once with Pingram. You can send to email, SMS, calls, in-app, web push, mobile push, and Slack all in a single request.

WARNING

Some channels require additional setup before you can send notifications: In-App and Web Push require frontend SDK integration, Mobile Push requires platform-specific setup (iOS/Android), and Slack requires OAuth setup. This guide only shows how to send multi-channel notifications. For complete setup instructions, see the individual Quick-Start Guides or Channels Documentation.

Install the SDK for your backend language:

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

Install the package:

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 a notification across multiple channels at once:

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 notification across multiple channels
await pingram.send({
  type: 'order_tracking',
  to: {
    id: 'user123',
    email: 'user@example.com',
    number: '+15005550006'
  },
  email: {
    subject: 'Hello',
    html: '<h1>Hello, world!</h1>',
    senderName: 'My App',
    senderEmail: 'noreply@example.com'
  },
  sms: {
    message: 'Hello, world!'
  },
  inapp: {
    title: 'Hello',
    url: 'https://example.com',
    image: 'https://example.com/image.png'
  },
  mobile_push: {
    title: 'Hello',
    message: 'Hello, world!'
  },
  web_push: {
    title: 'Hello',
    message: 'Hello, world!',
    icon: 'https://example.com/icon.png',
    url: 'https://example.com'
  },
  call: {
    message: 'This is a test call from Pingram.'
  },
  slack: {
    text: 'Hello, world!'
  }
});
import asyncio
from pingram import Pingram

async def send_notification():
    async with Pingram(api_key="pingram_sk_...") as client:
        await client.send({
            "type": "order_tracking",
            "to": {
                "id": "user123",
                "email": "user@example.com",
                "number": "+15005550006"
            },
            "email": {
                "subject": "Hello",
                "html": "<h1>Hello, world!</h1>",
                "senderName": "My App",
                "senderEmail": "noreply@example.com"
            },
            "sms": {
                "message": "Hello, world!"
            },
            "inapp": {
                "title": "Hello",
                "url": "https://example.com",
                "image": "https://example.com/image.png"
            },
            "mobile_push": {
                "title": "Hello",
                "message": "Hello, world!"
            },
            "web_push": {
                "title": "Hello",
                "message": "Hello, world!",
                "icon": "https://example.com/icon.png",
                "url": "https://example.com"
            },
            "call": {
                "message": "This is a test call from Pingram."
            },
            "slack": {
                "text": "Hello, world!"
            }
        })

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

// For CA region: new Client('pingram_sk_...', 'https://api.ca.pingram.io')
// For EU region: new Client('pingram_sk_...', 'https://api.eu.pingram.io')
$client = new Client('pingram_sk_...');

$body = new SenderPostBody([
    'type' => 'order_tracking',
    'to' => [
        'id' => 'spongebob.squarepants',
        'email' => 'spongebob@squarepants.com',
        'number' => '+15005550006'
    ],
    'email' => [
        'subject' => 'Hello',
        'html' => '<h1>Hello, world!</h1>'
    ],
    'sms' => ['message' => 'Hello, world!'],
    'inapp' => [
        'title' => 'Hello',
        'url' => 'https://example.com',
        'image' => 'https://example.com/image.png'
    ],
    'mobile_push' => ['title' => 'Hello', 'message' => 'Hello, world!'],
    'web_push' => [
        'title' => 'Hello',
        'message' => 'Hello, world!',
        'icon' => 'https://example.com/icon.png',
        'url' => 'https://example.com'
    ],
    'call' => ['message' => 'This is a test call from Pingram.'],
    'slack' => ['text' => 'Hello, world!']
]);
$client->send($body);
package main

import (
  "context"
  "log"

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

func main() {
  client := pingram.NewClient("pingram_sk_...") // or pingram.WithBaseURL("https://api.ca.pingram.io") for CA, etc.

  body := pingram.SenderPostBody{
    Type: pingram.PtrString("order_tracking"),
    User: &pingram.GetUsersResponseUsersInner{
      Id:     "spongebob.squarepants",
      Email:  pingram.PtrString("spongebob@squarepants.com"),
      Number: pingram.PtrString("+15005550006"),
    },
    Email: &pingram.SenderPostBodyEmail{
      Subject:     "Hello",
      Html:        "<h1>Hello, world!</h1>",
      SenderName:  pingram.PtrString("My App"),
      SenderEmail: pingram.PtrString("noreply@example.com"),
    },
    Sms: &pingram.SenderPostBodySms{
      Message: pingram.PtrString("Hello, world!"),
    },
    Inapp: &pingram.SenderPostBodyInapp{
      Title: "Hello",
      Url:   pingram.PtrString("https://example.com"),
      Image: pingram.PtrString("https://example.com/image.png"),
    },
    MobilePush: &pingram.SenderPostBodyMobilePush{
      Title:   "Hello",
      Message: "Hello, world!",
    },
    WebPush: &pingram.SenderPostBodyWebPush{
      Title:   "Hello",
      Message: "Hello, world!",
      Icon:    pingram.PtrString("https://example.com/icon.png"),
      Url:     pingram.PtrString("https://example.com"),
    },
    Call:  pingram.NewSenderPostBodySmsAutoReply("This is a test call from Pingram."),
    Slack: pingram.NewSenderPostBodySlack("Hello, world!"),
  }

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

// Default US region. For CA: new PingramClient("your_api_key", "https://api.ca.pingram.io"); for EU: "https://api.eu.pingram.io"
var client = new PingramClient("your_api_key");

var body = new SenderPostBody
{
    Type = "order_tracking",
    To = new SenderPostBodyTo { Id = "spongebob.squarepants", Email = "spongebob@squarepants.com", Number = "+15005550006" },
    Email = new SenderPostBodyEmail("Hello", "<h1>Hello, world!</h1>"),
    Sms = new SenderPostBodySms { Message = "Hello, world!" },
    Inapp = new SenderPostBodyInapp("Hello", url: "https://example.com", image: "https://example.com/image.png"),
    MobilePush = new SenderPostBodyMobilePush { Title = "Hello", Message = "Hello, world!" },
    WebPush = new SenderPostBodyWebPush { Title = "Hello", Message = "Hello, world!", Icon = "https://example.com/icon.png", Url = "https://example.com" },
    Slack = new SenderPostBodySlack { Text = "Hello, world!" }
};
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("spongebob.squarepants")
            .email("spongebob@squarepants.com") // required for email notifications
            .number("+15005550006"); // optional; required to send SMS

        SenderPostBody body = new SenderPostBody()
            .type("order_tracking")
            .to(to)
            .email(new SenderPostBodyEmail()
                .subject("Hello")
                .html("<h1>Hello, world!</h1>")
            )
            .sms(new SenderPostBodySms()
                .message("Hello, world!")
            )
            .inapp(new SenderPostBodyInapp()
                .title("Hello")
                .url("https://example.com")
                .image("https://example.com/image.png")
            )
            .webPush(new SenderPostBodyWebPush()
                .title("Hello")
                .message("Hello, world!")
                .icon("https://example.com/icon.png")
                .url("https://example.com")
            )
            .mobilePush(new SenderPostBodyMobilePush()
                .title("Hello")
                .message("Hello, world!")
            )
            .slack(new SenderPostBodySlack()
                .text("Hello, world!")
            );

        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: 'order_tracking',
  to: { id: 'user123', email: 'user@example.com', number: '+15005550006' },
  email: { subject: 'Hello', html: '<h1>Hello, world!</h1>' },
  sms: { message: 'Hello, world!' },
  inapp: { title: 'Hello', url: 'https://example.com', image: 'https://example.com/image.png' },
  mobile_push: { title: 'Hello', message: 'Hello, world!' },
  web_push: { title: 'Hello', message: 'Hello, world!', icon: 'https://example.com/icon.png', url: 'https://example.com' },
  call: { message: 'This is a test call from Pingram.' },
  slack: { text: 'Hello, world!' }
)
client.send(body)

You’re All Set!

🎉 Congrats! You’re now sending multi-channel notifications!

To receive delivery and engagement events (opens, clicks, failures, etc.) at your own endpoint, set up a webhook.

For channel-specific advanced features, check out our channel documentation:

  • Email - Attachments, CC/BCC, custom templates, SPF/DKIM
  • SMS - Sender numbers, A2P 10DLC registration, best practices
  • Automated Voice Calls - Sender numbers, regulatory compliance
  • In-App - Custom click actions, batching, UI customization
  • Web Push - Browser support, troubleshooting, system settings
  • Mobile Push - iOS/Android setup, FCM configuration
  • Slack - OAuth setup, workspace integration
INFO

Prefer using templates? Keep your content in the dashboard and pass only dynamic parameters. See Server reference for template-based examples and our Templating guide to learn more.