gotify / cli Goto Github PK
View Code? Open in Web Editor NEWA command line interface for pushing messages to gotify/server.
License: MIT License
A command line interface for pushing messages to gotify/server.
License: MIT License
Currently, it's impossible to use gotify with a server running a self-signed cert.
gotify-cli init
(enter url)
Connecting -> Failed
Error: Get https://myserver.com/version: x509 certificate signed by unknown authority
gotify-cli init needs a flag to allow untrusted certificates.
It seems that it's possible to include this software into homebrew-core: https://docs.brew.sh/Acceptable-Formulae
This would simplify the installation and usage a lot ๐
Dear gotify devs,
I appreciate a lot this CLI for gotify and already integrated it for multiple purposes on two servers. I'd love to use the configuration option for the default notification priority, which is not yet available (or fixed) in the current release.
Can you please publish a new release with binaries of the current master so people can receive this feature through the package managers of their OS?
For reference, the need for a new release was mentioned in #36.
Thank you!
I think it would be good if we can support watching changes of command output and sending the difference to gotify, similar to the watch
command in *nix.
Then, when we want to do something really simple such as watching a change to the return of an api, we can simply do:
$ gotify-cli watch 'curl http://api.example.com/some_data | jq ".something_interesting"'
And them gotify would keep polling the data and send a notification when the output changes.
Whenever trying to use a function defined in my zshrc or a zsh alias as command for gotify-cli watch it fails:
first run failed command failed to invoke: exit status 127
Is there any way for gotify to have access to those functions and aliases?
I am trying to init the gotify and facing the below error
Gotify URL: http://localhost/
Connecting -> Failed
Error: Get "http://localhost/version": dial tcp 127.0.0.1:80: connect: connection refused
Hello.
I watched the development of the watch command and didn't understand what it was about. Now I tried it and still don't understand what the command is for.
In a normal 3 line bash loop I can make a comparison, evaluate the result and output it formatted as a message. Great.
With the Watch command I can only see the difference. What is this? What are the advantages?
This is a very polite question because I really don't understand it. :-)
Please delete this. This was not a bug.
Should be O
instead of o
:
$ wget -O gotify https://github.com/gotify/cli/releases/download/v1.2.0/gotify-cli-linux-amd64
Would it be possible to add the GOTIFY_SKIP_VERIFY_TLS
flag to the configuration file?
{
"token": "A4ZudDRdLT40L5X",
"url": "https://gotify.example.com",
"defaultPriority": 6
"skipVerifyTls": true
}
This way the whole configuration would reside in one place.
Hello,
Is is possible to have the message that's sent to Gotify also saved to a text file?
.\gotify-cli-windows-amd64.exe push "hello" > checkme.txt
> type .\checkme.txt
message created
I would like to have "hello" saved in the text file.
The latest release "2.2.1" show the correct date but the wrong version and commit hash, I found this accidentally trying to create a script to check if a greater version is available.
$ gotify-cli -v
Version: 2.1.1
Commit: bafdc655d319c3e3a8716efd8da5a15db4bbf096
BuildDate: 2021-12-11-19:22:36
Expected:
$ gotify-cli -v
Version: 2.2.1
Commit: 5714fb3d004271eb18a76456163208d1010e720d
BuildDate: 2021-12-11-19:22:36
Thanks for great work!
Hello.
I have my problems to understand the doku. ;-)
I will give some examples to send a message from bash.
As Mardown: Value of CR are two spaces and carriage return!
printf -v CR " \n" # Fill variable $CR
./gotify-cli-linux-amd64 p -p 0 --url "https://mydomain.com/gotify" --token "Axxxxxxxxxxxxxx" --contentType "text/markdown" -t "Title" "FirstLine${CR}**SecondLine**${CR}\*\*ThirdLine\*\*"
Result:
FirstLine
SecondLine
**ThirdLine**
As Plain Text: Value of CR is only carriage return.
printf -v CR "\n" # Fill variable $CR
./gotify-cli-linux-amd64 p -p 0 --url "https://mydomain.com/gotify" --token "Axxxxxxxxxxxxxx" --contentType "text/plain" -t "Title" "FirstLine${CR}**SecondLine**"
Result:
FirstLine
**SecondLine**
Hi,
According to the documentation the latest version of gotify available is version 2.1.4.
This is also confirmed as the latest version at docker hub is 2.1.4
Are the other repositories available for gotify images or should I build them myself?
Thanks in advance
sometime it is nice to run a command which is importend to complete, but the next run should not be to wide in the future.
it would be nice, that this command does not cancle on timeout, and the next run should be the interval time after the command complete time.
could we got a flag/option for it? (like --no-timeout)
I like that there is also a timeout option ...
gotify creates /home/user/.gotify/ without execute permission and so fails to write the file there.
Add
GIT_TAG=$(shell git tag)
to the makefile
Hi, is it possible to insert newline characters into the text that is sent?
I've tried inserting \n in the text - result is it just gets output, eg. gotify push -t "Test" -p 5 "fred\nnurk" gives: fred\nnurk
Also tried setting a variable as newline, eg. nl=$'\n', but this gets transformed into a space, eg. gotify push -t "Test" -p 5 "fred${nl}nurk" gives: fred nurk
TIA
I don't know why this script/program is written in GO, so I created a bash-version of this program.
https://github.com/RubenNL/gotify-bash
Would it be possible to have an official version based on bash? Not everyone is able to use the binaries/compile GO on his platform.
End to end encryption might be rather difficult without some kind of sending client this tool might be ideal. Also, this is a really helpful thing because you can just pipe things to it. Sure you can do that with curl but its way easier with a single binary.
Hi
The init seems to recreate the json file. I am wondering if it is possibe to use the cli app with multiple tokens and users easily without entering all those long details ? It works well when there is only one app token.
thanks
Hello,
i get this error unknown error (status 500): {resp:0x40007b6000}
when i run any of the following commands:
echo "โ" | gotify push
echo 'โ' | gotify push
echo โ | gotify push
What is the right syntax to push a message which includes the symbol above?
I am curious about if there's a similar program like cli which can watching/waiting the messages, and run commands according to the received messages?
If such a tool exists, can anyone tell me, thanks?
I am hoping to use such a tool to control my raspberryPi Linux to do something according to messages.
Please upvote the request for packaging at Ubuntu, see https://bugs.launchpad.net/ubuntu/+bug/2002308 (After logging in, you can vote on Yes, the effects me too.) This can be helped forward by creating a PPA for this project..
Web server :ubuntu 23.04
Install method:doker
The problems is http 401 error
PS:use ip domain name
After running init
and selecting to save the configs to ./cli.json
the executable is unable to find the config file unless the console working directory is the executable's directory. In fact, I believe the ./cli.json
file is saved to whichever working directory you have active when init
is run.
Not sure if this is the intended functionality but I expected it to save to the same directory as the .exe
file and to always be loaded from there regardless of my working directory.
As a temporary fix I created a batch script that I am using to call the cli app from anywhere with the expected behavior. I'm posting it here in case anyone finds this thread and needs an immediate fix.
gotify.bat
-----------------
@echo off
pushd %~dp0
Call %~dp0\gotify-cli-windows-amd64.exe p -q %*
popd
The scripts needs to be placed on the same directory as the executable to work as is.
Could you add an option to set the default message priority in the cli.json
file?
๐จ๐ปโ๐ป
If one uses the --token
argument, the token shows up in the process list. When I use different scripts on the same machine that use the gotify client, I'd also like to use different tokens in these scripts.
Thus it would be awesome to set a GOTIFY_TOKEN
env var in the script and the gotify cli uses the token from the env var.
Any chance that this can be added?
P.S.: I am more than happy to create a PR. I only want to know, whether such a change would be accepted.
I am trying to Run Gotify CLI on Termux Terminal Emulator for Android but Endup with this Below Error while init
the CLI
Error: Get https://push.example.com/version: dial tcp: lookup google.com on [::1]:53: read udp [::1]:48773->[::1]:53: read: connection refused
The CLI should place its configuration file according to the XDG Specification.
See here for more details on the XDG Specification: https://wiki.archlinux.org/index.php/XDG_Base_Directory
If we're okay with the dependency, https://github.com/adrg/xdg looks good & robust for handling this cross-platform.
Let me know if you're interested, and I'll get to work on it.
Hello, is it possible to send images via gotify cli?
Assuming config file exists.
gotify push --contentType "text/markdown" -t "Image" "https://placekitten.com/400/300"
Thanks?
/etc/gotify/cli.json
{
"token": "XXXXXXXXXXXXXXX",
"url": "http://127.0.0.1:8057",
"defaultPriority": 10
}
When I call gotify-cli push -t "title" "message"
, the notification successfully gets pushed and received, but the priority is 0.
I restarted the server (systemctl restart gotify-server
) to hopefully make it re-read the config file, but it makes no difference. /etc/gotify/cli.json
is the only config file I have.
gotify/server v2.0.18 (archlinux)
gotify/cli v2.1.1 (archlinux)
I'd like to use gotify-cli in some automatic scripts invoked by some other services. When I tried to make a parameter settings like these and without the cli.json:
gotify-cli push --url http://gotify.xxxxxxxx.com --token someToken messages
I got a golang panic both on Linux and Windows:
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x20 pc=0xd8ea02]
goroutine 1 [running]:
github.com/gotify/cli/v2/command.doPush(0xc00079e2c0)
/home/jm/src/gotify/cli/command/push.go:72 +0x342
gopkg.in/urfave/cli%2ev1.HandleAction({0xdc0020, 0xe66ce0}, 0x4)
/home/jm/go/pkg/mod/gopkg.in/urfave/[email protected]/app.go:492 +0x7b
gopkg.in/urfave/cli%2ev1.Command.Run({{0xe3fecd, 0x4}, {0x0, 0x0}, {0xc0003f06e0, 0x1, 0x1}, {0xe4573b, 0x10}, {0x0, ...}, ...}, ...)
/home/jm/go/pkg/mod/gopkg.in/urfave/[email protected]/command.go:210 +0x8f8
gopkg.in/urfave/cli%2ev1.(*App).Run(0xc00040f1e0, {0xc0000d8000, 0x7, 0x8})
/home/jm/go/pkg/mod/gopkg.in/urfave/[email protected]/app.go:255 +0x6ac
main.main()
/home/jm/src/gotify/cli/cli.go:34 +0xf88
But if I run gotify-cli init
or create a cli.json file with same url and token, it works well.
Hello,
in my test-environment I have 2 clients (smartphones) who logged in with different usernames.
Now I want to send a message over the CLI only to "user1", but I dont know what's the syntax.
And: I have a letsencrypt-certificate. With the smartphone-client I can check on that the client ignore somewhat so he had login correctly. Is this possible with the CLI too?
With best regards,
reschresch
The current default(first) location for configuration storage is ./cli.json
, which is not so useful in most cases since the user would need to:
cli.json
in a random directory, which is not a clearly explanatory file name.So I think in most cases, the user would use user directory as their config storage, so we should put that in front of ./cli.json
by default during initialization.
Hi,
Would you consider distributing this CLI tool as a snap?
This would make it much simpler to install on a bunch of distros, e.g.
snap install gotify-cli
...
gotify-cli push "Hello World"
I've worked out a minimal snapcraft yaml file (assuming it is included in this repo as snap/snapcraft.yaml
):
name: gotify-cli
summary: A command line interface for pushing messages to gotify/server.
description: |
Gotify-CLI is a command line client for pushing messages to gotify/server.
version: git
grade: stable
base: core20
confinement: strict
apps:
gotify-cli:
command: bin/cli
plugs: [network]
parts:
gotify-cli:
plugin: go
source: .
This was enough for me to build it locally, install it and test the init/config/push
functionalities. The version
command only spits unknown
s tho. Furthermore some of the proposed path for the config file are most likely not exposed by default to the snap.
During my migration to i386 linux server i stuck at this point.
In the moment i use a workaround on a second server.
Thanks.
The CLI for Linux (amd64 and 386) make an error when running within a cronjob. Running from shell does not make any errors. From my point it is the missing environment problem?
This is not working:
#!/bin/bash
/opt/gotify-cli-linux-amd64 p -p 1 --url "http://localhost:8080" --token "Axxxxxxxxxxxxxx" -t "Cron Demo" "via Cronjob"
This error is occur:
user: Current not implemented on linux/amd64
or
user: Current not implemented on linux/386
You can solve the problem with an USER line:
#!/bin/bash
export USER=dummy
/opt/gotify-cli-linux-amd64 p -p 1 --url "http://localhost:8080" --token "Axxxxxxxxxxxxxx" -t "Cron Demo" "via Cronjob"
It does NOT matter which username you add. "dummy" or "root" or "something" is ok.
PS: A note: In my mind there was also am issue with $HOME variable. But in my tests from today $HOME is not needed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.