# forward the message to customer service

If Service Account is in development mode, when an ordinary WeChat user sends a message to a service number,WeChat server will first POST the message to the url filled by the developer. If you wish to forward the message to customer service, you need the developer to return the message MsgType of transfer_customer_service in the response package. After receiving the response, the WeChat server forwards the message sent to the customer service system. You can also return the transfer_customer_service message with TransInfo information in the XML specifying the assignment to a customer service account.

After the user is accessed by the customer service, and before the customer service closes the session, messages sent by the user are forwarded directly to the customer service system while the session is in progress.When the session is not closed for more than 30 minutes, the WeChat server will automatically stop forwarding to the customer service and will resume the message to the developer's URL.

When the user is in the waiting queue, the message sent by the user will still be pushed to the URL filled in by the developer.

It is especially important to note here that only messages sent by WeChat users should be forwarded, and no other events (such as menu clicks, geolocation reports, etc.) should be forwardable, otherwise the customer service will see some meaningless messages on the customer service system.

Send the message to customer service

If Service Account is in development mode, when an ordinary WeChat user sends a message to a service number,WeChat server will first POST the message to the url filled by the developer. If you wish to forward the message to customer service, you need the developer to return the message MsgType of transfer_customer_service in the response package. After receiving the response, the WeChat server forwards the message sent to the customer service system.

 <xml> 
  <ToUserName><![CDATA[touser]]></ToUserName>  
  <FromUserName><![CDATA[fromuser]]></FromUserName>  
  <CreateTime>1399197672</CreateTime>  
  <MsgType><![CDATA[transfer_customer_service]]></MsgType> 
</xml>

Parameter explaination

parameter Do I have to? describe
ToUserName yes Recipient account number (OpenID received)
FromUserName yes Developer No. WeChat
CreateTime yes Message Creation Time (integer)
MsgType yes transfer_customer_service

Send the message to the designated customer service

If you have multiple customer service agents who are simultaneously signed in to customer service and have automatic access turned on for customer service, each customer's message is forwarded to customer service, the multi-customer system assigns the customer to one of the customer service representatives. If you want to transfer a customer's message to a designated customer service for reception, you can specify a customer account number with TransInfo information when returning the transfer_customer_service message. It is important to note that if the designated customer service does not have access (not online, not having automatic access turned on, or full automatic access), the user will be directly accessed to the designated service, will not notify other customer service, and will not be received by other customer service. It is recommended that when designating customer service, first check the access capacity of customer service (obtaining the online customer service reception information interface) and designate customer service that has the capacity to access, so as to ensure that customers can receive service in a timely manner.

sample code

 <xml> 
  <ToUserName><![CDATA[touser]]></ToUserName>  
  <FromUserName><![CDATA[fromuser]]></FromUserName>  
  <CreateTime>1399197672</CreateTime>  
  <MsgType><![CDATA[transfer_customer_service]]></MsgType>  
  <TransInfo> 
    <KfAccount><![CDATA[test1@test]]></KfAccount> 
  </TransInfo> 
</xml>

Parameter explaination

parameter Do I have to? describe
ToUserName yes Recipient account number (OpenID received)
FromUserName yes Developer No. WeChat
CreateTime yes Message Creation Time (integer)
MsgType yes transfer_customer_service
KfAccount yes Specify the customer service account for session access