Whatsapp Api kullanarak müşteriye mesaj göndermek

ilk önce

üye oluyoruz.
NOT: Üyelik 3 günlüğüne ücretsizdir, kullanmaya devam etmek için ücretli üyelik satın alınmalıdır !

sonra
https://console.maytapi.com/

resimdeki gibi telefon ekliyoruz
sonra whatsapp dan sağ taraftaki qr okutuyoruz

sonra
https://console.maytapi.com/developers/token
token bilgileri alıyoruz

Sambapos Kısmı

Yönetim > Otomasyonlar > Komutlar
Yeni Komut

function send(id,tel){
var sablon = gql.Exec('query q {getTicketPrintContent(name: "Whatsapp Adisyon Şablonu" , width: 30 , id: '+id+')}');
var sablon = sablon.replace(/{"data":{"getTicketPrintContent":"/g,'').replace(/"}}/g,'')
var fis =  sablon.replace(/\\r\\n/g,'\\r\\n')
var string = fis;
var letters = { "İ": "I", "Ş": "S", "Ğ": "G", "Ü": "U", "Ö": "O", "Ç": "C", "ı":"i","ş":"s","ğ":"g","ü":"u","ö":"o","ç":"c" };
var string = string.replace(/(([İŞĞÜÇÖışğüöç]))/g, function(letter){ return letters[letter]; })
var datam = '{\"to_number\":\"90'+tel+'\",\"type\":\"text\",\"message\":\"'+string+'"}';
var url = 'https://api.maytapi.com/api/<productid>/<id>/sendMessage?token=<token>';
var data = web.PostJson(url,datam);
return data
}

Sonra Şablon ekleyelim
Yönetim > Yazdırma > Yazıcı şablonları
Yeni Şablon

[LAYOUT]
-- General layout

<L11>.
<C>*YILDIZHANPOS*
<L00>{TICKET DATE:dd.MMM.yyyy (ddd)} {TIME} 	No: {TICKET ID}

{ENTITIES}
[='{NOTE}' !='' ? '<L00>Not: {NOTE}':'']


<F>-
{ORDERS}
<F>=
<EB>
{DISCOUNTS}
[<J10>Toplam İkram:|{ORDER STATE TOTAL:İkram}]
{SERVICES}
<J10>*Toplam:*|*{TICKET TOTAL}*
{PAYMENTS}
<DB>
<F>=
<C10>T H A N K   Y O U


[="{TICKET TYPE}"=="Paket Servis"?"<L00>https://www.google.co.il/maps/dir/istanbul/{ENTITY DATA:Müşteriler:Adres}".replace(/ /g,'_'):""]



[DISCOUNTS]
<J00>{CALCULATION NAME} %{CALCULATION AMOUNT}|{CALCULATION TOTAL}

[SERVICES]
<J00>{CALCULATION NAME}|{CALCULATION TOTAL}

[PAYMENTS]
<J00>{PAYMENT NAME}|{PAYMENT AMOUNT}
[<L00>{DESCRIPTION}]

[ORDERS]
-- Default format for orders
<J00>- {QUANTITY} {NAME}|{TOTAL PRICE}
{ORDER TAGS}

[ORDERS:İkram]
-- Format for gifted orders
<J00>- {QUANTITY} {NAME}|**GIFT**
{ORDER TAGS}

[ORDERS:İade]
-- Nothing will print for void lines

[ORDER TAGS]
-- Format for order tags
<J00> * {ORDER TAG NAME} | {ORDER TAG PRICE}

[ENTITIES:Masa]
-- Table entity format
<L00>Masa: {ENTITY NAME}

[ENTITIES:Müşteri]
-- Customer entity format
<L00>*{ENTITY NAME}*  - *{ENTITY DATA:Telefon}*
[='{TICKET TAG:Adres}'!=''?'<L00>{TICKET TAG:Adres}':'<L00>{ENTITY DATA:Adres}{TICKET TAG:Kayıtlı Değil}']

[ENTITIES:Paketçi]
-- Table entity format
<L00>Paketçi: *{ENTITY NAME}*

2 Beğeni
function send(id,tel){
var sablon = gql.Exec('query q {getTicketPrintContent(name: "Ticket Template" , width: 30 , id: '+id+')}');
var sablon = sablon.replace(/{"data":{"getTicketPrintContent":"/g,'').replace(/"}}/g,'')
var fis =  sablon.replace(/\\r\\n/g,'\\r\\n')
var productid = '***';
var token = '***';
var mobilid = '***';
var kod = '90'; // phone country code
var datam = '{\"to_number\":\"'+kod+''+tel+'\",\"type\":\"text\",\"message\":\"'+fis+'"}';
var url = 'https://api.maytapi.com/api/'+productid+'/'+mobilid+'/sendMessage?token='+token+'';
var data = web.PostJson(url,datam);
return data
}

function days(){
var d = new Date(); var time = d.getHours()

     if (time>=5  && time<10) {return "Good morning";} 
else if (time>=10 && time<16) {return "Have a nice day";} 
else if (time>=16 && time<22) {return "Good evening";} 
else                          {return "Goodnight";}
}

function havaDurumu(){
var apikey =  '****';
var url    =  'http://api.openweathermap.org/data/2.5/weather/?appid='+apikey+'&id=5134086&units=metric';
var f      =  web.Download(url); 
var g      =  JSON.parse(f);
var map    =  {'heat':g.main.temp+" C",'humid': g.main.humidity+" %",'press': g.main.pressure+" cmHg",'state':g.weather[0].description};
return        map['heat']+'  '+map['state']
}




english

[LAYOUT]
-- General layout

<L00>{CALL:wp.days()}. Your order has been received.
<L00>{DATE:dddd}  {CALL:wp.havaDurumu()} 
<L00>     We wish you good health.

<C> YILDIZHANPOS 
<C00>{TICKET TYPE}
<J00>Date:{TICKET DATE}|Time:{TIME}
{ENTITIES}
<J00>Ticket No:{TICKET NO}

<F>-
{ORDERS}
<F>=
<EB>
{DISCOUNTS}
[<J10>Total Gift:|{ORDER STATE TOTAL:Gift}]
{SERVICES}
<J10>Total:|{TICKET TOTAL}
{PAYMENTS}
<DB>
<F>=
<C10>T H A N K   Y O U

[DISCOUNTS]
<J00>{CALCULATION NAME} %{CALCULATION AMOUNT}|{CALCULATION TOTAL}

[SERVICES]
<J00>{CALCULATION NAME}|{CALCULATION TOTAL}

[PAYMENTS]
<J00>{PAYMENT NAME}|{PAYMENT AMOUNT}

[ORDERS]
-- Default format for orders
<J00>- {QUANTITY} {NAME}|{TOTAL PRICE}
{ORDER TAGS}

[ORDERS:Gift]
-- Format for gifted orders
<J00>- {QUANTITY} {NAME}|**GIFT**
{ORDER TAGS}

[ORDERS:Void]
-- Nothing will print for void lines

[ORDER TAGS]
-- Format for order tags
<J00> * {ORDER TAG NAME} | {ORDER TAG PRICE}

[ENTITIES:Table]
-- Table entity format
<L00>Table: {ENTITY NAME}

[ENTITIES:Customer]
-- Customer entity format
<L00>{ENTITY NAME} - {ENTITY DATA:Phone}
<L00>{ENTITY DATA:Address}

image

Сurrent weather and forecast - OpenWeatherMap