There are several message status after send message.

Every device will have their own package.

A package cannot be shared over several devices.

The package cannot be upgraded or downgraded.

A month will be count by 30 days, a year 360 days.

Your current package will be terminated if you want to upgrade or downgrade the package.

Fortunatelly, if you subscribe with the same package, your quota and expiration will be extended and added.

For example :

case 1.

Your device currently have free package with 900 quota left and expired in 20 days.

You are willing to upgrade to regular package.

Your quota will be 10.000 and expired in 30 days start from today.

The remain quota of 900 and expiration time will be terminated.

case 2.

Your device currently have regular package with 5000 quota left and expired in 10 days.

You are willing subscribe regular package again.

Your quota will be 15.000 and expired in 30 days start from expiration date, to be exact 40 days (30+10) from today.

The remain quota of 5000 and expiration time will be added.

This rules applies for all packages.

There is a limitation on how you are send and receive an attachment.

Limitation

Image"png", "jpg", "jpeg", "webp"
Video"mp4"
File"pdf", "doc", "docx", "xls", "xlsx", "csv", "txt"
Audio"mp3"
Max size10MB

If you try sending attachment outside this file limitation rules, your API will return false.

For every attachment outside this file limitation rules sent to your device while using fonnte will not be sent to your webhook or forward attachment target.

Before you can send message to whatsapp group, you have to know which group to send.

To get all the group you are in, there are 2 steps to do.

First, update all of your group list.

Then, get all of your groups id list and use them as target.

Update whatsapp group list

This API is used to update all of your groups.

