Announcement

Collapse
No announcement yet.

How to Get HTTP Listener Response Message

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to Get HTTP Listener Response Message

    Would you mind to help me sir. I tried to read the latest manual "NextGen Connect 38 User Guide.pdf" but I found its hard to find what I need.

    I'm using MirthConnect v3.6

    Connector type = HTTP Listener
    Destination tab > To = I type 2 emails (comma separated)

    This channel can be successfully call (received on both emails). How to get response saying that email1 success, email2 fail due to full box, etc. Does programming involved to archive this?

    In the Source tab > Response field, I have select Auto-generated (Destination completed).

    When calling the API using Postman, after the API success, no message/result. But it success.

    I dont mind the response format. JSON is the best but plain text is ok.
    Last edited by coisox; 04-07-2020, 11:04 PM. Reason: Add more information

  • #2
    In order to use an autogenerated response, the inbound data type on the source connector must have a "Response Generation" section. In open source mirth, only the hl7v2 datatype has this section.

    If you want to create a status report of all destinations, the easiest place to do that is in the post-processor. Then on your source tab, instead of picking the autogenerate option, choose post-processor instead.

    You should be able to find other examples on this forum of checking destination statuses in the post-processor.

    Comment


    • #3
      Originally posted by agermano View Post
      In order to use an autogenerated response, the inbound data type on the source connector must have a "Response Generation" section. In open source mirth, only the hl7v2 datatype has this section.

      If you want to create a status report of all destinations, the easiest place to do that is in the post-processor. Then on your source tab, instead of picking the autogenerate option, choose post-processor instead.

      You should be able to find other examples on this forum of checking destination statuses in the post-processor.
      Thank you sir. I'll take a look on ur suggestion.

      Comment


      • #4
        Here's what I have done:

        Summary Tab:
        ....Set Data Types:
        ........In/Outbound: HL7 v2.x
        ........In/Outbound Properties: Default (I don't know all those jargon AA, AE, etc)

        Source Tab:
        ....Connector Type: HTTP Listener
        ....Response: Postprocessor

        Destination Tab:
        ....Connector Type: SMTP Sender
        ....To: [email protected]

        Script Tab:
        ....Script: Postprocessor
        ....Textarea:
        Code:
        var httpResponse = responseMap.get('status');
        
        var data = {
            "status": httpResponse.getStatus().toString(),
            "message": httpResponse.toString(),
            "ResponseFactory1": ResponseFactory.getSentResponse('message').toString(),
            "ResponseFactory2": ResponseFactory.getErrorResponse('message').toString()
        }
        
        return ResponseFactory.getSentResponse(JSON.stringify(data));
        Then in my browser, I simply type the Mirth API URL and get this result:
        Code:
        {
            status: "SENT",
            message: "SENT: Email sent successfully.",
            ResponseFactory1: "SENT",
            ResponseFactory2: "ERROR"
        }
        I think I've made some progress here (at least I got return message). But I would be more happier if the return message is something like "Email not exist" instead of "SENT: Email sent successfully."

        I believe there are tones of existing questions in this forum which could bring my desired result, but due to my very limitted knowledge, lack of understanding on the jargon words, I can't search what I'm looking for. I don't even know the proper keywords to search.

        Or maybe what I'm looking for is impossible at all? There's no way Mirth can know what happen after it send the email?

        Comment


        • #5
          The user guide that is available on the mirth downloads page is a good place to start.

          Your inbound data type should match what the channel is receiving. You shouldn't use hl7 if that's not what you're sending. You can use Raw if you are not sending a message to the channel in any specific format or if you are sending blank messages with a GET request.

          Originally posted by coisox View Post
          Or maybe what I'm looking for is impossible at all? There's no way Mirth can know what happen after it send the email?
          I think you are correct. As long as the SMTP server accepts the message and does not return an error, the message is considered sent. Mirth has no way to watch a return mailbox for bouncebacks or undeliverable messages. That is something you could implement yourself if you really needed to, but I think it would be difficult.

          Comment


          • #6
            Thank you sir for the guidance. Appreciate ur time.

            Comment

            Working...
            X