Fonnte provide selfhosted version for whatsapp API so you can send and reply whatsapp message from your own server.

Why selfhosted?

a portion of our users really concern about privacy and security. some doesn't even want fonnte to store anything including send history, request, etc even if this is for their own benefit.

to make sure the data is circulated inside of user's server only, we make this "lite version" of fonnte to be installed.

so you can have your whatsapp data only on your server.

Files

You will get these files :

Limitation

This selfhosted version is not fonnte.

it's written from scratch to be used especially for internal usage.

Built for

Limitation

Solution

Requirement

to run this selfhosted version, you will need :

  1. VPS/Dedicated server
  2. Ubuntu v18.04++
  3. NodeJS v20++
  4. Ubuntu user with sudo previlege
  5. ipV4
  6. MariaDB or MYSQL (LTS prefered)
  7. Reserve port 3434 & 3435

for internal usage, webserver is optional. but i recommend to have one.

Installation

First of all, you will need to create 2 app, 1 for server the other 1 for admin page.

the admin page is optional though, you can just install the server if you just need to use API and webhook.

as i am using runcloud for panel, i will use it for this installation tutorial.

you can use any panel or no panel at all as long as port 3434 and 3435 available.

Database Setup

fonnte selfhost only support mysql as database.

you can use mysql or mariadb.

create your database user, database name and password.

this is required to run the server.

Server Installation

Put fonnte file in the folder you want it to run.

set permission to 770 so the file can be executed.

without proper permission, the file will not found even if it's there.

then paste this code in the cli and run.

install :

sudo ./fonnte && nano .env && sudo ./fonnte && journalctl -fu fonnte-selfhost.service -o cat

you will need to update database connection credentials

then you can press ctrl+s to save and ctrl+x to exit.

wait for installation to complete and the server will run.

restart :

systemctl restart fonnte-selfhost.service && journalctl -fu fonnte-selfhost.service -o cat

Admin installation

for admin installation, you can upload the zip file the unzip it.

separated app folder is highly recommended for cleaner environment.

then you can unzip it and move the content to the folder.

Testing

you can open the admin url in the browser and run.

the default value for both user and password is admin.

you can change it in the env.php

you can try connect your device, send message and reply message.

Custom request

We also offer custom request to be tailored as you need at custom price.

but we mainly focus on the server customization.

Conclusion

This is a short guide for fonnte selfhost solution.

if you need any asistance, you can ask admin fonnte.

Notification on login

Kamu akan menerima notifikasi setiap kali login.

Jadi kamu tahu jika ada yang berhasil login ke akun kamu.

Kami menambah fitur ini utamanya untuk alasan keamanan data karena di menu message history dan inbox menampilkan riwayat pesan yang dikirim/diterima.

pesan ini bisa bersifat rahasia seperti OTP/password atau hal pribadi lainnya.

Jika yang login bukan kamu, segera hubungi kami.

Otp on login

Kami menambah opsi untuk login dengan OTP.

fitur ini menambah keamanan dashboard fonnte.

tanpa OTP, kamu tidak bisa login.

Jadi pastikan whatsapp kamu selalu aktif untuk menerima OTP.

kamu bisa mengubah nomor whatsapp di menu setting->whatsapp

Quota on response

Kami mengerti bahwa beberapa developer membuat dashboard sendiri untuk manage fonnte dari dashboard mereka.

beberapa developer mengalami kendala dimana mereka perlu beulang2 mengecek sisa kuota sebelum melakukan aksi.

Karena API device profile ini terbatas, kami menambahkan informasi kuota di setiap pengiriman pesan.

Memang penambahan kecil, tapi akan berguna untuk yang memerlukannya.

Enhance flow

Flow mendapatkan fitur lagi yang berfokus di fitur global.

Global ini dijalankan setiap ada pesan masuk.

Ini sangat berguna untuk membuat rules tersendiri, seperti menambah delay sebelum merespon.

Tentu hal ini bisa dilakukan dengan menambah satu per satu. tapi akan lebih mudah dengan fitur global karena hanya sekali setting.

Fix : autoreply inboxid

Ada bug yang membuat autoreply tidak bekerja karena kesalahan di kode terkait inboxid.

bug ini sudah di fix

Notification on login

Everytime you login, you'll receive a notification.

you can know if someone successfully login to your account.

if it's not you, you must reach us immediately.

we are adding this feature for more security mainly due to message history and inbox is displayed in the dashboard.

some have credentials like OTP or password or else which no one should look onto it but you.

Otp on login

We are adding option to use OTP to login.

this feature adding another layer for fonnte's security.

without OTP, you cannot login.

please make sure your whatsapp number is always active.

you can change your whatsapp number on setting->whatsapp.

Quota on response

We are aware that some developers create their own dashboard to manage fonnte.

some face challenges that they need to repeatedly check the quota before proceeding some action.

while API device profile is limited, we are adding quota on every usage.

this is a little addition, but should helpful for those who need it.

Enhance flow

Flow gaining more feature that focused on global feature.

global feature will be fired everytime the bot got a response.

this is beneficial for making set of rules, like adding delay before responding.

it is indeed can be done by adding one by one, but having global setting is very handy.

Fix : autoreply inboxid

There is a bug that autoreply won't reply due to faulty in our code regarding inboxid. this bug has been fixed

We are adding more features in this early february 2025.

the focus of this update is to add more features and more optimization.

TL;DR

more features and optimization :

  1. secret key webhook : enable secret key in webhook data
  2. search message history by id : add search filter in message history
  3. Delete processing message : delete history now also delete processing message
  4. Additional response API send : additional requestid on response
  5. inbox : inbox feature on demand
  6. quote message on webhook : add ability to quote message when replying using webhook
  7. Optimize incoming message : disable read message on demand
  8. Deposit : deposit system is available
  9. Autoconfirm : order using deposit allow to autoconfirm
  10. API order : allow order to do using API
  11. Fix : corrupted file on download

