JustPush.io
  • Introduction
  • New? Start Here
  • The Glossary
  • USER MANUAL
    • Getting Started
    • API Key
    • JustPush Email
  • OBJECTS
    • Messages
      • Title
      • Topic
      • Message
      • Priority
      • Sounds
      • Images
      • Acknowledgements
      • Buttons
      • Button Groups
      • Expiry TTL
    • Topics
      • Title
      • Avatar
  • DEV TOOLS
    • API reference
      • Messages
      • Topics
    • OpenAPI
    • Rapid API
    • Postman
    • SDKs
    • Changelog
Powered by GitBook
On this page
  1. USER MANUAL

Getting Started

How to use JustPush efficiently

PreviousThe GlossaryNextAPI Key

Last updated 3 months ago

The user manual is our manual and tutorial list explaining you on how to implement and use JustPush services. It describes the process of getting from downloading the app to working / implementing with various frameworks.


1

Download and install one of our apps

Our apps are offered across various platforms. Follow the individual instructions to download / install the various applications.

iOS
  1. Click the following link to install

Android
  1. Click the following link to install

Web (to be announced)

2

Find your API Key

Find your API as described in the dedicated topic.

3

Send your first message

Find per programming language how you can send your first message. These examples do not use an SDK and are just setup to send your first message.

curl -X "POST" "https://api.justpush.io/messages" \
     -H 'Accept: application/json' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "message": "My First Message",
  "topic" : "Default",
  "title": "Bingo! I've just received my first message",
  "user": "REPLACE WITH API TOKEN"
}'
$response = file_get_contents("https://api.justpush.io/messages", false, stream_context_create([
    'http' => [
        'method' => 'POST',
        'header' => [
            'Accept: application/json',
            'Content-Type: application/json; charset=utf-8',
        ],
        'content' => json_encode([
            "message" => "My First Message",
            "topic" => "Default",
            "title" => "Bingo! I've just received my first message",
            "user" => "REPLACE WITH API TOKEN"
        ]),
    ]
]));

echo $response;
fetch('https://api.justpush.io/messages', {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json; charset=utf-8',
  },
  body: JSON.stringify({
    message: 'My First Message',
    topic: 'Default',
    title: "Bingo! I've just received my first message",
    user: 'REPLACE WITH API TOKEN'
  })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
async function sendMessage() {
  const response = await fetch('https://api.justpush.io/messages', {
    method: 'POST',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json; charset=utf-8',
    },
    body: JSON.stringify({
      message: 'My First Message',
      topic: 'Default',
      title: "Bingo! I've just received my first message",
      user: 'REPLACE WITH API TOKEN'
    }),
  });

  if (!response.ok) {
    throw new Error(`Error: ${response.statusText}`);
  }

  const data = await response.json();
  console.log(data);
}

sendMessage().catch(error => console.error('Error:', error));
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
)

func main() {
	message := map[string]string{
		"message": "My First Message",
		"topic":   "Default",
		"title":   "Bingo! I've just received my first message",
		"user":    "REPLACE WITH API TOKEN",
	}

	jsonData, err := json.Marshal(message)
	if err != nil {
		fmt.Println("Error marshaling JSON:", err)
		return
	}

	resp, err := http.Post("https://api.justpush.io/messages", "application/json; charset=utf-8", bytes.NewBuffer(jsonData))
	if err != nil {
		fmt.Println("Error making POST request:", err)
		return
	}
	defer resp.Body.Close()

	if resp.StatusCode != http.StatusOK {
		fmt.Println("Request failed with status:", resp.Status)
		return
	}

	var result map[string]interface{}
	json.NewDecoder(resp.Body).Decode(&result)
	fmt.Println("Response:", result)
}
import requests

url = "https://api.justpush.io/messages"

data = {
    "message": "My First Message",
    "topic": "Default",
    "title": "Bingo! I've just received my first message",
    "user": "REPLACE WITH API TOKEN"
}

response = requests.post(url, json=data, headers={
    'Accept': 'application/json',
    'Content-Type': 'application/json; charset=utf-8'
})

if response.status_code == 200:
    print("Response:", response.json())
else:
    print(f"Error: {response.status_code} - {response.text}")
require 'net/http'
require 'json'
require 'uri'

url = URI.parse("https://api.justpush.io/messages")

data = {
  message: "My First Message",
  topic: "Default",
  title: "Bingo! I've just received my first message",
  user: "REPLACE WITH API TOKEN"
}

json_data = data.to_json

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url.path, {
  'Accept' => 'application/json',
  'Content-Type' => 'application/json; charset=utf-8'
})
request.body = json_data

response = http.request(request)

if response.is_a?(Net::HTTPSuccess)
  puts "Response: #{JSON.parse(response.body)}"
else
  puts "Error: #{response.code} - #{response.message}"
end

Below example is applicable to a laravel command. After adding the command, use your terminal and command php artisan justpush:first

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;

class SendNotification extends Command
{
    protected $signature = 'justpush:first';

    protected $description = 'Send a notification via the JustPush API';

    public function handle()
    {
        $url = "https://api.justpush.io/messages";

        $data = [
            "message" => "My First Message",
            "topic" => "Default",
            "title" => "Bingo! I've just received my first message",
            "user" => "REPLACE WITH API TOKEN",
        ];

        $response = Http::withHeaders([
            'Accept' => 'application/json',
            'Content-Type' => 'application/json; charset=utf-8',
        ])->post($url, $data);

        if ($response->successful()) {
            $this->info('Notification sent successfully: ' . json_encode($response->json()));
        } else {
            $this->error('Failed to send notification: ' . $response->status() . ' - ' . $response->body());
        }

        return 0;
    }
}

Checkout our SDK's to make your integration easier.

JustPush
API Key