Have I said this before? I’m not a developer. Although someone accused me of being one, I tell people I google for code snippets, then bash them together and sometimes things work. Someone said “Your a developer then”. Golly I hope most developers are slightly better than that. With that in mind, I would never suggest you just implement code you don’t understand, or code someone else has written blindly.
I had a very simple “scripting” requirement. My problem is, I can understand code, I can manipulate it – but when looking at an IDE, it is like looking at a blank page with no idea how to start. With all this talk of “ChatGPT can program for you” – I figured I would give it a shot.
I have a need for a simple macro in a Cisco Webex device, for the purposes of room automation for a Future of Work project, I need to send a basic HTTP API call via a GET request when calls start and end. That’s it.
Finding a Solution
A quick google search turned up not many specific assistive links. I did get a link for the various macro samples on GitHub, as well as some of the macro documentation located on webex.com – but they were in specific.
I spent a few minutes pouring through examples trying to find code snippets using what I needed but found nothing specific.
Then I had a bit of a thought..
Can ChatGPT Really Help?
First I tried typing the exact same thing from Google, into ChatGPT.
At first glance, this actually looks pretty good. This gives me a good basis to do what I need. Run a macro on call start.
That gave me a good blueprint – but can it finish for me? “Once the call starts send an http get”
Once the call starts I actually need to send an HTTP GET to the system I am using for automation. I figured why continue to figure this out, let’s see if ChatGPT can do that.
the response was great, but the URL I am using also has a custom port. I could of course open the documentation for that function and figure out how to send a port number – or – let’s just see.
Can ChatGPT make basic additions to the code?
Something simple, not only did ChatGPT very quickly understand what I was asking for, with a very in specific request to add code – but it even pulled out the section I had to add.
Ok, this is good! Let’s keep going.
ChatGPT Error Handling
So I took this code, and deployed it on my Webex Codec Pro in my lab, to see if it would do what I wanted. I did of course change the hostname/port/path to the back end I was working with
However I got an error, a long winded one telling me the module “http” didn’t exist. At first I figured ChatGPT wouldn’t be able to solve this, but gave it a shot. I copied the error message verbatim from the macro log directly.
To my surprise, ChatGPT totally re-wrote the code in another manner to achieve this while removing the http function that was “missing”
We can get back to the logging differences later on.
Did it work? Back to the Documentation
Not as well as I had hoped. The macro didn’t appear to be “doing” anything. No errors – just no action.
I took a moment to look at this “event” that it was trapping. “CallStarted”
This event, doesn’t exist. From my searches, it never has. So back to the documentation we go.
I did try and use ChatGPT to fix the problem.
Unfortunately when I asked for help, ChatGPT gave up on me. I tried it a few times in case it was a busy issue but I couldn’t get a response to my problem.
Back in the documentation under “Events” I was able to find the “CallSuccessful” and “CallDisconnect” events. I wonder if these would work so I changed the code.
Success! It did work. While ChatGPT was busy I was able to get this working without ChatGPT.
I finally was able to get ChatGPT to work again, and I was able to say “CallStarted” doesn’t exist. I was able to get this response, which is correct. This code – works.
Can I use ChatGPT to write code?
There are a few challenges. It did help, I got this done in about 1/5 the time it probably would have taken me. I also didn’t really have to engage another team mate, leaving them free to work on their normal stuff.
There is also the learning aspect, these examples are now something I have learned, my skill in xAPI has improved through this exercise.
Who’s Code Is This? Can I use it?
So who owns this code? Who gets credit for it? I won’t try and take credit for owning the code, or claiming I wrote it. I am at best a hack (again) – but able to hack this to make it work. The challenge here, is where did this code come from? ChatGPT doesn’t “own” it. This code came from somewhere.
Did ChatGPT find this code on GitHub somewhere? In some kind of documentation? Was this the result of copyrighted knowledge? What is the license on this “code”?
For the purposes of learning or hackery – this might be fine, but to use code like this in a commercial environment – I’m not sure that would be ok, at a minimum there would be no way to know.
There is significant IP issues here, but this simplistic attempt at using ChatGPT to “get things done” worked for me. I’m just not sure I could legally and ethnically use it for commercial work.
I decided to ask ChatGPT about the license. The response was interesting. “I don’t generate code” I think that is arguable.
Then I asked about a commercial purpose. It wasn’t me to check the license terms of the code, that it provide from who knows what source.
This was an interesting experiment, that I didn’t plan to make – but it worked out in the end. I wanted to share how I was able to use ChatGPT to actually do something useful. So many questions came up during the process. Where is this going now? I have no idea, but it sure is interesting. I would be careful about taking what it says seriously, or using serious or important code without understanding what it is doing. What I am doing is reasonably benign, and while I am no developer, I do understand what this script is doing.