Secret key webhook

Webhook are now can use secret key for additional data to verify it's coming from fonnte

Screenshot 573

search by id message history

you can now search message by it's id.

it's useful when looking for specific message data.

this is developed for inbox support.

Screenshot 574

Delete processing history

When deleting message that is already on process, the processed message cannot be cancelled.

now you can cancel it by deleting it from message history.

for example : you are sending 5 messages with delay 10 seconds. then you realize there is an error in the message. previously, you cannot cancel it. but now, by deleting it from message history, it will not processed anymore.

requestid on response

As fonnte's user growing, There are a more users who use API send complaining about their request is invalid/not exactly as their requested.

but when fonnte ask what is their request, they are not storing their request so it can easily be one side blame "it's fonnte's fault" instead of figuring out together which request data should be adjusted.

so we are taking initiative to help logging the request, so we can both examine the request and response together to create more win win solution environment and ultmately can assist user better.

the request id is exist in every API send response whether it fail or success.

Optimize Incoming

Previously, we are processing all incoming message for user who activate autoread to on.

this task, can take many spaces and computational power as whatsapp grow with many new data.

we are now limiting what to process and not, so we can reduce our server usage and lead to better performance.

Inbox

fonnte will store incoming message on demand.

you can enable it by activating autoread and inbox in the device->edit menu.

Screenshot 575

Webhook quote

When using webhook, we cannot quote the chat we are replying to.

now there is additional data named inboxid.

when activate inbox, webhook will also have inboxid to be used as quote data.

so on reply, you just need to add inboxid in the API send.

Deposit system

Fonnte use BCA scrapper to autoconfirm payment.

but lately, the scrapper got more and more not reliable.

some order have been paid but not processed until it changed to failed.

so we take another approach (since we still not deciding to use payment gateway yet), we add deposit.

this is more likely not to be used by most of users, because the nature of deposit : you are paying upfront to be used later, while fonnte also having custom duration order.

so most of users are not expected to use deposit.

then, who are using deposit?

we are introducing API order together with this deposit system and autoconfirm system.

this is more likely to be used as autoconfirm payment for business to integrate seamless and easily with fonnte, together with device management API.

Autoconfirm

Autoconfirm is used to autoconfirm the order when you make an order to fonnte and choose to use deposit.

this way, you can right away activate your order without waiting for BCA scrapper or manual process.

this is most beneficial for business.

API order

API order is now available to be used to make an order right from your own system.

to use API order, you need to have deposit in your account.

without it, your order will always failed as order through API order will be autoconfirmed.

see API order documentation or go to postman.

Fix download attachment

When downloading an attachment, sometime the file is corrupted.

especially if the file is large enough.

we fix this and the attachment should now correctly downloaded.

You can now order fonnte's package right from your application.

this way, device API is now fully usage in your own application.

see it on postman.

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
 CURLOPT_URL => 'https://api.fonnte.com/order',
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => '',
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 0,
 CURLOPT_FOLLOWLOCATION => true,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => 'POST',
 CURLOPT_POSTFIELDS => array('plan' => 1,'duration' => 1,'duration-value' => 1,'ai-quota' => 500,'ai-data' => 0),
 CURLOPT_HTTPHEADER => array(
 'Authorization: TOKEN'
 ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Available parameter

note :

We once provide inbox until 2021 we got some complaint and decided to close the inbox feature.

this inbox is just collection of incoming message.

but several user use their personal number to connect to fonnte, so some private chats are stored.

while fonnte do not use it for anything but process the message, some users are not satisfied.

so we close this at that time.

begining 2023-2024, as fonnte's user grow significantly, the inbox feature request is on demand.

we still lock in our previous decision to not enable it and suggest using webhook instead.

many of our user is not familiar with coding.

so we had a fight for the decision of opening it or not.

we come to conclusion that we will rebuilt our inbox feature along with ability to reply.

but in one condition, the user is allowing the incoming messages to be stored.

so we are not without consent storing all incoming messages.

Screenshot 575

Logic is category that allow you to create logic for your flow.

currently we have condition and store logic.

Condition

you can make condition for the flow.

if a condition is met, should go to item A.

if not met, should go to item B.

Screenshot 568

Store

Store is used to store any last response or API response to a variable you can use later.

store can store message, name, sender and url.

Screenshot 570

Response is used to wait for user's response.

the flow will stop whenever hit response.

on user response, the flow will then continue

Message is a type of the message to be sent to reply incoming message.

currently we have 3 items under message category.

Text

Text is used to reply using simple text only message.

Screenshot 560

you can type the text message to response.

Media

Media is used to send attachment with or without caption.

but there is no upload feature, you need to provide your own file.

Screenshot 565

AI

AI is used to reply the message using AI using your own data.

You can get more info about it in the docs about AI

By default, flow will behave as following:

No initiative

flow is designed to reply, not to send message first.

therefore, you can only reply incoming message

Start is the beginning

every items in flow will start from "start".

this is fresh starting point when the user is considered new to chat with.

if no arrow line coming from "start", flow will not working.

Single flow

Every item can only have one arrow line.

Item cannot be connected to multiple items.

No circular

Items cannot go back to where it is coming from in a single trip.

Screenshot 563

But you can add more items and go back to it if needed.

Screenshot 564

this way, it won't be single trip and can be done.

No delay

By default, flow will automatically send as soon as requested.

there is no delay on the flow.

Made with in Indonesia