Push
Send push notifications
Send a push notification to a user
Send push notification
POST https://api.usewuf.com/v1/push
Request Body
Name
Type
Description
apiKey*
string
Your app API key
userKey*
string
The User key (one between userKey or userGroupKey is required)
title*
string
Notification title
body*
string
Notification body
emoji
String
Emoji to be shown in the title and as icon in the Wuf app
image
String
Optional image to be included in the notification
url
String
Optional URL, shown in the Wuf app
userGroupKey*
String
The User Group Key (one between userKey or userGroupKey is required)
{
"id": "cllld08g00001ky08yqf5qdozson"
}Take a look at how you might call this method using different languages, or via curl:
curl https://api.usewuf.com/v1/push
-d apiKey='aeZVV0aaUA8y0Dqij_ptna'
-d userKey='uswXhaoDan2maAerZK9HZV'
-d title='New message received'
-d description='Hey, how are you doing?'
-d emoji='💬'
-d url='https://mychat.app/user/john' const axios = require('axios');
const data = JSON.stringify({
"apiKey": "aeZVV0aaUA8y0Dqij_ptna",
"userKey": "uswXhaoDan2maAerZK9HZV",
"title": "New report",
"body": "Read the latest news",
"emoji": "📈",
"url": "https://mysite.com/report-2023",
});
var config = {
method: 'post',
url: 'https://api.usewuf.com/v1/push',
headers: {
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});import http.client
import json
# Setup connection
conn = http.client.HTTPSConnection("api.usewuf.com")
# Define the endpoint
endpoint = "/v1/push"
# Create payload
payload = {
"apiKey": "aeZVV0aaUA8y0Dqij_ptna",
"userKey": "uswXhaoDan2maAerZK9HZV",
"title": "New report",
"body": "Read the latest news",
"emoji": "📈",
"url": "https://mysite.com/report-2023",
}
# Convert the payload to a JSON string
headers = {
'Content-Type': 'application/json'
}
# Send the POST request
conn.request("POST", endpoint, body=json.dumps(payload), headers=headers)
# Get the response
response = conn.getresponse()
data = response.read()
print(data.decode("utf-8"))
# Close the connection
conn.close()require 'net/http'
require 'uri'
require 'json'
# Setup URI and HTTP
uri = URI.parse("https://api.usewuf.com/v1/push")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
# Create payload
payload = {
"apiKey" => "aeZVV0aaUA8y0Dqij_ptna",
"userKey" => "uswXhaoDan2maAerZK9HZV",
"title" => "New report",
"body" => "Read the latest news",
"emoji" => "📈",
"url" => "https://mysite.com/report-2023"
}
# Setup request
request = Net::HTTP::Post.new(uri.request_uri, {
'Content-Type' => 'application/json'
})
request.body = payload.to_json
# Make the request
response = http.request(request)
puts response.bodypackage main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.usewuf.com/v1/push"
payload := map[string]interface{}{
"apiKey": "aeZVV0aaUA8y0Dqij_ptna",
"userKey": "uswXhaoDan2maAerZK9HZV",
"title": "New report",
"body": "Read the latest news",
"emoji": "📈",
"url": "https://mysite.com/report-2023",
}
// Convert map to JSON
data, err := json.Marshal(payload)
if err != nil {
fmt.Println("Error encoding payload:", err)
return
}
req, err := http.NewRequest("POST", url, bytes.NewBuffer(data))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
// Read the response body
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println("Response:", string(body))
}<?php
$url = 'https://api.usewuf.com/v1/push';
// Payload
$data = array(
"apiKey" => "aeZVV0aaUA8y0Dqij_ptna",
"userKey" => "uswXhaoDan2maAerZK9HZV",
"title" => "New report",
"body" => "Read the latest news",
"emoji" => "📈",
"url" => "https://mysite.com/report-2023"
);
// Initialize cURL session
$ch = curl_init($url);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json'
));
// Execute cURL session and get the response
$response = curl_exec($ch);
// Check for cURL errors
if (curl_errno($ch)) {
echo 'cURL error: ' . curl_error($ch);
} else {
echo $response;
}
// Close cURL session
curl_close($ch);
?>
Last updated