farmbank's Introduction
farmbank's People
Forkers
gadderzfarmbank'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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.