Skip to content
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] Set http headers for a post request? / Get body from file #686

Closed
andrewcartwright1 opened this issue Feb 22, 2023 · 2 comments · Fixed by #687
Closed

Comments

@andrewcartwright1
Copy link

Is your feature request related to a problem? Please describe.
On my stream, I have a python script that I use to poll the openxbl api to find out what achievement I have recently unlocked, I then save the new achievement information in a text file - I have a macro set up which checks for any changes to this file, which then changes the visiblity of a scene item and hides it after a period of time.

It has been requested that a bot posts in chat what achievement has just been unlocked incase the prompt is missed.

Describe the solution you'd like
I am looking at adding a http action to the macro that will make the streamelements bot post the information from this file, the issue that I have is..

  1. It requires a auth header: https://dev.streamelements.com/docs/api-docs/ae133ffaf8c1a-personal-access-using-jwt-secert-token-to-access-the-api
  2. I havn't looked too much into the http action yet, but I am guessing that the body is manually configured when reading the docs here: https://github.com/WarmUpTill/SceneSwitcher/wiki/Http-action , I was wondering if it would be possible to get the body of the request from a file - I can have the python script update a file with the body required for the message: https://dev.streamelements.com/docs/api-docs/1e22a4ed3ad16-channel-say

Describe alternatives you've considered
The only alternative that I can see here is, Instead of using the macro to read a file for changes and do all the actions, change it so that it checks for if the scene element's visibility has changed so that it can run through all the actions, and do the post request to streamelements via the python script.

The reasoning behind this is because I would like the notification to show on stream and the bot message to show at roughly about the same time but ideally would like one place to manage it all!

Now that I'm reading this back to myself aloud, the right way to probably do this is to make the python script update the scene item visibility and make the request to the streamelements api, leaving the macro to take care of hiding the element after the visibility change..

@WarmUpTill
Copy link
Owner

Thank you very much for the suggestion! :)

I havn't looked too much into the http action yet, but I am guessing that the body is manually configured when reading the docs here: https://github.com/WarmUpTill/SceneSwitcher/wiki/Http-action , I was wondering if it would be possible to get the body of the request from a file - I can have the python script update a file with the body required for the message: https://dev.streamelements.com/docs/api-docs/1e22a4ed3ad16-channel-say

This part should already be possible.

The http action does support using variables in body text area.
So you could use a macro setup similar to this one to assign the file contents to a variable named "File content":

Var

You can then reference the variable in a Http action using the syntax ${variable name here}.
So using the example from above something similar to this:

VarHttp

It requires a auth header

That I think is not yet possible at the moment and would have to be implemented.
I will add it to the todo list, but I am not sure yet when I will get around to it.

@WarmUpTill WarmUpTill linked a pull request Mar 4, 2023 that will close this issue
@WarmUpTill
Copy link
Owner

I implemented the option to set headers for the get and post requests in the http action.

Header

A build with this change should be available here in a few minutes:
https://github.com/WarmUpTill/SceneSwitcher/actions/runs/4333431636

I would appreciate if you could give this a try and report back if you run into any issues :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants