I am trying to figure out the best way to return a date based on a serial number the user would input in the messenger.
I have a JSON array file and python file. The python file opens the array converts to a dictionary then passes the dictionary and serial number to a function that returns a date as a JSON string. The serial number right now I have defined locally but will eventually need to retrieve from the chatbot user.
{
"Laptop_refresh_date": :
{
"Key": "ALL-FAKEKEY",
"Serial Number": "SOMESERIALNUM",
"Replacement Date": "Jan/31/25"
}
(there are a couple hundred more )
I don’t really care to map the attributes to chatbot user objects. It can just produce the output when the user needs.
I have an Amazon Web Service S3 bucket with these two files as S3 objects so that I could retrieve the data with custom actions since S3 provides an HTTPS object URL that is required from custom actions.
Here are some ideas I had for completing this task:
Have a custom action that “PUTS” the user inputted serial number in an empty file in my S3 bucket then i could add code that takes that data in my python file and either returns the date as JSON string or whatever data type/structure Intercom needs it returned as. Then I can have another custom action that GETS the python file object URL. Not sure if this would work because the PUT and GET requested would have to happen one after another and i would need to clear the data each time.
Maybe the best method is to create an app for the messenger but all I need is to return the date based on what the user inputs. If i could simply store the two files I have locally in intercom it would be much easier.
Any suggestions would be much appreciated!