メニュー

Expand
ページを評価:

WhatsApp

Limited Availability

In order to move into production using the Twilio API for WhatsApp, you need a WhatsApp Business Profile. WhatsApp is currently limiting access to profiles during their API’s limited availability stage. Business Profiles must be associated with a Twilio number. You can request to enable your Twilio numbers for WhatsApp here. That being said, you can start building your bot with the WhatsApp Sandbox and move it over to a WhatsApp Business Profile when you receive access.

With Twilio Autopilot, you can build Whatsapp bots. On this page, we'll walk you through how to connect your Whatsapp Sandbox to Autopilot so you can get started building your bot.

Set up the Sandbox

  1. Sign up for a Twilio account here if you don't already have one.
  2. Follow these step-by-step instructions for setting up your Sandbox in the Learn page of the WhatsApp console menu.
  3. Once configured, you can see all the configuration details in the Sandbox page of the WhatsApp menu. You'll need these for the next set of steps.

Connect Autopilot to the Sandbox

Once you have successfully configured your Sandbox, you'll need to connect it to your Autopilot Assistant.

  1. Go to the Autopilot menu in the console and click into the Assistant you want to connect to WhatsApp.
  2. Go to the Channels tab in the Assistant Menu and select WhatsApp.
  3. Copy the URL displayed in the Configuration tab. This is the callback URL used to send incoming messages to your Assistant.
  4. Go back to the Sandbox page in the WhatsApp console menu. Paste the callback URL where it says 'When a message comes in'.
  5. Click Save and you're all set!

テスト

Now that you have WhatsApp configured it's time to test!

  • Open the WhatsApp app
  • Tap into the chat window with your WhatsApp bot
  • Send your first message, you should get a response from Autopilot
  • Check the Autopilot Query logs

Setting up Whatsapp with Flex and Autopilot

First, you need make sure that your Whatsapp Sandbox is setup correctly and that Flex us receiving the messages. You can follow the instructions below:

Autopilot URL Parameters

パラメーター 概要
TargetTask

A string representing the unique name of the destination Task. If no TargetTask is provided, the destination task is determined by the natural language understanding.


TargetTask is useful when you want to control what task a user is routed to.

Memory

Lets you send Inbound Context to Autopilot. Should be a JSON string containing key-value pairs to insert into the Autopilot memory before starting a dialogue with the bot.

Useful for passing data stored in third party systems like a CRM into Autopilot to deliver a more contextual experience.

Example 1: Using TargetTask parameter at the end of the URL

https://channels.autopilot.twilio.com/v1/<ACCOUNT_SID>/<ASSISTANT_SID>/twilio-messaging/whatsapp?TargetTask=handle_appointment_confirmation

Any message sent to number or messaging service configured with this URL will land in the handle_appointment_confirmation task.

Example 2: Passing Inbound Context with Memory

https://channels.autopilot.twilio.com/v1/<ACCOUNT_SID>/<ASSISTANT_SID>/twilio-messaging/whatsapp?Memory={"CarModel":"Diablo","CarMake":"Lamborghini","CarYear":"2019"}

Any message sent to a bot with this URL will insert CarModel, CarMake and CarYear into the Autopilot Memory.

When sending messages using multiple Say's, Twilio cannot guarantee the ordering with Whatsapp and the user might receive them in a different order.

ページを評価:

ヘルプが必要ですか?

誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。

        
        
        

        フィードバックくださりありがとうございます!

        We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        Refer us and get $10 in 3 simple steps!

        ステップ1

        Get link

        Get a free personal referral link here

        ステップ2:

        Give $10

        Your user signs up and upgrade using link

        ステップ3

        Get $10

        1,250 free SMSes
        OR 1,000 free voice mins
        OR 12,000 chats
        OR more