[{"data":1,"prerenderedAt":493},["ShallowReactive",2],{"help-article-integrations-sending-messages-api":3,"help-siblings-integrations":460},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"category":5,"order":10,"difficulty":11,"time_to_complete":12,"related":13,"body":17,"_type":454,"_id":455,"_source":456,"_file":457,"_stem":458,"_extension":459},"\u002Fhelp\u002Fintegrations\u002Fsending-messages-api","integrations",false,"","Sending messages via API","How to send WhatsApp messages programmatically using the AIsoule REST API — text, media, templates, and interactive.",2,"intermediate","5 minutes",[14,15,16],"\u002Fhelp\u002Fintegrations\u002Fapi-overview","\u002Fhelp\u002Fintegrations\u002Fwebhooks-receiving","\u002Fhelp\u002Fmessaging\u002Fsend-template-message",{"type":18,"children":19,"toc":438},"root",[20,28,34,41,51,57,62,70,76,87,96,102,111,117,126,159,165,172,183,189,194,203,208,217,223,228,237,242,248,279,285,378,384],{"type":21,"tag":22,"props":23,"children":25},"element","h1",{"id":24},"sending-messages-via-api",[26],{"type":27,"value":8},"text",{"type":21,"tag":29,"props":30,"children":31},"p",{},[32],{"type":27,"value":33},"Send WhatsApp messages programmatically from your application, CRM, or automation tools.",{"type":21,"tag":35,"props":36,"children":38},"h2",{"id":37},"endpoint",[39],{"type":27,"value":40},"Endpoint",{"type":21,"tag":42,"props":43,"children":45},"pre",{"code":44},"POST https:\u002F\u002Fapp.aisoule.com\u002Fapi\u002Fmessages\u002Fsend\n",[46],{"type":21,"tag":47,"props":48,"children":49},"code",{"__ignoreMap":7},[50],{"type":27,"value":44},{"type":21,"tag":35,"props":52,"children":54},{"id":53},"authentication",[55],{"type":27,"value":56},"Authentication",{"type":21,"tag":29,"props":58,"children":59},{},[60],{"type":27,"value":61},"Include your API key in the header:",{"type":21,"tag":42,"props":63,"children":65},{"code":64},"X-API-Key: your_api_key_here\n",[66],{"type":21,"tag":47,"props":67,"children":68},{"__ignoreMap":7},[69],{"type":27,"value":64},{"type":21,"tag":35,"props":71,"children":73},{"id":72},"sending-a-text-message",[74],{"type":27,"value":75},"Sending a text message",{"type":21,"tag":42,"props":77,"children":82},{"code":78,"language":79,"meta":7,"className":80},"curl -X POST https:\u002F\u002Fapp.aisoule.com\u002Fapi\u002Fmessages\u002Fsend \\\n  -H \"X-API-Key: your_key\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"to\": \"+919876543210\",\n    \"type\": \"text\",\n    \"text\": \"Hello! Your order has been shipped.\"\n  }'\n","bash",[81],"language-bash",[83],{"type":21,"tag":47,"props":84,"children":85},{"__ignoreMap":7},[86],{"type":27,"value":78},{"type":21,"tag":88,"props":89,"children":90},"blockquote",{},[91],{"type":21,"tag":29,"props":92,"children":93},{},[94],{"type":27,"value":95},"Note: Text messages only work within the 24-hour window.",{"type":21,"tag":35,"props":97,"children":99},{"id":98},"sending-a-template-message",[100],{"type":27,"value":101},"Sending a template message",{"type":21,"tag":42,"props":103,"children":106},{"code":104,"language":79,"meta":7,"className":105},"curl -X POST https:\u002F\u002Fapp.aisoule.com\u002Fapi\u002Fmessages\u002Fsend \\\n  -H \"X-API-Key: your_key\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"to\": \"+919876543210\",\n    \"type\": \"template\",\n    \"template\": {\n      \"name\": \"order_confirmation\",\n      \"language\": \"en\",\n      \"components\": [\n        {\n          \"type\": \"body\",\n          \"parameters\": [\n            { \"type\": \"text\", \"text\": \"John\" },\n            { \"type\": \"text\", \"text\": \"ORD-789\" }\n          ]\n        }\n      ]\n    }\n  }'\n",[81],[107],{"type":21,"tag":47,"props":108,"children":109},{"__ignoreMap":7},[110],{"type":27,"value":104},{"type":21,"tag":35,"props":112,"children":114},{"id":113},"sending-media",[115],{"type":27,"value":116},"Sending media",{"type":21,"tag":42,"props":118,"children":121},{"code":119,"language":79,"meta":7,"className":120},"curl -X POST https:\u002F\u002Fapp.aisoule.com\u002Fapi\u002Fmessages\u002Fsend \\\n  -H \"X-API-Key: your_key\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"to\": \"+919876543210\",\n    \"type\": \"image\",\n    \"image\": {\n      \"url\": \"https:\u002F\u002Fexample.com\u002Fproduct.jpg\",\n      \"caption\": \"Check out our new product!\"\n    }\n  }'\n",[81],[122],{"type":21,"tag":47,"props":123,"children":124},{"__ignoreMap":7},[125],{"type":27,"value":119},{"type":21,"tag":29,"props":127,"children":128},{},[129,131,137,139,145,146,152,153],{"type":27,"value":130},"Supported media types: ",{"type":21,"tag":47,"props":132,"children":134},{"className":133},[],[135],{"type":27,"value":136},"image",{"type":27,"value":138},", ",{"type":21,"tag":47,"props":140,"children":142},{"className":141},[],[143],{"type":27,"value":144},"video",{"type":27,"value":138},{"type":21,"tag":47,"props":147,"children":149},{"className":148},[],[150],{"type":27,"value":151},"document",{"type":27,"value":138},{"type":21,"tag":47,"props":154,"children":156},{"className":155},[],[157],{"type":27,"value":158},"audio",{"type":21,"tag":35,"props":160,"children":162},{"id":161},"sending-interactive-messages",[163],{"type":27,"value":164},"Sending interactive messages",{"type":21,"tag":166,"props":167,"children":169},"h3",{"id":168},"buttons",[170],{"type":27,"value":171},"Buttons",{"type":21,"tag":42,"props":173,"children":178},{"code":174,"language":175,"meta":7,"className":176},"{\n  \"to\": \"+919876543210\",\n  \"type\": \"interactive\",\n  \"interactive\": {\n    \"type\": \"button\",\n    \"body\": { \"text\": \"How can we help?\" },\n    \"action\": {\n      \"buttons\": [\n        { \"type\": \"reply\", \"reply\": { \"id\": \"sales\", \"title\": \"Sales\" } },\n        { \"type\": \"reply\", \"reply\": { \"id\": \"support\", \"title\": \"Support\" } }\n      ]\n    }\n  }\n}\n","json",[177],"language-json",[179],{"type":21,"tag":47,"props":180,"children":181},{"__ignoreMap":7},[182],{"type":27,"value":174},{"type":21,"tag":35,"props":184,"children":186},{"id":185},"response-format",[187],{"type":27,"value":188},"Response format",{"type":21,"tag":29,"props":190,"children":191},{},[192],{"type":27,"value":193},"Success:",{"type":21,"tag":42,"props":195,"children":198},{"code":196,"language":175,"meta":7,"className":197},"{\n  \"data\": {\n    \"message_id\": \"wamid.HBgLOTE5ODc2NTQzMjEw...\",\n    \"status\": \"sent\"\n  }\n}\n",[177],[199],{"type":21,"tag":47,"props":200,"children":201},{"__ignoreMap":7},[202],{"type":27,"value":196},{"type":21,"tag":29,"props":204,"children":205},{},[206],{"type":27,"value":207},"Error:",{"type":21,"tag":42,"props":209,"children":212},{"code":210,"language":175,"meta":7,"className":211},"{\n  \"message\": \"Outside 24-hour window. Use a template message.\",\n  \"status\": \"error\"\n}\n",[177],[213],{"type":21,"tag":47,"props":214,"children":215},{"__ignoreMap":7},[216],{"type":27,"value":210},{"type":21,"tag":35,"props":218,"children":220},{"id":219},"specifying-whatsapp-account",[221],{"type":27,"value":222},"Specifying WhatsApp account",{"type":21,"tag":29,"props":224,"children":225},{},[226],{"type":27,"value":227},"If you have multiple accounts, specify which one to send from:",{"type":21,"tag":42,"props":229,"children":232},{"code":230,"language":175,"meta":7,"className":231},"{\n  \"to\": \"+919876543210\",\n  \"type\": \"text\",\n  \"text\": \"Hello!\",\n  \"whatsapp_account\": \"account_id_here\"\n}\n",[177],[233],{"type":21,"tag":47,"props":234,"children":235},{"__ignoreMap":7},[236],{"type":27,"value":230},{"type":21,"tag":29,"props":238,"children":239},{},[240],{"type":27,"value":241},"If not specified, the default outgoing account is used.",{"type":21,"tag":35,"props":243,"children":245},{"id":244},"rate-limits",[246],{"type":27,"value":247},"Rate limits",{"type":21,"tag":249,"props":250,"children":251},"ul",{},[252,264,274],{"type":21,"tag":253,"props":254,"children":255},"li",{},[256,262],{"type":21,"tag":257,"props":258,"children":259},"strong",{},[260],{"type":27,"value":261},"100 messages per minute",{"type":27,"value":263}," via API",{"type":21,"tag":253,"props":265,"children":266},{},[267,272],{"type":21,"tag":257,"props":268,"children":269},{},[270],{"type":27,"value":271},"10 messages per second",{"type":27,"value":273}," burst",{"type":21,"tag":253,"props":275,"children":276},{},[277],{"type":27,"value":278},"Meta's messaging limits still apply (unique contacts per day)",{"type":21,"tag":35,"props":280,"children":282},{"id":281},"error-codes",[283],{"type":27,"value":284},"Error codes",{"type":21,"tag":286,"props":287,"children":288},"table",{},[289,308],{"type":21,"tag":290,"props":291,"children":292},"thead",{},[293],{"type":21,"tag":294,"props":295,"children":296},"tr",{},[297,303],{"type":21,"tag":298,"props":299,"children":300},"th",{},[301],{"type":27,"value":302},"Code",{"type":21,"tag":298,"props":304,"children":305},{},[306],{"type":27,"value":307},"Meaning",{"type":21,"tag":309,"props":310,"children":311},"tbody",{},[312,326,339,352,365],{"type":21,"tag":294,"props":313,"children":314},{},[315,321],{"type":21,"tag":316,"props":317,"children":318},"td",{},[319],{"type":27,"value":320},"400",{"type":21,"tag":316,"props":322,"children":323},{},[324],{"type":27,"value":325},"Invalid request (missing fields, bad format)",{"type":21,"tag":294,"props":327,"children":328},{},[329,334],{"type":21,"tag":316,"props":330,"children":331},{},[332],{"type":27,"value":333},"401",{"type":21,"tag":316,"props":335,"children":336},{},[337],{"type":27,"value":338},"Invalid API key",{"type":21,"tag":294,"props":340,"children":341},{},[342,347],{"type":21,"tag":316,"props":343,"children":344},{},[345],{"type":27,"value":346},"404",{"type":21,"tag":316,"props":348,"children":349},{},[350],{"type":27,"value":351},"Contact or template not found",{"type":21,"tag":294,"props":353,"children":354},{},[355,360],{"type":21,"tag":316,"props":356,"children":357},{},[358],{"type":27,"value":359},"429",{"type":21,"tag":316,"props":361,"children":362},{},[363],{"type":27,"value":364},"Rate limit exceeded",{"type":21,"tag":294,"props":366,"children":367},{},[368,373],{"type":21,"tag":316,"props":369,"children":370},{},[371],{"type":27,"value":372},"500",{"type":21,"tag":316,"props":374,"children":375},{},[376],{"type":27,"value":377},"Server error (retry)",{"type":21,"tag":35,"props":379,"children":381},{"id":380},"tips",[382],{"type":27,"value":383},"Tips",{"type":21,"tag":385,"props":386,"children":387},"ol",{},[388,398,408,418,428],{"type":21,"tag":253,"props":389,"children":390},{},[391,396],{"type":21,"tag":257,"props":392,"children":393},{},[394],{"type":27,"value":395},"Use templates for first contact",{"type":27,"value":397}," — Text messages fail outside the window",{"type":21,"tag":253,"props":399,"children":400},{},[401,406],{"type":21,"tag":257,"props":402,"children":403},{},[404],{"type":27,"value":405},"Handle errors gracefully",{"type":27,"value":407}," — Implement retry logic for 429 and 500 errors",{"type":21,"tag":253,"props":409,"children":410},{},[411,416],{"type":21,"tag":257,"props":412,"children":413},{},[414],{"type":27,"value":415},"Validate phone numbers",{"type":27,"value":417}," — Include country code, digits only",{"type":21,"tag":253,"props":419,"children":420},{},[421,426],{"type":21,"tag":257,"props":422,"children":423},{},[424],{"type":27,"value":425},"Log message IDs",{"type":27,"value":427}," — Useful for tracking delivery via webhooks",{"type":21,"tag":253,"props":429,"children":430},{},[431,436],{"type":21,"tag":257,"props":432,"children":433},{},[434],{"type":27,"value":435},"Test in sandbox",{"type":27,"value":437}," — Use a test number before production",{"title":7,"searchDepth":10,"depth":10,"links":439},[440,441,442,443,444,445,449,450,451,452,453],{"id":37,"depth":10,"text":40},{"id":53,"depth":10,"text":56},{"id":72,"depth":10,"text":75},{"id":98,"depth":10,"text":101},{"id":113,"depth":10,"text":116},{"id":161,"depth":10,"text":164,"children":446},[447],{"id":168,"depth":448,"text":171},3,{"id":185,"depth":10,"text":188},{"id":219,"depth":10,"text":222},{"id":244,"depth":10,"text":247},{"id":281,"depth":10,"text":284},{"id":380,"depth":10,"text":383},"markdown","content:help:integrations:sending-messages-api.md","content","help\u002Fintegrations\u002Fsending-messages-api.md","help\u002Fintegrations\u002Fsending-messages-api","md",[461,463,466,469,472,475,478,479,482,485,487,490],{"_path":14,"title":462},"REST API overview and authentication",{"_path":464,"title":465},"\u002Fhelp\u002Fintegrations\u002Fapi-rate-limits","API rate limits and best practices",{"_path":467,"title":468},"\u002Fhelp\u002Fintegrations\u002Fcustom-js-actions","Using the JavaScript VM for custom actions",{"_path":470,"title":471},"\u002Fhelp\u002Fintegrations\u002Ferror-codes","Error codes reference",{"_path":473,"title":474},"\u002Fhelp\u002Fintegrations\u002Fpayment-gateway","Payment gateway setup (Razorpay\u002FStripe)",{"_path":476,"title":477},"\u002Fhelp\u002Fintegrations\u002Fproduct-catalog-sync","Product catalog sync from Meta",{"_path":4,"title":8},{"_path":480,"title":481},"\u002Fhelp\u002Fintegrations\u002Fsending-messages-api-templates","Sending messages via API (advanced)",{"_path":483,"title":484},"\u002Fhelp\u002Fintegrations\u002Fwebhook-events","Webhook event types reference",{"_path":15,"title":486},"Receiving messages via webhooks",{"_path":488,"title":489},"\u002Fhelp\u002Fintegrations\u002Fwoocommerce","WooCommerce integration setup",{"_path":491,"title":492},"\u002Fhelp\u002Fintegrations\u002Fzapier-pabbly","Connecting with Zapier and Pabbly Connect",1780423187463]