This article mainly describes the [enterprise public number] after upgrading to [enterprise] to send message failure resolution, involving the interface modification related operations, the need for friends can refer to the following
This example describes a workaround to send a message after the [corporate public number] upgrade to [Enterprise]. Share to everyone for your reference, as follows:
Recently, saw the news, said is the enterprise public number to upgrade to the enterprise. At that time did not care, but later found that the enterprise public interface to send a notification message program can not send out the message.
So, I opened the upgrade message and read it carefully: The enterprise number will be migrated to the Enterprise management background (Work.weixin.qq.com/login) for unified management. Before the management of the corporate public address is qy.weixin.qq.com, can not send the message is the interface address has changed.
Login to the new background to see the secret value of the application has changed, compared to the previous number of bits less. After you replace the secret value in your code with a new one, you find that it is still not working. Debug read the error when sending a message using the POST request interface: {"Errcode":-1, "errmsg": "Invalid Input"}. There could be two reasons for the analysis: the outgoing message interface address of the call is incorrect, or the post parameter passed is not in the correct format.
Fortunately, on its official web site found the Enterprise API documentation: HTTPS://WORK.WEIXIN.QQ.COM/API/DOC, the above has more detailed instructions for use. It has been confirmed that the URL address of the calling interface has not changed (sending a message or using Https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=ACCESS_TOKEN). However, the text message is found to have a different format, the official website example is as follows:
{ "Touser": "userid1| userid2| UserID3 ", " Toparty ":" partyid1| PartyID2 ", " Totag ":" TagID1 | TagID2 ", " Msgtype ":" Text ", " Agentid ": 1, " text ": { " content ":" Your Courier has arrived, please bring cards to the mail center to pick up. " \ n <a href=\ "work.weixin.qq.com\" > Email Center video Live </a> Before you go, smart to avoid queuing. " }}
Above the UserID, PartyId these should I used to be a numeric value, but the example is placed in quotation marks, that is to be treated as a string. So, I changed the code to a string of the way to try, the results can be ...