You can add template message to be used for sending message later.

This is a good way to send message to contacts with variable.

You can create template by filling name of the template and the message.

Using variable is recommended

You can download the attachment sent to your device using webhook.

This function will only working on device with all feature package.

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

<?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'];
$text= $data['text']; //button text
$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'];
//save the file
if($url){
file_put_contents("fonnte-file.$extension", file_get_contents($url));
}
//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);

If your attachment have message with it, you can find it in the $message.

The attachment will be downloaded and saved in the same path as your webhook url.

To save somewhere else, determine the path where the attachment should be saved.

Note: The attachment will follow file limitation rules. if you are receiving an attachment outside file limitation rules, you will not receive it on your webhook.

Is located in the top right and used to manage your name, WhatsApp number for notification (not necessarily to connect), and your password.

Every system notification (device disconnect, quota limit, any information about fonnte's services) will be sent to this number.

You can create a bot using this menu.

When a user texts your connected device, your connected device will reply as the rule you made.

Note: you have to set auto read to On on the device you wish on. (see menu device->edit)

There are several inputs to fill

After you create autoreply template, your template will be added to autoreply list.

You can edit or delete any of autoreply message template you've created.

You can send messages using this menu.

To use this menu, you have to connect your device first.

First of all, this form support many configurations, so it looks like confusing at first time.

Don't worry, the fields will be breaking down one by one .

Device

This field will show all of your connected device. Make sure you are choosing the right one.

Disconnected device will not be shown

Select Target

This field is a choice of how will you input the target.

By default, the field will choose input, it means you have to manually input the target.

Then you can input your target.

If you ever need to send to more than 1 target, separate every target with a new line / enter.

This field also support variable. use | for adding variable

Example :

081xxxxxxx|Fonnte|Indonesia

This will produce variable {name} and {var1} that you can use on message field.

Second, select target from contact.

This way, you can send to contacts you saved on contact menu.

Third, you can choose to send to a group of contacts you create on contact menu.

It's easier to send to many contacts under a group.

Country

This field is used to replace first zero with country code. (optional)

For example, in Indonesia, most people use 081xxxxxx, then fonnte will replace contact to 6281xxxxx.

ofcourse you can ignore it and write full number with country code.

Delay

This field is used to delay sending message if there is more than 1 contacts.

By default, it's 5 seconds to send between them.

File

This field is used to upload media to be sent with/without message context.

Only package with media support can send media.

Consider file limitation rules when sending an attachment.

Schedule

This field is used when you want to send message later.

You can set the sending time with this field.

Message Source

This field is used to choose how will you send message.

You can choose manually input or using a template.

By default, this field will choose input.

With this, you can manually input the message.

You can also use variable in the message.

If you choose template, you can use any template you've created in template menu.

Send

This field is used to choose between send once of repeating over a period of time.

By default, this field choose once.

If you choose to send every period of time, you can choose the period you've created on recurring menu.

With this, the message will be send every period of time.

This page is about your requested messages.

You can see all your message status and history here.

Read more about message status.

The list will show 100 messages.

You can filter your message history by time and status.

The download button will download your last month messages.

if for any reason you want to resend the message, there is a button to resend the message.

This menu is used to add contact and group them.

Contact

You can add contact to be used later or group them in a group

You can add your contacts, separate by a new line.

Example :

0822xxxxxx
0895xxxxxx

This input will save 2 contacts

You can also add variable(s) to each contact.

Currently, fonnte supports unlimited variable.

First variable will be the name of the contact.

Example :

This will be saved as :

081xxxxxxx
name : Fonnte
var1 : Indonesia

082xxxxxxx
name : Fonnte
var1 : Indonesia

These variables can be used for sending messages using {name},{var1},{var2} and so on

if you have created at least one group, you can put uploaded contact(s) to the group.

Once you save the contact, it will show on contact list.

You can edit or delete it.

A popup will show up when you click edit.

You can edit number, name, add or remove from group and set variable.

Variables should separate with a new line/enter.

Group

You can create a group to group your contacts for send message to these contacts later.

After successfull creating a group, the group will we added to group list.

To add contact(s) to an existing group, you can click edit on a group and add the contact.

This may be a convenient way for sending messages in the future.

This menu provides information about your device.

Device highlight

Device highlight section provide quick information about your device

Then on device menu, you can see all of your devices

As you can see on the image above, there are 3 parts you can use

Add Device

On the top right of the image, There is a button to add device.

Click this button and fill the form.

Filter Button

The second thing is filter button. These buttons are not actually benefit you if you have few devices. There are 5 buttons to filter your device

Device List

The last part is device list. all your device will be listed here.

When you click order, this popup will show up

you can choose any package available and choose whether monthly or annually.

When you click edit, this popup will show up

You can edit the name, webhook and autoread setting.

This page contain latest information and tutorials.

Every new information will show here

You can reset your password here.

You will get your new password by whatsapp message.

Made with in Indonesia