TWhatsApp Setup Guide

Step-by-step guide to go from zero to your first WhatsApp message sent with TWhatsApp. The whole Meta-side setup takes about 15 minutes and needs no business verification and no app review while you test with your own phone number.

1. Create your Meta app

Go to developers.facebook.com and sign in with your Facebook account. Open My apps (top right) and choose Create app. Give it a name, for example FWH, and finish the wizard.

Once created, open App settings > Basic in the left menu. This page shows your App ID - you will not need it for TWhatsApp, but it identifies the app:

App settings > Basic page of the FWH app, showing its App ID

Note: Meta shows a 15-app warning on brand-new unverified developer accounts. If you have an older account you can usually create the app anyway, as in this example.

2. Add the WhatsApp use case

In the app's left menu open Use cases (Casos de uso), click Add use cases and add "Connect with customers through WhatsApp" (Conecta con los clientes a través de WhatsApp). Then press Customize (Personalizar) on that use case:

Use cases page with the WhatsApp use case added and the Customize button

3. Get your token and Phone Number ID

Inside the WhatsApp use case, the left menu shows a Basic setup (Configuración básica) group. When asked for an integration type, choose Integrate with the API (Integrar con API):

Customize page of the WhatsApp use case, with the Basic setup menu and Step 1. Test

Open Step 1. Test (Paso 1. Probar). This screen has everything TWhatsApp needs:

Keep the token to yourself. Never paste it into chats or emails: copy it straight into a password manager, or directly into your test program on your PC. If one leaks, generate a new one on the same screen and discard the old.

Optional: Meta also creates a test version of your app (<your app> - Test1) with its own settings page. You can use it to experiment without touching the main app:

Settings page of the automatically created test version of the app

4. Send the test message from Meta's page

Still on Step 1. Test, press Meta's own Send message (Enviar mensaje) button. Meta delivers a hello_world template message from the test sender to your registered number. If it arrives, your app, sender and recipient are all working - everything left happens in your code.

5. Send from Harbour with TWhatsApp

On your PC, open the FWH sample at samples/whatsapp/twhatsapp.prg and set your two values:

oWhatsApp := TWhatsApp():New()
oWhatsApp:cToken   := "PASTE-YOUR-TOKEN-HERE"       // temporary token from Step 1
oWhatsApp:cPhoneId := "PASTE-YOUR-PHONE-NUMBER-ID"  // phone number ID from Step 1

oWhatsApp:SendText( "34600000000", "Hello from FiveWin!" )

Build and run the sample. The message leaves from your own Harbour code - that is the moment it gets real. For the full member reference see the TWhatsApp class page.

6. Next steps

See Also