Search code examples
javaspringherokulinefilewriter

How can I store the conversation of LINE Bot using LINE API and HEROKU?


I created line bot using LINE API and HEROKU. My bot works perfectly(echo example) but I wanna store the conversation with bot. So I added the code using bufferedwriter and filewriter but txt file doesn't be created..

If I run my code on Spring boot app, the txt file created properly in the path. But if I run my code on Heroku, it doesn't.

what should I do?


Solution

  • There is another answer that tells you why this isn't working, but I want to point out that you shouldn't do it this way on Heroku. If you need to store data that is persistent, you should put it in a database. Heroku gives you a free Postgres database. Run the following command:

    $ heroku addons:create heroku-postgresql
    

    Then add the code that uses it by following the Heroku guide for Connecting to Relational Databases.