PushStaq API

Introduction

PushStaq includes a simple API to send messages to your channels from any programming language or CLI to log events and receive real time push notifications alerts on crucial events. Integrate 3rd party apps, IOT ESP32 / ESP8266 / Arduino projects, Smart home systems, Devops server events and more.

For each PushStaq channel a user create, A unique API Key can be generated.
API Key are the unique identifier of your channel Webhook. With Webhook 3rd party apps can communicate with your PushStaq channel and Push new messages from any source you wish to receive important real time information from.

Generating channel API Key

  • Sign in / Sign up to PushStaq and create a channel or select existing one you would like to push messages to.
    pushstaq create a channel

  • In the selected channel, click the top right settings icon to open the settings pane.
    pushstaq open settings pane

  • In the Settings pane click the Generate API Key button, This will create a new API key you need to copy.
    pushstaq generate channel API key

  • Clicking the API Quick Guide will open a modal with examples to a working Webhook URL with the channel API Key.

Attention!

Do not share your channel API Key and/or channel Webhook URL. Keep them safe. Don't share with other people you don't trust and don't publish them on Public channels. Sharing your webhook can let anyone post to your PushStaq channel, even spamming it. Webhooks that exceeds rate limit and being detected as spam, the API Key will be revoked in order not to abuse PushStaq service. If you think your channel API Key is compromised, in the Channel Settings next to the API Key a Revoke this API Key button is available to remove the API Key from the channel.
This will expire the API Key of the channel and services that uses the old API Key will not work, You will need to generate a new channel API Key and update your 3rd party services with the new key.

Using the API with Webhooks

Using the PushStaq Webhook is pretty straight forward.
Using HTTP Protocol POST action, The message that will be sent to the channel will shown as PushStaq Bot Posts.
PushStaq API message from PushStaq Bot

To create a new post in the channel add x-api-key or api-key header property with the value of the API Key.

In case the service you are using does not support custom headers (IFTTT for example), You can add the API key to the URL path - See the 2nd example of this article.

In the following examples content type must be application/json and the payload is a JSON object with the message property which its value will represent a new post in the channel that the API key is associated with.

Example using API key headers

With the following examples, replace CHANNEL_API_KEY with your channel generated API key as shown in previous step.

Webhook URL: https://www.pushstaq.com/api/push/
Mandatory headers: x-api-key

Content-Type: application/json
x-api-key: CHANNEL_API_KEY

Payload:
{"message": "hello from API!"}

curl example using API key headers:

curl --header "Content-Type: application/json" --header "x-api-key: CHANNEL_API_KEY" --request POST --data
'{"message":"hello from API!"}' https://www.pushstaq.com/api/push/

Example using URL path with API key

Webhook URL: https://www.pushstaq.com/api/push/CHANNEL_API_KEY/
curl example using URL path with API key

curl --header "Content-Type: application/json" --request POST --data '{"message":"hello from API!"}' https://www.pushstaq.com/api/push/CHANNEL_API_KEY/

Conclusion

PushStaq API was designed to quickly integrate with developers services, Where each channel is designed to have its own unique API Key. It is very important to keep your API Key secured and not to share it with unknown sources.

We are constantly working on the API to improve and create a robust stable system. Future development to the API is geared towards team collaborations and more.

🌿 API related posts

Discuss this post on Reddit


Feedback

If you have any feedback, Suggestions or any other questions feel free to Discuss on PushStaq official subreddit or contact us at hello[at]pushstaq.com