Integración con WhatsApp
Moderator: Rathinagiri
- mjaviergutierrez
- Posts: 160
- Joined: Fri Nov 30, 2012 7:51 pm
- DBs Used: DBF
- Location: San Lorenzo, Santa Fe, Argentina
Integración con WhatsApp
Hola !
Estuve investigando en Post anteriores, sobre la posibilidad de integran mi programa con WhatsApp, puntualmente enviar un documento (factura en PDF), pero NO encuentro nada claro. Alguien tendrá alguna info si existe esta posibilidad ?
Saludos.
Estuve investigando en Post anteriores, sobre la posibilidad de integran mi programa con WhatsApp, puntualmente enviar un documento (factura en PDF), pero NO encuentro nada claro. Alguien tendrá alguna info si existe esta posibilidad ?
Saludos.
...
- serge_girard
- Posts: 3348
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Integración con WhatsApp
Paid option perhaps?
WhatsApp Business API + cURL
Serge
WhatsApp Business API + cURL
Serge
There's nothing you can do that can't be done...
- mjaviergutierrez
- Posts: 160
- Joined: Fri Nov 30, 2012 7:51 pm
- DBs Used: DBF
- Location: San Lorenzo, Santa Fe, Argentina
Re: Integración con WhatsApp
Hi MJ, I use HpdfPrint which you can use the same as print. you can also add .jpg pictures
I prints to file
#include <hmg_hpdf.ch>
set HpdfDoc Encoding to "WinAnsiEncoding"
set printer to your invoice number +".pdf" to print to file for emailing.
@10,20 HpdPrint Customer->Name size 10
Give it a try. I think everything you need is here.
Sorry
This may not work but has some good ideas I will get back with proper code.
I prints to file
#include <hmg_hpdf.ch>
set HpdfDoc Encoding to "WinAnsiEncoding"
set printer to your invoice number +".pdf" to print to file for emailing.
@10,20 HpdPrint Customer->Name size 10
Give it a try. I think everything you need is here.
Sorry
This may not work but has some good ideas I will get back with proper code.
All The Best,
Franco
Canada
Franco
Canada
Re: Integración con WhatsApp
I found this in SAMPLES
You can use a printer instead of file. File is pdf for emailing or printing.
You can use a printer instead of file. File is pdf for emailing or printing.
Code: Select all
#include "hmg.ch"
Function Main()
SELECT HPDFDOC "sample.pdf" PAPERLENGTH 300 PAPERWIDTH 300 LOG
START HPDFDOC
START HPDFPAGE
SET HPDFDOC ENCODING TO "WinAnsiEncoding"
@ 10,20 HPDFPRINT "I want Euro sign here: "+CHR(128)
@ 20,20 HPDFPRINT "I want this STRIKEOUT (not working)" STRIKEOUT
@ 18,67 HPDFPRINT "_________" // COLOR { 51, 255, 255 }
@ 20,92 HPDFPRINT "<---- This line was drawing to simulate a baseline (made manually)" SIZE 9 COLOR { 0, 0, 255 }
@ 30,20 HPDFPRINT "I want this italic" ITALIC
@ 40,20 HPDFPRINT "I want this bold" BOLD
@ 50,20 HPDFPRINT "I want this UNDERLINE (not working)" UNDERLINE
@ 50,67 HPDFPRINT "_________" // COLOR { 255, 0, 0 }
@ 52,92 HPDFPRINT "<---- This line was drawing to simulate a baseline (made manually)" SIZE 9 COLOR { 0, 0, 255 }
@ 60,20 HPDFPRINT "I have HMG 3.2.1 (stable) in Courier-Bold" FONT "Courier-Bold"
@ 80, 10 HPDFPRINT "This is a sample Text in default font in ITALIC." ITALIC
@ 90, 10 HPDFPRINT "This is a sample Text in default font in BOLD." BOLD
@ 100, 10 HPDFPRINT "This is a sample Text in Arial or Helvetica font in ITALIC." FONT "aRIAL" SIZE 14 ITALIC
@ 110, 10 HPDFPRINT "This is a sample Text in Arial or Helvetica font in BOLD and ITALIC." FONT "aRIAL" SIZE 14 BOLD ITALIC
*@ 120, 10 hpdfprint image 'img.jpg' TYPE JPG width 40 height 40' size 10 // (((YOU CAN USE IF YOU HAVE A .JPG PICTURE.)))
* @ 120, 10 HPDFPRINT "This is a sample Text in Times-Roman font in ITALIC with size 8" font "TIMES-ROMAN" SIZE 8 ITALIC
@ 135, 200 HPDFPRINT "This is right aligned text" SIZE 14 RIGHT
@ 150, 105 HPDFPRINT "This is center aligned text" COLOR { 255, 0, 0 } CENTER
@ 170, 100 HPDFPRINT "This is text in bigger font size" SIZE 30 COLOR { 255, 0, 0 }
@ 190, 10 HPDFPRINT "The font is Tscparan.TTF" size 12
END HPDFPAGE
END HPDFDOC
Execute File 'sample.pdf'
Return Nil
All The Best,
Franco
Canada
Franco
Canada
Re: Integración con WhatsApp
Hi Franco!
THX for your samples, but I think, Mr Javier beeds whatsapp integration sample...
THX for your samples, but I think, Mr Javier beeds whatsapp integration sample...
- AUGE_OHR
- Posts: 2102
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: Integración con WhatsApp
hi,
here is a older Fivewin Desktop Sample :
(not sure if it still work !)
you need to replace "FW_CopyToClipBoard()"
here is a older Fivewin Desktop Sample :
(not sure if it still work !)
Code: Select all
// whatsapp app must be installed and opened before running this code
#include "FiveWin.ch"
#define ORANGES "https://www.jesmondfruitbarn.com.au/wp-content/uploads/2016/10/Jesmond-Fruit-Barn-Oranges.jpg"
function Main()
local cPhone := ""
local cMsg := "Hello"
if EDITVARS cPhone, cMsg
SendToWhatsApp( AllTrim( cPhone ), AllTrim( cMsg ), ;
{ "tutor01.prg", "..\bitmaps\007.bmp", ORANGES, ;
"https://www.google.co.in/" } )
endif
return nil
function SendToWhatsApp( cPhone, cMsg, aAttach )
local oShell
local aFiles := {}
local aOthers := {}
if Empty( cPhone ); return .f.; endif
DEFAULT cMsg := "Hello"
if !Empty( aAttach )
if !HB_ISARRAY( aAttach ); aAttach := { aAttach }; endif
AEval( aAttach, {|c| if( HB_ISSTRING( c ) .and. File( c ), ;
AAdd( aFiles, c ), AAdd( aOthers, c ) ) } )
endif
cMsg := StrTran( cMsg, CRLF, "%0D%0A" )
oShell := CreateObject( "WScript.Shell" )
ShellExecute( 0, "Open", "whatsapp://send?phone="+cPhone+"&text="+cMsg )
SysWait( 0.5 )
if !Empty( aFiles )
if FW_CopyToClipBoard( aFiles, 15 )
SysWait( 2 ); oShell:SendKeys( "^v" ); SysWait( 1 )
endif
endif
AEval( aOthers, <|u|
if FW_CopyToClipBoard( u, 2 ) .or. FW_CopyToClipBoard( u )
SysWait( 1 ); oShell:SendKeys( "^v" ); SysWait( 1 )
endif
return nil
> )
oShell:SendKeys("~")
return nil
have fun
Jimmy
Jimmy
- serge_girard
- Posts: 3348
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Integración con WhatsApp
Hi Jimmy, what is/are EDITVARS?
There's nothing you can do that can't be done...
- serge_girard
- Posts: 3348
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Integración con WhatsApp
I have CHATGPT translated Jimmy's code to HMG and this is the result (WORKING!)
Whatsapp app must be installed and opened and logged in before running this code !
Beter solution is:
WhatsApp Business API
Twilio / 360dialog
Via HTTP POST + hbcurl
Code: Select all
#include "hmg.ch"
// whatsapp app must be installed and opened before running this code
#define ORANGES "https://www.jesmondfruitbarn.com.au/wp-content/uploads/2016/10/Jesmond-Fruit-Barn-Oranges.jpg"
FUNCTION Main()
LOCAL cPhone := ""
LOCAL cMsg := "Hello"
cPhone := InputBox( "Telefoonnummer", "WhatsApp", "" )
IF Empty( cPhone )
RETURN NIL
ENDIF
cMsg := InputBox( "Bericht", "WhatsApp", "Hello" )
SendToWhatsApp( AllTrim( cPhone ), AllTrim( cMsg ), ;
{ "C:\bols\bols.dbf", ;
"C:\bols\confirmQR.jpg"} )
//ORANGES, ;
//"https://www.google.com/" } )
RETURN NIL
FUNCTION SendToWhatsApp( cPhone, cMsg, aAttach )
LOCAL oShell
LOCAL aFiles := {}
LOCAL aOthers := {}
LOCAL cItem
IF Empty( cPhone )
RETURN .F.
ENDIF
DEFAULT cMsg := "Hello"
IF HB_ISARRAY( aAttach )
FOR EACH cItem IN aAttach
IF HB_ISSTRING( cItem ) .AND. File( cItem )
AAdd( aFiles, cItem )
ELSE
AAdd( aOthers, cItem )
ENDIF
NEXT
ENDIF
cMsg := StrTran( cMsg, CRLF, "%0D%0A" )
// WhatsApp openen
ShellExecute( 0, "open", ;
"whatsapp://send?phone=" + cPhone + "&text=" + cMsg, ;
NIL, NIL, 1 )
hb_idleSleep( 0.5 )
oShell := CreateObject( "WScript.Shell" )
// Bestanden plakken
IF Len( aFiles ) > 0
CopyFilesToClipboard( aFiles )
hb_idleSleep( 2 )
oShell:SendKeys( "^v" )
hb_idleSleep( 1 )
ENDIF
// URL's / tekst
FOR EACH cItem IN aOthers
System.Clipboard := cItem
hb_idleSleep( 1 )
oShell:SendKeys( "^v" )
hb_idleSleep( 1 )
NEXT
// Enter = verzenden
oShell:SendKeys( "~" )
RETURN .T.
FUNCTION CopyFilesToClipboard( aFiles )
LOCAL cList := ""
AEval( aFiles, {|c| cList += '"' + c + '"' + CRLF } )
System.Clipboard := cList
RETURN NIL
Beter solution is:
WhatsApp Business API
Twilio / 360dialog
Via HTTP POST + hbcurl
There's nothing you can do that can't be done...
Re: Integración con WhatsApp
I never text from my programs, just email. Most people nowadays have email on there phones.
I pdf print to printers or pdf print to file for email. In all my reports I give the option of print to file or print to printer.
I do not use @1,1 print any more. I use @1,1 hpdfprint.
If a person calls my clients using my software for a quote They will make up an estimate while they are on the phone with them.
Then ask them their email address. They then send the quote while on the phone with them. That way if customers
accept the can arrange right away how to the complete the sale. Works pretty well.
Don`t forget I am old school, still haven't figured out sql.
Having a bit of trouble sending daily inventory values to website.
I pdf print to printers or pdf print to file for email. In all my reports I give the option of print to file or print to printer.
I do not use @1,1 print any more. I use @1,1 hpdfprint.
If a person calls my clients using my software for a quote They will make up an estimate while they are on the phone with them.
Then ask them their email address. They then send the quote while on the phone with them. That way if customers
accept the can arrange right away how to the complete the sale. Works pretty well.
Don`t forget I am old school, still haven't figured out sql.
Having a bit of trouble sending daily inventory values to website.
All The Best,
Franco
Canada
Franco
Canada