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
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?
Could you add an option to set the default message priority in the cli.json
file?
/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)
Please delete this. This was not a bug.
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.
gotify creates /home/user/.gotify/ without execute permission and so fails to write the file there.
When I tried to configure the CLI to connect to my server running on the same machine, I was unable to configure to connect using the URL "http://localhost:7500", but everything works fine if I tried to connect on "http://192.168.0.100:7500"!
In my browser, testing the WebUI shipped with the server, both URLs works fine!
Error ("http://localhost:7500"):
Post "http://localhost:7500/message": dial tcp: lookup localhost on 192.168.0.1:53: no such host
'192.168.0.1' is the IP address of my access point! I don´t know why the port '53'!
Tested on: Linux EndeavourOS 6.9.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 21 Jun 2024 19:49:19 +0000 x86_64 GNU/Linux
LSB Version: n/a
Distributor ID: EndeavourOS
Description: EndeavourOS Linux
Release: rolling
Codename: rolling
Thanks
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.
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.
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.
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?
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!
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
Add
GIT_TAG=$(shell git tag)
to the makefile
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?
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.
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 ...
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.
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
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
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
👨🏻💻
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.
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!
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.
Should be O
instead of o
:
$ wget -O gotify https://github.com/gotify/cli/releases/download/v1.2.0/gotify-cli-linux-amd64
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.
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.
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.
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 😊
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..
Travis CI hasn't been building for 2 years on this repo so there is no CI happening on this repo for 2 years. Since the server repo has migrated to GitHub Actions we probably should migrate this too.
I'm watching logs for some filesystems and want notified when there are new entries. I'm using:
`journalctl -kf | xargs -L 1 gotify p
That is working great! I'd like to make it integrated so as to not worry as much about buffering and to not need the xargs
and be more portable for others.
Something like:
journalctl -kf | gotify p -L 1
And the option could be:
gotify push
--lines value, -L value Push a message every 'value' lines (default: 1)
Would this be a good idea?
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
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.
Web server :ubuntu 23.04
Install method:doker
The problems is http 401 error
PS:use ip domain name
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
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.
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.