Answered

Best Intercom tool to use to return a date based on a user inputted serial number in the messenger dialog flow?

  • 27 March 2023
  • 1 reply
  • 53 views

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!

icon

Best answer by Daniel M15 29 March 2023, 18:14

View original

1 reply

Userlevel 2

Hey @Colton Petiprin! Daniel from Customer Support Engineering here 🔧 

 

I think the two options that you’ve highlighted here would be your best bet. If you have one serial number per user, you could create a custom attribute “serial number” and assign it a value per user, though it sounds like the user might have a dynamic number or multiple numbers. In this case, you’ll need to make a request to your backend, regardless of whether it’s a custom action or just a GET in a custom app. It might be easiest to create a custom app that just grabs the user’s inputted data, send a GET using their input (should be available in the content of the component within the subsequent request body when the user triggers a submit action!), and then display the returned data on screen. Check out our CK tutorial Messenger app to get you set up with this! Note that for Messenger apps, it will only update the UI on the end user’s side. If you wish to display the number to the admin, or you have additional actions you’d like to apply to the returned data, a custom action may be more appropriate here. Ultimately, both will be querying your backend so it is up to you whether you would find it handier to allow the customer to get the info via a Messenger app, or within a bot flow as a custom action.

 

Hope this helps 🙌 

Reply