Skip to main content

Overview

TypeDescriptionMain required field
textMessage texte simpletext
imageImage avec légende optionnellemediaUrl
videoVidéo avec légende optionnellemediaUrl
audioFichier audio standardmediaUrl
voice_noteNote vocale WhatsAppmediaUrl
documentFichier ou documentmediaUrl
locationLocalisation GPSlatitude, longitude
contactPartage d’un contact du répertoirecontactId
Fields communs :
  • instanceId
  • to
  • type ou templateId
Les endpoints POST /api/v1/messages/send et POST /api/v1/messages/schedule supportent deux modes :
  • mode libre avec type
  • mode template avec templateId

Direct send vs template send

Direct mode

Vous fournissez directement type et les champs associés.
{
  "instanceId": "inst_uuid",
  "to": "+33612345678",
  "type": "text",
  "text": "Hello Awa"
}

Template mode

Vous fournissez templateId et, si nécessaire, des variables custom.*.
{
  "instanceId": "inst_uuid",
  "to": "+33612345678",
  "contactId": "cnt_uuid",
  "templateId": "tmpl_uuid",
  "variables": {
    "code": "PROMO10"
  }
}
Le backend rend alors le message final avant envoi. Le type effectif est celui du template.

text

{
  "instanceId": "inst_uuid",
  "to": "+33612345678",
  "type": "text",
  "text": "Hello Jean,\n\nVotre commande #1234 est prête."
}
FieldTypeRequiredContraintes
textstring1 à 4096 caractères

image

{
  "instanceId": "inst_uuid",
  "to": "+33612345678",
  "type": "image",
  "mediaUrl": "https://cdn.example.com/produit.jpg",
  "text": "Nouvelle collection disponible"
}
FieldTypeRequiredContraintes
mediaUrlURLURL publique
textstringnoLégende optionnelle

video

{
  "instanceId": "inst_uuid",
  "to": "+33612345678",
  "type": "video",
  "mediaUrl": "https://cdn.example.com/demo.mp4",
  "text": "Découvrez notre nouveau produit"
}
FieldTypeRequiredContraintes
mediaUrlURLURL publique
textstringnoLégende optionnelle

audio

{
  "instanceId": "inst_uuid",
  "to": "+33612345678",
  "type": "audio",
  "mediaUrl": "https://cdn.example.com/message.mp3"
}
Affiché comme un fichier audio standard dans WhatsApp.

voice_note

{
  "instanceId": "inst_uuid",
  "to": "+33612345678",
  "type": "voice_note",
  "mediaUrl": "https://cdn.example.com/note.ogg"
}
Affiché comme une note vocale WhatsApp.
The difference between audio and voice_note is mainly how they are displayed in WhatsApp.

document

{
  "instanceId": "inst_uuid",
  "to": "+33612345678",
  "type": "document",
  "mediaUrl": "https://cdn.example.com/facture.pdf",
  "text": "Facture avril 2026"
}
FieldTypeRequiredContraintes
mediaUrlURLURL publique
textstringnoLabel or caption

location

{
  "instanceId": "inst_uuid",
  "to": "+33612345678",
  "type": "location",
  "latitude": 6.3654,
  "longitude": 2.4183,
  "locationName": "Boutique Cotonou Centre",
  "locationAddress": "Avenue de la Marina, Cotonou"
}
FieldTypeRequiredContraintes
latitudenumberLatitude décimale
longitudenumberLongitude décimale
locationNamestringnoLocation name
locationAddressstringnoAddress

contact

{
  "instanceId": "inst_uuid",
  "to": "+33612345678",
  "type": "contact",
  "contactId": "cnt_uuid"
}
Le contactId doit appartenir à votre compte MsgFlash.

Common fields

FieldTypeRequiredDescription
instanceIdUUIDInstance WhatsApp à utiliser
tostringE.164 number
typeenum✓ if no templateIdDirect message type
templateIdUUID✓ if no typeMsgFlash template to use
contactIdUUIDnoSource contact or template context
variablesobjectnoValeurs pour custom.*
scheduledAtISO 8601noUtilisé uniquement sur /messages/schedule

Media templates

Un template peut être de type :
  • text
  • image
  • video
  • audio
  • document
Pour un template media, mediaUrl est obligatoire sur le template lui-même. Example:
{
  "name": "Brochure PDF",
  "type": "document",
  "body": "Hello {{contact.firstName}}, voici votre brochure.",
  "mediaUrl": "https://cdn.example.com/brochure.pdf"
}