Following are the limitations from WeChat when uploading multimedia files:

  • Image (image): 128K, supports for JPG
  • Audio (voice): 256K, no more than 60s play time, and supports for AMR
  • Video (video): 1MB, supports for MP4
  • Thumb (thumb): 64KB, supports for JPG

📘

Info

To send an attachment, you can upload it using Service > template in IMIconnect or you can upload by other means without using IMIconnect and use the id in the API.

Headers


Request HeaderDescription
Content-Typeapplication/json
keyService Key

Response


Response CodeMessageDescription
1001QueuedReturned when the request is accepted by IMIconnect.
7000Invalid JSONReturned when an invalid JSON request is sent.
7001Authentication failedReturned when an invalid service key or profile key is provided in the request.
7002Service key missingReturned when the parameter key is missing in the message request.
7003Mandatory parameters missingReturned when the mandatory parameters configured in custom event are missing.
7004Invalid parametersReturned when the parameters are invalid.
7006Internal error occurredReturned when an internal error occurs.
7007Service inactiveReturned when the service is in inactive state.
7009Max number of destinationsReturned when an API request exceeds the limit (1000) to send messages using messaging API.
##Request Body
{ 
  "appid":"<your_app_id>", 
 "deliverychannel":"wechat",
    
   "channels":{
      "OTT-Messaging":{
        "wechat":{
                  "text":"hi",
                  "attachment":{  
               "type":"media",
               "media":{  
                  "id":"1057943604868669445"
               }
               
            }
                  
               }
      }
    },
    "destination":[
      {
      
       "wechatID":["1577568001"]
      }]
  }

Body Parameters


The following are the parameters of the request body:

ParameterTypeMandatoryDescription
deliverychannelStringYeswa for WhatsApp
destinationJSONArrayYesThe destination parameter is an array of up to 1,000 entries. Messages can be sent to single or multiple recipients in a single request. For more details, refer to destination array.
channelsJSONArrayYesFor more details, refer to channels array.
expiryStringNoExpiry time in UTC format, after which messages will not be pushed. For example, 2015-04-12T13:00:19.456Z or 2015-04-12T18:30:19.456+5:30.
correlationidStringNoA client-side identifier chosen by the Service Provider to correlate requests and their subsequent responses. The correlationid can be up to 50 bytes long.
notifyurlStringNoThe IMIconnect platform will send notifications to the URL specified in the notifyurl parameter. The URL is used to retrieve the status of the message sent. The notifyurl can also be configured while creating a service. If the URL is specified in both the service and the messaging API, preference will be given to the messaging API request. More information on notify URL formats, click Message Receipts.
callbackDataStringNoAn identifier or data that will be sent alongside notifications to the notifyurl. This can serve as identifying notifications.

Channels

The channels parameter block configures channel communication parameters for channel-specific features

ParameterTypeMandatoryDescription
textStringYesMessage text
attachmentJSONObjectYes - if template is not passedSpecifies the attachment details that is uploaded by other means without using IMIconnect.
  • attachment object

Parameter

Type

Mandatory

Description

type

String

Yes

Specifies the media type. Following the supported types:

  • image

  • voice

  • video

media_idStringYesSpecifies the media id that is received for the uploaded file.
thumb_media_idStringYes - if type is videoSpecifies the preview image media id for the video.

smartlinks

An array that contains the parameters of Smartlink. This is optional. To use Smartlinks, you must create a smartlink and use the link id in messaging API.

Following are the parameters of smartlinks:

ParameterTypeMandatoryDescription
linkidNumberYesThis parameter is mandatory when the smartlinks parameter is configured in Messaging. The link id gets generated when a Smartlink is created in IMIconnect.
validityNumberNoSpecifies the time in minutes after which the link will expire.
{
  "smartlinks":[
        {
            "linkid": "<specifies the link id that is generated for a Smartlink using  IMIconnect. >",
            "validity": "<Specifies the time in minutes after which the link will expire>"
        }
      ]
}
{
  "response": [
    {
      "code": "1001",
      "description": "Queued",
      "transid": "f9793c83-f0b7-4200-99d9-20111c507baf",
      "correlationid": "cid"
    }
  ]
}
Language
Credentials
Header
Copyright © 2000 - 2021 IMImobile Limited | All Rights Reserved