This API should called only once : when you are joining new group or never call this API yet.

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.fonnte.com/fetch-group',
  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_HTTPHEADER => array(
    'Authorization: TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Read more about API update whatsapp group.

Then you can use API get whatsapp group to get all the group id.

Get whatsapp group list

This API will give you a list of all updated whatsapp group as previously updated using API update whatsapp group list.

This API will return nothing if you have never update the whatsapp group

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.fonnte.com/get-whatsapp-group',
  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_HTTPHEADER => array(
    'Authorization: TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

You can now get the id and the group name.

The group id will be used as target in the send message API.

The update mainly focused on working on whatsapp group to be able to send and reply plus additional preparation to read and send location with bug fixes

Add whatsapp group support (beta)

We are now proudly supporting send and reply message to whatsapp group.

But since we are not using whatsapp group so often, we may not knowing of exactly how it work and this feature is still labeled as beta.

If you somehow found a bug, please let us know.

This group is supported on send menu, autoreply menu, API, and webhook.

The video below is how to send message to whatsapp group using fonnte's send menu.

Add import and export contacts

We are adding feature to add via import and supporting export contacts as it's always your data, not ours.

This button available on contact menu

Add status and time on invoices menu

Additional information is added to invoices menu for easier read.

Add package information

Since not everyone know about fonnte's pricing, we are adding information on order popup

Bugs and fixes

fix variable on button not working

fix country code & timestamp on setting/profile page

fix export webhook message as it is, not lowercased

fix contact list not show up on send menu

fix edit autoreply popup style

preparation : send location

This API will Get all of your whatsapp group which previously updated.

If API update whatsapp group list had never been called, this API will always return false.

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.fonnte.com/get-whatsapp-group',
  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_HTTPHEADER => array(
    'Authorization: TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

If you prefer to see on postman, see here.

TOKEN must be filled by your own token. See how to get token.

Response

Successfull response

{ 
    "data": [
        {
            "id": "xxx@g.us",
            "name": "Group name 1"
        },
        {
            "id": "xxx-xxx@g.us",
            "name": "Group name 2"
        },
        {
            "id": "xxx@g.us",
            "name": "Group name 3"
        }
    ],
    "status": true
}

- Token invalid : token is not valid

{
    "detail": "token invalid",
    "status": false
}

- Failed to get whatsapp group : There is something wrong with the group data.

{
    "detail": "failed to get whatsapp group",
    "status": false
}

- You have no whatsapp group yet : Either you have never call API update whatsapp group list or you actually haven't join any group yet

{
    "detail": "you have no whatsapp group yet",
    "status": false
}

This API will update all of your joined whatsapp group whether you are admin or not.

This API should called only once : when you are joining new group or never call this API yet.

Abusing this API may lead to whatsapp number ban.

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.fonnte.com/fetch-group',
  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_HTTPHEADER => array(
    'Authorization: TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

If you prefer to see on postman, see here.

TOKEN must be filled by your own token. See how to get token.

Response

Successfull response

{
    "detail": "update whatsapp group list finished",
    "status": true
}

- Token invalid : token is not valid

{
    "detail": "token invalid",
    "status": false
}

- Cannot fetch with disconnected device : Your device is disconnected, connect your device before proceed

{
    "detail": "cannot fetch with disconnected device",
    "status": false
}

- Failed to fetch whatsapp group list : There is something wrong with your whatsapp number or the server is in trouble.

{
    "detail": "failed to fetch whatsapp group list",
    "status": false
}

- Failed to update : There is something wrong, most likely fonnte's fault. please contact admin for further investigation

{
    "detail": "failed to update",
    "status": false
}

The update is mainly focused on better user experience and add several mini features and ofcourse, bug fixes.

Add status read/delivered/sent on send message

When sending a message, you might want to know whether

  1. Your message is already read by recipient
  2. Just delivered but haven't read yet
  3. The recipient's whatsapp is not active at the moment.

Add name on autoreply

You can now call the name of the recipient directly using variable {name}.

Delete account & device

You can now delete your account and your device if not needed.

You will receive an OTP to confirm you want to delete it.

Add notification

We are adding more notification to disconnected device while having pending messages and webhook failure.

If you have pending messages and somehow your device disconnected, the messages will be in pending state.

these messages will be sent when your device is connected to fonnte.

So if you have pending messages, we will notify you every 4 hours or you can delete all pending in the message history.

And you will get notification whenever you webhook is unreachable for whatever reason.

Bugs fixes

fix broken download link history

fix multiple keyword autoreply button doesn't replying

fix empty response on button default reply

fix non default button replying with default button

fix case sensitive button autoreply

fix incorrect device's name on invoice

optimize autoreply logic

optimize send media message

update history, report, API message status

A static chatbot is helpful for a questioning user who just want a piece of information.

But for a dynamic information, fonnte's dashboard cannot help you further.

Then, this is where our webhook shine!

You can get all information you need from your own database with webhook.

This tutorial require you to understand basic programing language mainly PHP. If you don't have any experience or don't know what to do, please consider hire a developer.

Special note : any autoreply feature won't work if you are using webhook.

Prerequisite

Before you can use this webhook, you need to make an account, login and create a device.

Copy the token as API key to be used on webhook.

Then, connect your device first before you can proceed to send a message.

Please use most recent curl with php version of 7.1++ as requirement.

Webhook code

So making whatsapp chatbot using fonnte's webhook will enable you to use your own database data.

Don't worry, we cannot access your database.

Everyting is coded in your own server.

The only thing we need is your file url.

First, copy this code

<?php
header('Content-Type: application/json; charset=utf-8');

$json = file_get_contents('php://input');
$data = json_decode($json, true);
$device = $data['device'];
$sender = $data['sender'];
$message = $data['message'];
$member= $data['member']; //group member who send the message
$name = $data['name'];
$location = $data['location'];
//data below will only received by device with all feature package
//start
$url =  $data['url'];
$filename =  $data['filename'];
$extension=  $data['extension'];
//end

function sendFonnte($target, $data) {
	$curl = curl_init();

	curl_setopt_array($curl, array(
	  CURLOPT_URL => "https://api.fonnte.com/send",
	  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(
	    	'target' => $target,
	    	'message' => $data['message'],
	    	'url' => $data['url'],
	    	'filename' => $data['filename'],
	    ),
	  CURLOPT_HTTPHEADER => array(
	    "Authorization: TOKEN"
	  ),
	));

	$response = curl_exec($curl);

	curl_close($curl);

	return $response;
}

if ( $message == "test" ) {
	$reply = [
		"message" => "working great!",
	];
} elseif ( $message == "image" ) {
	$reply = [
		"message" => "image message",
		"url" => "https://filesamples.com/samples/image/jpg/sample_640%C3%97426.jpg",
	];
} elseif ( $message == "audio" ) {
	$reply = [
	        "message" => "audio message",
		"url" => "https://filesamples.com/samples/audio/mp3/sample3.mp3",
		"filename" => "music",
	];
} elseif ( $message == "video" ) {
	$reply = [
		"message" => "video message",
		"url" => "https://filesamples.com/samples/video/mp4/sample_640x360.mp4",
	];
} elseif ( $message == "file" ) {
	$reply = [
		"message" => "file message",
		"url" => "https://filesamples.com/samples/document/docx/sample3.docx",
		"filename" => "document",
	];
} else {
	$reply = [
		"message" => "Sorry, i don't understand. Please use one of the following keyword :
		    
Hello
Audio
Video
Image
File",
];
}

sendFonnte($sender, $reply);

Function sendFonnte can use any API parameter available on fonnte's API.

You can get the data from database and set as reply message.

Second, save this code and input the file absolute public url to the webhook input.

Example : https://fonnte.com/urlwebhook.php

It's located in menu device->edit.

The last and the most important part is to set autoread to on.

It's located below webhook input.

That's all, your whatsapp bot is now ready to reply with dynamic data.

In a business process, making a customer wait means possible leads are missing.

Sometime the customer just want to know about FAQ and they are too lazy to read on the web.

It's more convenient to ask than to read.

So, making a whatsapp chat bot is vital for your business.

Fonnte provide a way to create whatsapp bot easily.

Autoreply

Every device can be set to be a chatbot.

You need to set autoread to on on device menu->edit.

Fonnte provide a menu to create this bot.

You can access this menu by login to fonnte.

Go to autoreply menu, then you'll see this form

You can make several incoming chat terms on message field.

The response can be just a text, text with file or an interactive buttons.

That's all!

Learn more about this autoreply and button.

Conclusion

With this feature, you can make a static chatbot.

The best usage for this feature is to serve static information like FAQ.

If somehow you want to make a more dynamic whatsapp bot, you can use our other feature, it's called webhook.

We will cover how to create dynamic whatsapp bot in the next tutorial.

Made with in Indonesia