New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: File Content as Part of IFTTT Webhook Call? #4

Closed
briancmoses opened this Issue Jan 5, 2019 · 14 comments

Comments

Projects
None yet
2 participants
@briancmoses
Copy link

briancmoses commented Jan 5, 2019

What I'd love to do with OctoPrint-IFTTT is to use the Timelapse event, MovieDone, to kick off some automation and use the file itself. For example; share it on Social Media, or upload it to Google Drive.

For starters, I'm not even certain if what I want to do is possible. The path and filenames sent by the Octoprint Event definitely seem to be strings and my experimentation using curl to try different calls to the webhook hasn't been successful.

Here's a couple examples:

  1. Pass the MovieDone .movie, to IFTTT Webhook via OctoPrint-IFTTT
  2. Manually URL-encode the full path and filename and send it to IFTTT Webhook via curl from the OctoPrint

It'd seem as if what would need to happen is that the file itself would need to be encoded and passed to IFTTT in the call to the IFTTT Webhook. In both cases, it seems that IFTTT got the filename, but uploaded some sort of File Not Found image in its place. Which makes sense, considering what I passed to it.

I was hoping that I could figure this out on my own and present an example of my own webhook call that was resulting in some sort of IFTTT action on that file (an upload to Google Drive, sharing to Twitter, anything). I'm going to keep working on that and will post an update when/if I'm successful.

@tjjfvi

This comment has been minimized.

Copy link
Owner

tjjfvi commented Jan 5, 2019

@briancmoses: I would recommend using a data uri. If that works, I'll consider adding functionality for that in OctoPrint-IFTTT.

@briancmoses

This comment has been minimized.

Copy link
Author

briancmoses commented Jan 5, 2019

@tjjfvi Makes sense! I didn't have much luck using data uri, though. I wound up using an online data URI Generator to create the text to pass to IFTTT.

It looks like what got logged by IFTTT matches what I passed it. But the file uploaded (a small PNG of my face) to Google drive was the same IFTTT "File not Found" error image. It doesn't seem like the data uri is supported by IFTTT's webhook. Or I'm not doing something correctly which is probably pretty likely.

I tinkered around with the Google Drive and Dropbox actions and the only time I had success getting any kind of file uploaded to Google Drive was when I sent IFTTT a URL to an image from my blog.

I'm not sure how useful that success is though, I guess maybe it might be possible to expose my Octoprint server to the Internet and find a way to build and pass the time lapse's URL to IFTTT

I'm going to keep working on it. I thought I'd share my progress in case it created a spark for someone else who might have more knowledge than I do.

@tjjfvi

This comment has been minimized.

Copy link
Owner

tjjfvi commented Jan 5, 2019

@briancmoses: That’s too bad; I just implemented a data uri thing. Boo.

@tjjfvi

This comment has been minimized.

Copy link
Owner

tjjfvi commented Jan 5, 2019

I’ll look into this more later.

@briancmoses

This comment has been minimized.

Copy link
Author

briancmoses commented Jan 5, 2019

Oh man! For both of our sakes, I hope that my tinkering this morning has been misguided. I'm still plugging away trying to figure out exactly what the IFTTT Actions will allow when they are asking for a File URL.

Sorry if I sent you down a wild-goose chase, I'll share anything that I find out and I'd be happy to look into anything you think would be helpful!

@tjjfvi

This comment has been minimized.

Copy link
Owner

tjjfvi commented Jan 5, 2019

@briancmoses: Got it if your printer is accessible externally. Use the url {public ip}:{port}/downloads/timelapse/{{ValueN}} where ValueN is .movie_basename

@briancmoses

This comment has been minimized.

Copy link
Author

briancmoses commented Jan 6, 2019

That's pretty excellent, @tjjfvi ! I'm pretty wary about exposing OctoPrint to the Internet. I guess I'll need to weight the benefit and see if it's worth the cost. I'm wondering if maybe there's a different solution out there. Or maybe something I can do to tighten down inbound traffic to Octoprint!

@tjjfvi

This comment has been minimized.

Copy link
Owner

tjjfvi commented Jan 6, 2019

@briancmoses: If you don't want your OctoPrint instance accessible externally, another thing to consider would be uploading the file to some external service (e.g. gist or pastebin or similar)

@tjjfvi

This comment has been minimized.

Copy link
Owner

tjjfvi commented Jan 6, 2019

file.io seems worth considering from a quick search.

@tjjfvi

This comment has been minimized.

Copy link
Owner

tjjfvi commented Jan 6, 2019

@briancmoses: I have added a file.io integration on the beta branch, if you want to test. Use @-.movie as a value. If it works, I'll document further.

@briancmoses

This comment has been minimized.

Copy link
Author

briancmoses commented Jan 6, 2019

I just installed the beta, updated my MovieDone event in OctoPrint-IFTTT, and tweaked my IFTTT Applet.

I'm confident enough that I've fired up my printer and running a quick (relatively speaking) print. I'll reply back with an update at the end of my print!

@briancmoses

This comment has been minimized.

Copy link
Author

briancmoses commented Jan 6, 2019

Success! This video just got uploaded to Google Drive as a result of the OctoPrint-IFTTT plugin's webhook call to IFTTT! Awesome!

@tjjfvi

This comment has been minimized.

Copy link
Owner

tjjfvi commented Jan 6, 2019

@briancmoses: Awesome! I'll document and merge this in. On a side note, what are your retraction settings? (I see zero stringing)

@tjjfvi

This comment has been minimized.

Copy link
Owner

tjjfvi commented Jan 6, 2019

Merged and released; closing!

@tjjfvi tjjfvi closed this Jan 6, 2019

@tjjfvi tjjfvi added the done label Jan 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment