Giter VIP home page Giter VIP logo

farmbank's Introduction

FarmBank

farmbank's People

Contributors

gpedroxd avatar gadderz avatar

Watchers

 avatar

Forkers

gadderz

farmbank's Issues

implement webhook for whatsapp bot

Problem

it is necessary to implement the reception of wpp webhook and api and process according to the command used in the chat. For now, all you need is the command to register with the bot (!In).
When using the !in command, you must check the name and telephone number of the person who sent the command and insert it into the database if that person is not yet registered

Only Little Farm group's message should be checked, any other sender should be ignored.

you should use the following message template for webhook(you can also see this json at /src folder):

{
"type": "message",
"body": {
"key": {
"remoteJid": "[email protected]",
"fromMe": false,
"id": "3AF48D7E1E0FF8195409",
"participant": "[email protected]"
},
"messageTimestamp": 1697159707,
"pushName": "Vinicius",
"broadcast": false,
"message": {
"conversation": "falancorno",
"senderKeyDistributionMessage": {
"groupId": "[email protected]",
"axolotlSenderKeyDistributionMessage": "MwiK+/6sBhACGiBGfuB8T9BbclgRLm0uVuVMbAI7O8fH+wK5Bc2SIkIYUCIhBZLjvsilWyyoS10UR6pV9PtDhWGfV0bcEdbq4B7QRO92"
},
"messageContextInfo": {
"deviceListMetadata": {
"senderKeyHash": "/Etu4255Z4qTXQ==",
"senderTimestamp": "1696286095",
"recipientKeyHash": "3FmNC8uEz5OMsg==",
"recipientTimestamp": "1697088112"
},
"deviceListMetadataVersion": 2
}
},
"text": {
"messages": [
{
"key": {
"remoteJid": "[email protected]",
"fromMe": false,
"id": "3AF48D7E1E0FF8195409",
"participant": "[email protected]"
},
"messageTimestamp": 1697159707,
"pushName": "Vinicius",
"broadcast": false,
"message": {
"conversation": "falancorno",
"senderKeyDistributionMessage": {
"groupId": "[email protected]",
"axolotlSenderKeyDistributionMessage": "MwiK+/6sBhACGiBGfuB8T9BbclgRLm0uVuVMbAI7O8fH+wK5Bc2SIkIYUCIhBZLjvsilWyyoS10UR6pV9PtDhWGfV0bcEdbq4B7QRO92"
},
"messageContextInfo": {
"deviceListMetadata": {
"senderKeyHash": "/Etu4255Z4qTXQ==",
"senderTimestamp": "1696286095",
"recipientKeyHash": "3FmNC8uEz5OMsg==",
"recipientTimestamp": "1697088112"
},
"deviceListMetadataVersion": 2
}
}
}
],
"type": "notify"
}
},
"instanceKey": "123"
}

adapt message sending to be generic

Problem

Currently, sending a message is linked only to sending a deposit message. It is necessary to make the message sending command generic for any type of message.

One piece of advice is to use an abstract class to represent the message and a class for each type of message that is to be sent.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.