You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将WhatsApp API链接添加至订单邮件并关联客户手机号?

Hey there! Let's walk through exactly how to add that dynamic WhatsApp link to your admin order completion notification emails—so you can shoot customers a quick confirmation message with one click. Here's what you need to do:

1. Locate the Customer Phone Variable in Your Email Template

First, you need to find the template variable that outputs your customer's phone number. This varies by platform/system:

  • For WooCommerce, it's usually {{customer.phone}} or {{billing_phone}}
  • For Shopify, look for {{customer.phone}}
  • If you're using a custom system, it might be something like {{user.mobile}} or {{order.customer.phone}}

Critical note: Make sure this variable outputs the full phone number with international country code (e.g., +1234567890, not just 1234567890). WhatsApp's API requires the country code to work correctly.

Embed the phone variable into WhatsApp's send URL, and pre-fill your confirmation message. Remember to URL-encode any spaces or special characters in your text (otherwise the link might break):

<a href="https://api.whatsapp.com/send?phone={{customer.phone}}&text=Hi%21%20We%27ve%20successfully%20received%20your%20order.%20We%27ll%20process%20it%20and%20update%20you%20shortly.%20Thanks%20for%20shopping%20with%20us%21">Message Customer via WhatsApp</a>
[Message Customer via WhatsApp](https://api.whatsapp.com/send?phone={{customer.phone}}&text=Hi%21%20We%27ve%20successfully%20received%20your%20order.%20We%27ll%20process%20it%20and%20update%20you%20shortly.%20Thanks%20for%20shopping%20with%20us%21)

Quick Tip for Text Encoding:

If you don't want to manually encode your message, use encodeURIComponent("Your message here") in your browser's developer console to generate the URL-safe version automatically.

Head to your system's email template editor (usually under "Settings > Emails" or "Template Management") and paste the link code in a logical spot—like below the order details, or next to other customer contact options.

If some customers don't provide a phone number, add a conditional check to hide the link when there's no number available. Here's how that might look in a few common systems:

WooCommerce (using PHP in template):

<?php if ( ! empty( $order->get_billing_phone() ) ) : ?>
  <a href="https://api.whatsapp.com/send?phone=<?php echo esc_attr( $order->get_billing_phone() ); ?>&text=Hi%21%20We%27ve%20successfully%20received%20your%20order...">Message Customer via WhatsApp</a>
<?php endif; ?>

Shopify (using Liquid):

{% if customer.phone != blank %}
  <a href="https://api.whatsapp.com/send?phone={{ customer.phone }}&text=Hi%21%20We%27ve%20successfully%20received%20your%20order...">Message Customer via WhatsApp</a>
{% endif %}

5. Test It Out!

Send a test order notification to yourself, click the link, and verify that:

  • WhatsApp opens to the correct customer number
  • Your pre-filled message shows up exactly as you wrote it

That's all—you're ready to streamline your post-order communication with one-click WhatsApp messages!

内容的提问来源于stack exchange,提问作者Yatir

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 07:06:57