Hi All,
I really need some pointers in the right direction here. Basically I want to create a jira ticket from home assistant. I have set up two connections in pipedream, one to HA and the other to Jira. These have ben tested and are set up correctly, I just don’t know what to do with them now.
I suspect I don’t need to be concerned about the HA connection for this use case but perhaps thinking that from HA I need to call an API on pipedream that somehow sends the request to create a jira ticket via my Jira connection setup???
Great question, so I would recommend setting up webhooks on your Home Assistant installation that ping a Pipedream workflow when a specific event occurs.
You can use the HTTP endpoint trigger on a Pipedream workflow and then connect HA to your workflow using a webhook.
What I find however is that when trying to access this data in the next step which pushes to Jira, the values are not available, they do not get passed on.
The image below shows that the variables are not available at this step.
So, at this point, I really don’t have the flows working correctly at all, would be good to sort it out o if you have any information that may be useful it would be appreciated. I’ve seen a number of tutorials, and the field values seem to be available in those examples. The other thing I noticed was that with the webhook trigger, someone could potentially spam the URL with no payload and this would result in the daily quota being exceeded quite easily. There doesn’t appear to be any safeguard there to protect against a scenario such as this as credentials are not being passed with the initial call.
Seems I can only embed one media item as a new user
There are not restrictions on free Pipedream Developer accounts when it comes to HTTP payloads to webhooks. I’m not sure what you’re referring to.
Perhaps HA isn’t sending the data you expect it to?
In your second screenshot here you show a different HTTP request. The first is a POST request containing data the body of the request, the second request is a GET request without a body.
The other thing I noticed was that with the webhook trigger, someone could potentially spam the URL with no payload and this would result in the daily quota being exceeded quite easily.
Each webhook URL is randomly generated to help with this issue, you can add a filter to help protect your webhooks by passing a secret key in the header of the request.
Sorry for the confusion, I meant as a new user this forum will only allow me to post one image per reply.
I did get the screen shots over a couple of different flows and it did contain some info from a GET rather than a POST. Below if from the one interaction.
The below is the json string I’m passing into the trigger from my node red flow.
{
"projectID": 10000,
"issueType": 10001,
"summary": "Test Task from HA",
"description": "This is the task description",
"assigneeId": "633e343af568615bdc80bb77"
}
As shown below, this data is captured by the trigger, so I assume the json data is actually correct.
If I look at the Logs tab on the action node that calls the Jira API I’m seeing the following message
Ignoring properties param, parsing failure: [SyntaxError: Unexpected token u in JSON at position 0]
The explanation of this error makes sense however, the json noted above is a valid json string which was obviously parsed by the trigger node. So I’m a bit lost as to where the issue actually lies.
The “Unexpected token u in JSON at position 0” error occurs when we pass an undefined value to the JSON.parse or $.parseJSON methods . To solve the error, inspect the value you’re trying to parse and make sure it’s a valid JSON string before parsing it.
The “Unexpected token u in JSON at position 0” is a typically Javascript error that will show up in your console log if the client has been directed to execute JSON.parse() on a string beginning with u instead of a stringified object. "u " is typically a stringified version of the undefined primitive.
As a follow up, I created a filter as you had suggested earlier, and I was surprised to note that the entire flow was now working. Is it possible perhaps that the payload was formatted in a correct way when it went through the filter before calling the Jira API. Other than that, there had been no changes to the flow.
My guess is that somehow HA is sending GET requests to your workflow’s URL endpoint. Since GET requests don’t have a body, it was causing the JIRA action to fail.
Opening that URL with your browser has the same effect.
Glad to hear you got this up and running! Are you writing a tutorial for how to do this? Would love to be able to set up HA at home myself, and I’m not sure how to send webhooks with HA.
Nah, the GET request was a test message when I was playing around with it all. It should have been POST, but this wasn’t the issue, not that I actually know what the underlying issue actually was. Is there an area specifically for tutorials?
In short, the webhook connectivity was simply done using the “http request” node included with Node Red which works as an addon for HA. The payload was a json string with the relevant parameters for Jira.