Hi Moustapha - is the event correctly encoded i.e....
# community-help
m
Hi Moustapha - is the event correctly encoded i.e. if you put it into https://www.base64decode.org does it decode correctly?
Is it possible it’s base64_url encoded?
If you want to share the event here or in a DM I can take a look
f
Yes it is. Here is the encode value. got from a GH API call : content of a json file
Copy code
ewogICJhY21lMjU4IiA6IFsKICAgICIxLjIuMy40LzMyIiwKICAgICIxLjIu
My40LzMxIiwKICAgICIxLjIuMy40LzI5IiwKICAgICIxLjIuMy40LzI4Igog
IF0KfQ==
And the value of the transformation (no change)
m
Looking now!
f
Thanks Thomas
m
So I think this is to do with the newlines
if we strip the newlines we can get it working with base64decode and jsonparse
Copy code
{
  "agents": [
    {
      "disabled": false,
      "name": "gh read file to update",
      "options": "{\"mode\":\"message_only\",\"loop\":false,\"payload\":{\"body\":{\"contents\":\"ewogICJhY21lMjU4IiA6IFsKICAgICIxLjIuMy40LzMyIiwKICAgICIxLjIu\\nMy40LzMxIiwKICAgICIxLjIuMy40LzI5IiwKICAgICIxLjIuMy40LzI4Igog\\nIF0KfQ==\"}}}",
      "position": {
        "x": 690,
        "y": 465
      },
      "type": "eventTransformation"
    },
    {
      "disabled": false,
      "name": "Parse Data",
      "options": "{\"mode\":\"message_only\",\"loop\":false,\"payload\":{\"message\":\"=gh_read_file_to_update.body.contents |> STRIP_NEWLINES(%) |> BASE64_DECODE(%) |> JSON_PARSE(%)\"}}",
      "position": {
        "x": 690,
        "y": 600
      },
      "type": "eventTransformation"
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
f
Oh, thank you. It's working well now
m
perfect - glad to hear it! I'm gonna make a suggestion that we try to strip newlines if it doesn't work; feels like this is something that's going to come up again
f
Yup, I was also going to suggest this 😉
Btw do you know any way to make an update? (we receive in a webhook, the instance (here acme258), IPs to add, IPs to remove). The goal is to rebuild this and commit the new content on GH. In a story, I already retrieve the input. Any suggestion in mind?
m
I'm not sure i follow - is the idea that you want to update this file in github or to add/remove ips from it? Both?
f
The idea is to automate the update of this JSON structure on GH through a Tines Story. Any update request will specify the : • The instance name (here acme258) • The list of IP to add (or empty) : Exemple ["1.5.0.0"] • The list of IP to remove (or empty): Exemple [1.2.3.4/31", "1.2.3.4/29"] Then in Tine: 1. We receive the request via Webhook 2. We validate the request coherence etc.... 3. We read the GH file 4. We update the GH file as described 👆 5. We create a new branch 6. We commit the new update in the new branch 7. We open a PR for review I actually implemented all the other steps but the 4. It's here where i'm asking for ideas
m
Hey Moustapha - I'm not 100% sure about this, definitely requires a little bit of thinking, and for me to set up an environment. Are you working with any of our Sales Engineers at the moment? It might be worth setting up a build session with one of them to see how we can achieve this; it's definitely possible!
f
Hi Thomas, thanks for your feedback. I finally find a way to do it (not yet very proud of it but it works). But definitely interested to discuss it with a sales engineers. I'm actually working on a PoC with the free version.
m
ah nice - who are you working with in Tines?
f
No one yet 🙂
m
oh wow, let me change that!
do you have a meeting set up tomorrow?
i'll dm you!
Hey @flat-kitchen-56993 - just to let you know we shipped some new code for the original base64_decode issue; shortly (as soon as it's merged, should be a few minutes!) if you have a base64 encoded string we'll attempt to decode it, then we'll attempt to decode it after stripping newlines. Thanks for highlighting this to us!
f
Thanks, @modern-farmer-99434 for this fix.