I want to help my mother with her sales

My name is Ygor, my mother sells clothes but they don’t have a physical or digital store, so I wanted to create an application to help her with sales. But I don’t know how to finish this code, it was an AI that created it, I don’t know what to do now.

from Numero import numero  # ADICIONAR NO INÍCIO

# ... resto do código ...

@app.route("/whatsapp", methods=["POST"])
def whatsapp():
    dados = request.form.to_dict()
    mensagem = (
        f"Pedido de {dados.get('nome')}%0A"
        f"Endereço: {dados.get('endereco')}%0A"
        f"CEP: {dados.get('cep')}%0A"
        f"Produto: {dados.get('produto')}%0A"
        f"Cor: {dados.get('cor')}%0A"
        f"Tamanho: {dados.get('tamanho')}%0A"
        f"Quantidade: {dados.get('quantidade')}%0A"
        f"Forma de pagamento: {dados.get('pagamento')}"
    )
    mensagem_codificada = urllib.parse.quote(mensagem)
    link = f"https://api.whatsapp.com/send?phone={numero}&text={mensagem_codificada}"
    return redirect(link)

Welcome, Ygor! From Brazil, I’m guessing (based on the Portuguese above)?

FWIW, it looks like the code you presented is a small, incomplete example snippit that implements a hypothetical backend API that sends a simple text “form” over WhatsApp. Is that close to what you intended?

What to do now? I suggest you learn Python, so you know what your code is actually doing :smiley: (especially if it is going to be responsible for money and your mother’s welfare). There are plenty of great Python tutorials out there (and equally plenty of bad ones); for you as an absolute beginner I’d suggest LearnPython.org.

Keep in mind that building a web application in Python, especially one that handles money and payments, is quite a complicated affair that requires knowledge of a variety of intersecting disciplines—Python programming for the backend, JavaScript for the frontend, HTML for the layout, CSS for the styling, REST/HTTP for working with APIs, basic principles of security, and likely a framework that runs on top of all of this.

As far as Python projects go, I at least would consider building a production web application that your mother is going to rely on for her livelihood to be a pretty advanced topic, one that will take a substantial amount of learning and effort to get to, and is not something you’re going to be able to learn in a few weeks. Furthermore, once you start dealing with money and transactions, that opens up a whole other dimension of potential legal and financial liability and problems should you make a mistake in your code.

Realistically, you and your mom are likely better off not re-inventing the wheel and instead using an existing ecommerce platform for this that is free to use or low cost—there may be specific platforms tailored for your region and market. Where even a beginning Python knowledge could help, though, is in the area of scripting rather than a full app—e.g. automating repetitive or routine tasks, specific interaction with services, etc.

Best of luck!

4 Likes

Hello,

if you are new to programming, and you wish to implement a functioning and secure web application for both marketing and point of sale, will be a herculean task. Why not adopt current tools already out on the market to speed things up with minimum effort.

Consider (the first is a point of sale (POS) application and the second is a website builder app):

There are others, but for simplicity and brevity, I have only added these two: Payment and website builder. The website builder is pretty easy to use. It is designed around a drag and drop ethos. They do have a free introductory offer. Worth looking into since time is of the essence.

You have the right motivation but you need to take a different approach.

If you want to help her by making a digital store, you can look into sites like Shopify to help her set up an e-commerce store.

However it looks like you’re trying to set up something with whatsapp. I don’t use Whatsapp for Business so I’m not sure if you can sell products directly from whatsapp but if you’re looking into setting up something like automated replies for customers approaching you on Whatsapp, you can look into this guide I found online.

https://medium.com/@aleksej.gudkov/python-script-to-send-whatsapp-messages-automatically-a-step-by-step-guide-1745075988c8