Platform
Chatbot Builder Bulk Messaging Team Inbox Mini CRM API & Webhooks AI Integration WhatsApp Flows
Industries
E-commerce & D2C Real Estate Education Healthcare Finance & BFSI Logistics Hospitality Retail
Integrations 📚 Learn 📝 Blog 🗂 Codex Pricing Start Free Trial →
Connect  ›  Connect Perplexity to WhatsApp
AI connection guide

Connect Perplexity AI to WhatsApp

Perplexity's Sonar models search the web before answering. That one difference makes them the right tool when customers ask questions where the answer changes, prices, news, current availability, and a fixed knowledge base will not do.

 Published 21 June 2026  7 min read  Live-researched  Bring your own key

Every other AI provider in this series generates replies from a trained model's fixed knowledge. Perplexity's Sonar models search the live web as part of the request, then cite their sources in the response. The API format is nearly identical to OpenAI's, which means the setup is quick if you have done any of the other AI connection guides.

The use-case fit matters: Sonar is valuable when your customers ask questions whose answers change over time. For scripted support, FAQ-style flows, or tasks where your own content is the knowledge base, a standard model without web search is faster and cheaper.

New to the External API Request step? Read the foundation guide first.

Step 1: Get your Perplexity API key

1

Sign in to Perplexity

Go to perplexity.ai and sign in or create an account.
2

Open Settings and go to API

Under your account settings, find the API section. Create a new key. It starts with pplx-.
3

Add credits

API usage is billed separately from a Perplexity Pro subscription. Add API credits in the same settings section. Without credits, the key will return a payment-required error.

 Official source

Current model list and pricing: docs.perplexity.ai/guides/model-cards. Perplexity releases new model versions regularly; check the docs for the current recommended Sonar model name.

Step 2: Fill in the External API Request step

External API Request
Method
POST
Request URL
https://api.perplexity.ai/chat/completions
Auth Type
Bearer token
Header Parameters
Authorization
Bearer YOUR_PERPLEXITY_KEY
Content-Type
application/json
Body Type
JSON (raw)
Response Type
Default Response
SaveRun and Save

Request URL

Request URL
https://api.perplexity.ai/chat/completions

Headers

HeaderValue
AuthorizationBearer YOUR_PPLX_KEY
Content-Typeapplication/json

Body

JSON body
{
  "model": "sonar",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant. Answer concisely."
    },
    {
      "role": "user",
      "content": "{{customer_message}}"
    }
  ]
}

The sonar model uses web search to answer. The response includes a citations array alongside the answer text. If you want a version without web search, Perplexity also offers sonar-pro and other models; check their model cards for current options.

Step 3: Map the reply

Response structure
{
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "...Perplexity's answer is here..."
      }
    }
  ],
  "citations": [
    "https://source-used-to-answer.com/page"
  ]
}

Map choices[0].message.content for the answer text. The citations array is available separately if you want to append source links to the WhatsApp message; it can be ignored if you only need the answer.

Troubleshooting

SymptomLikely causeFix
401 UnauthorizedWrong key or missing Bearer prefixCheck the key starts with pplx- and the header value starts with Bearer
402 Payment RequiredNo API creditsAdd API credits in perplexity.ai settings (separate from Pro subscription)
422 UnprocessableInvalid model nameCheck docs.perplexity.ai for the current model name; sonar is the standard search-augmented option
Slow responsesWeb search adds latencyExpected behaviour for search-augmented models; add a wait message in your flow if needed

Common questions

Where do I get a Perplexity API key?
+
Sign in or create an account at perplexity.ai, then go to Settings and open API. Create a key and copy it. The key starts with pplx-. You will need a paid Perplexity subscription or API credits before the key works.
What makes Perplexity different from OpenAI or Claude?
+
Perplexity's Sonar models are search-augmented: they can pull in live information from the web as part of generating their answer, and they cite their sources in the response. This makes Perplexity particularly useful for questions where the customer might need a current, factual answer, rather than something from a fixed knowledge base.
Do the citations in the response come through to WhatsApp?
+
Perplexity returns citations as an array alongside the main text. The text content itself is in choices[0].message.content, which you map into WhatsApp as normal. Whether you include the citations in the WhatsApp message is up to you; you can append them as source links or ignore them depending on your use case.
Is Perplexity right for every WhatsApp chatbot?
+
Not for all use cases. Web search adds latency and cost compared to a pure language model. It is worth it when customers ask questions that change over time, like prices, news, or current availability, but less valuable for scripted support flows where the answers are fixed.
Does this cost anything on WA.Expert?
+
WA.Expert does not mark up Perplexity's charges. The WhatsApp reply is free if sent inside the 24-hour service window.
Can I use Perplexity through OpenRouter instead?
+
Yes. OpenRouter provides access to Perplexity's Sonar models through a unified endpoint with a single OpenRouter key. See the OpenRouter guide for the setup. The trade-off is an extra hop in the routing, but it is a valid option if you already have an OpenRouter account.
Related

Keep building

Connect OpenRouter

One key for 200+ models including Perplexity Sonar.

Read guide →

Connect OpenAI

Standard language model without web search.

Read guide →

Connect hub

All connection guides.

Browse all →

The External API Request step

Foundation guide.

Read guide →

DPDP and WhatsApp outreach

Data protection context for AI-assisted messaging.

Read article →

WhatsApp API glossary

Endpoint, bearer, and more.

Open glossary →

Give your chatbot live web knowledge.

Free trial, no credit card required. And if you ever get stuck, we are the only platform in India that answers you live on WhatsApp.

Start Free →Book Demo
1