API Send message with javascript

You can send fonnte using API with javascript native fetch.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        (async () => {
            const data = new FormData()
            data.append("target", "082227097005")
            data.append("message", "kirim dari js")
            data.append("url", "https://md.fonnte.com/images/wa-logo.png")
            data.append("filename", "filename.pdf")
            data.append("schedule", "0")
            data.append("delay", "2")
            data.append("countryCode", "62")
            data.append("buttonJSON", '{"message":"fonnte button message","footer":"fonnte footer message","buttons":[{"id":"mybutton1","message":"hello fonnte"},{"id":"mybutton2","message":"fonnte pricing"},{"id":"mybutton3","message":"tutorial fonnte"}]}')
            data.append("templateJSON", '{"message":"fonnte template message","footer":"fonnte footer message","buttons":[{"message":"fonnte","url":"https://fonnte.com"},{"message":"call me","tel":"6282227097005"},{"id":"mybutton1","message":"hello fonnte"}]}')
            data.append("listJSON", '{"message":"fonnte list message","footer":"fonnte footer message","buttonTitle":"fonnte\'s packages","title":"fonnte title","buttons":[{"title":"text only","list":[{"message":"regular","footer":"10k messsages/month","id":"list-1"},{"message":"regular pro","footer":"25k messsages/month","id":"list-2"},{"message":"master","footer":"unlimited messsages/month","id":"list-3"}]},{"title":"all feature","list":[{"message":"super","footer":"10k messsages/month","id":"list-4"},{"message":"advanced","footer":"25k messsages/month","id":"list-5"},{"message":"ultra","footer":"unlimited messsages/month","id":"list-6"}]}]}')

            const response = await fetch("https://api.fonnte.com/send", {
                method: "POST",
                mode: "cors",
                headers: new Headers({
                    Authorization: "TOKEN",
                }),
                body: data,
            });

            const res = await response.json();
            document.write(JSON.stringify(res))
        })()
    </script>
</body>

</html>

You can use any php version API data with javascript.

Related knowledge

See more
Made with in Indonesia