Return value about "function processDeliveryPart" in a Connector

Avatar

Avatar

tumuzhuanjia

Avatar

tumuzhuanjia

tumuzhuanjia

08-08-2017

Hi

I am tring to write a JS Connector to send message to my subscription.

But I find the return value "function processDeliveryPart" is sometime strange.

I use the follow JavaScript code to return a message if the deliveryPart.message.@id is some error happed.

try{

     // my code to send message

}catch(e)

msgs.appendChild(<message

              id={deliveryPart.message.@id}

              status="2"

              noRetry="true"

              log={e.toString()}

              failureReason="20"

              failureType="1"/>);

}

My question is :

(1) Sometime "failureReason" and  "failureType" is not work.  It seams that Adobe Campaign set the

      "failureReason" and  "failureType" 's value according to "log={e.toString()}" .

      Sometime the "Reason" will be set to "Refused" even I did not set the 'failureReason="20"'

2017-08-08_150240.jpg

(2) would you like to explain the follow attributes to me? 

     status            :    0: Ignored; 1: Sent; 2: Failed

     failureType    :   0: Undefined; 1: soft 2: hard  

     failureReason :   0: Undefined; 20: Refused

    What I know is the up. Is it right? Where can I find the guide about these attribute?

(3) Some time a deliveryPart.message.@address will be "Quarantine" under 

                "Administration -> Campaign Management -> Non deliverable Management -> Non deliverables and addresses",

      what is the reason?

Best regards.

View Entire Topic

Avatar

Avatar

tumuzhuanjia

Avatar

tumuzhuanjia

tumuzhuanjia

08-08-2017

Hi Amit:

Thans for your reply.

I am making a unit test to my "try{}" code. So in my "try" it will "throw" errors according logic. So it is correct the code goto the "catch(e){}".

What I want is the standard of the "msgs.appendChild" when error happed. And when the address will be "Quarantine" ?

msgs.appendChild(<message

              id={deliveryPart.message.@id}

              status="?"

              noRetry="true"

              log={e.toString()}

              failureReason="?"

              failureType="?"/>);

And my code is the follow:

  for each (var msg in deliveryPart.message)

  {

    try {

      // get the service ID and mediaId

      var woaId   = NL.XTK.toString(msg.wechatService)

      var mediaId = NL.XTK.toString(msg.wechatMedia)

      

      if (woaId == null || woaId == "" || mediaId == null || mediaId == "")

      {

        throw "Parameter error: woaId = " + woaId + "; mediaId = " + mediaId

      }

     

      woaId = woaId.replace(BF_SERVICE_PREFIX, "")

      //we saved the address with format "@openid + '@' + [service/@name]"

      var address = NL.XTK.toString(msg.@address)

      var addrArray = address.split('@', 2)

      if (addrArray.length != 2)

        continue

       

      var openId = NL.XTK.toString(addrArray[0])

      var tmpSubscriptionAccount = NL.XTK.toString(addrArray[1])

      var tmpDeliveryAccount = NL.XTK.toString(msg.wechatService)

       

      if (tmpSubscriptionAccount != tmpDeliveryAccount)

          throw "Ignore"

     

      var response 

      response = app.sendCustomerMsgByOpenid(woaId, openId, mediaId)  

      if (response == null || response.code == null)

        throw "Internal Error: response or code is null."

     

      if (response.code != 0)

        throw response.message

       

      msgs.appendChild(<message

              id={msg.@id}

              providerId={providerId}

              status="1"

              log="Sent"

              />)

    }

    catch (e)

    {

      log = e

     

      if ( log == "Ignore" )

      {

        var excludeLog = "Ingored: not belong to the target wechat account " + BF_SERVICE_PREFIX + woaId

        msgs.appendChild(<message id={msg.@id} status={0} log={excludeLog} noRetry="true"

          providerId={providerId} />)

      }

      else

      {

        msgs.appendChild(<message id={msg.@id} status={2} log={log} noRetry="true"

          providerId={providerId} failureReason="20" failureType="1" />)

      }

    }

  }