Quickstart

This page shows the fastest safe path to send through PING8 from an application.

1. Create An API Key

In PING8, open Send API, create an API template/key, and copy the generated key once. Store it as an environment variable:

export WORKONWARD_API_KEY="YOUR_API_KEY"

Do not commit API keys, paste them into examples, or print them in logs.

2. Install An SDK

Published package commands:

pip install workonward
npm install @workonward/sdk
go get github.com/rahvis/email/SDK/go
[dependencies]
workonward = "0.1"

While packages are being prepared for registries, install from this repository or use the local SDK source folders under SDK/.

3. Send One Email

Python:

import os
from workonward import Workonward
 
with Workonward(api_key=os.environ["WORKONWARD_API_KEY"]) as client:
    result = client.send("user@example.com", attribs={"name": "Ada"})
    print(result.message_id, result.status)

TypeScript:

import { Workonward } from "@workonward/sdk";
 
const client = new Workonward({
  apiKey: process.env.WORKONWARD_API_KEY!,
});
 
const result = await client.send("user@example.com", {
  attribs: { name: "Ada" },
});
console.log(result.messageId, result.status);

Go:

client, err := workonward.NewClient(os.Getenv("WORKONWARD_API_KEY"))
if err != nil {
    log.Fatal(err)
}
 
result, err := client.Send(context.Background(), "user@example.com", workonward.SendOptions{
    Attribs: map[string]string{"name": "Ada"},
})
if err != nil {
    log.Fatal(err)
}
fmt.Println(result.MessageID, result.Status)

Rust:

use std::env;
use workonward::{Client, SendOptions};
 
#[tokio::main]
async fn main() -> Result<(), workonward::Error> {
    let client = Client::new(env::var("WORKONWARD_API_KEY").unwrap())?;
    let result = client.send("user@example.com", SendOptions::default()).await?;
    println!("{} {}", result.message_id, result.status);
    Ok(())
}

4. Check The Result

A successful API response means PING8 accepted the request for sending. Delivery lifecycle state is reported separately by the mail engine and provider telemetry.