Webhook not working

chaoscreater

Active member
I've tested the webhook URL on phone and on PC and it's not triggering anymore. FCM is working fine on my phone, I'm able to receive push notification (which I'm guessing is what the webhook relies on) for various apps.

Just wondering if anyone is having any issues with webhook or is the backend server OK?
 

Josué García

MacroDroid Support
Staff member
I've tested the webhook URL on phone and on PC and it's not triggering anymore. FCM is working fine on my phone, I'm able to receive push notification (which I'm guessing is what the webhook relies on) for various apps.

Just wondering if anyone is having any issues with webhook or is the backend server OK?
It works well here 🙋🏽‍♂️
 

Endercraft

Moderator (& bug finder :D)
I've tested the webhook URL on phone and on PC and it's not triggering anymore. FCM is working fine on my phone, I'm able to receive push notification (which I'm guessing is what the webhook relies on) for various apps.

Just wondering if anyone is having any issues with webhook or is the backend server OK?
Rebooting usually fixes it. Else maybe your device and the backend got out of sync, try regenerating an uuid (url).
 

chaoscreater

Active member
Ah I fixed it. I exported deviceID, then generated a new one, then imported my old deviceID back. Not sure why new one didn't work, but after importing the old one it works now.

It's quite annoying, I notice this issue happens every now and then, not often but maybe once every 6 months or so. I can't pinpoint what is causing this issue. I don't update the OS on my phone regularly (I'm on a custom ROM), probably once every year or so depending on what's in the changelog. I much prefer to just leave it if it's not broken, unless it's a security patch update that is critical, I won't bother with OS upgrades. I do however update the apps quite regularly though. But aside from that, my phone is pretty much static and don't go through a lot of changes. Everything else works fine, it's just the webhook that seems to be out of sync or breaks every 6 months or so...
 

MacroDroidDev

Administrator
Staff member
Thanks for flagging this issue. What your reporting could be indicative of some kind of issue with not handling the refresh token correctly that can come from Firebase Cloud Messaging. Essentially the FCM service can refresh the token associated with your device. I have code to handle this but it's rather difficult to test and verify if it's working correctly. I will make a task to go and investigate the code to have a good look over it and see if there is any way I can better test this.
 

chaoscreater

Active member
Looks like this is broken again. Tried the workaround (exporting device ID, importing it back) and it didn't work.

My webhook was literally working last night. Made no changes and didn't restart phone or anything. Now it's not working :(

I also lost my device ID along the troubleshooting process. I exported it with a password and re-imported it the first time. I then generated a new device ID and tested webhook, didn't work. I then tried to re-import my device ID and it keeps failing. It would seem that the import only works after you do an export and an export only works once per import. I was under the impression that as long as you've set the password, you can import as many times as you want....

UPDATE:

Tested webhook on another device. That's 2 devices that I've generated a new webhook IDs. Neither devices work. On the webpage, I'm getting a 200, but they're not received on the device.
 
Last edited:

Endercraft

Moderator (& bug finder :D)
Try restarting GMS (am force-stop com.google.android.gms or manually), it has solved the issue every time for me
 

chaoscreater

Active member
I think I know what the issue is.

I use Swift Backup for backing up my apps to OneDrive (I have a free developer tenant that gives me 5TB). Yesterday, my tablet had a botched Magisk update and this broke the boot partition and I had to format it and restore everything. So I used Swift Backup to restore the data. However, the data that got restored were backups taken from my phone, not on my tablet. This used to be a problem in the past, where apps that are designed to work on a specific screen size and a specific Android version, would fail to work on other devices. But these days, it's fine. I don't get any app crashes or any other issues.

However, this meant that it was a 1-1 restore. When MacroDroid got restored on this tablet, it had the exact same settings and everything, including the webhook ID, which is now found on both the tablet and on the phone. Even after generating a new device ID on both, neither would work.

I'm not sure what exactly fixed it, but I tried this in ADB shell:

  1. Get the root user
su

  1. cd to /data/data
cd /data/data


  1. Search for the files ending with gms.appid-no-backup firstly (without really deleting it), so you can review the list of the files that will be deleted, and make sure it will not delete something wrong (usually it should not. I don't think any other useful files named like this). If you don't really care, you can skip this step.
find . -type f -name '*gms.appid-no-backup'

  1. Delete all the files end with gms.appid-no-backup
find . -type f -name '*gms.appid-no-backup' -delete

And then I restarted my phone. After that, it worked again. Oddly enough, before I did all this, I got a spare phone out and restored MacroDroid to it from Swift Backup, generated a new device ID and tested and it worked. That phone is running LineageOS Android 14. Not sure if it matters, or if it's just a timing issue (maybe there was indeed an issue on the backend server and it got fixed), or something.....anyway it's OK again.
 

chaoscreater

Active member
Try restarting GMS (am force-stop com.google.android.gms or manually), it has solved the issue every time for me

I just tested this as I ran into the issue again yesterday and it didn't work. I got a new tablet and restored my Macrodroid backup to it. As per my previous post, it seems that when the backup is restored, it somehow messes with the deviceID. The deviceID on the tablet is not the same as the old deviceID on my phone. But I think there may be some underlying metadata that is still the same.

I generated a new deviceID on the tablet and force closed GMS on my phone. Tested webhook URL, no luck. I had to clear FCM as per my guide here - https://www.macrodroidforum.com/index.php?threads/webhook-not-working.6737/post-40864

And after that, restarted the phone and voila, webhook working again on my phone.
 
Top