Mailgun: Is there a way to get the saved message, call to the webhawk?

I have a Mailgun app with an inbound route configured like this:

match_recipient('me@example.com')
store(notify='https://www.example.com/endpoint')

      

At some point, I switched the domain from www.example.com

to www.example2.com

with a 301 redirect via a DNS provider (read: I can't access the logs ..) without changing the Mailgun routes.

Over the course of a few days, I got a bunch of persistent errors in the logs as the web host doesn't seem to be watching for redirects.

Now I would like to try to get these saved messages, but there I didn't find a way to get the original ID.

This is what is stored in the Mailgun event log:

{
  "severity": "permanent",
  "tags": [],
  "delivery-status": {
    "retry-seconds": 14400,
    "message": "<html><body>You are being <a href=\"https://www.example2.com/endpoint\">redirected</a>.</body></html>",
    "code": 301,
    "description": "<html><body>You are being <a href=\"https://www.example2.com/endpoint\">redirected</a>.</body></html>",
    "session-seconds": 0.7563347816467285
  },
  "envelope": {
    "targets": "https://www.example.com/endpoint",
    "transport": "http",
    "sender": "postmaster@example.com"
  },
  "log-level": "error",
  "id": "dffZ3qigQpyKGNdwhfj26A",
  "campaigns": [],
  "reason": "old",
  "user-variables": {},
  "flags": {
    "is-routed": null,
    "is-authenticated": true,
    "is-callback": true,
    "is-system-test": false,
    "is-test-mode": false
  },
  "timestamp": 1430473028.303534,
  "message": {
    "headers": {
      "to": null,
      "message-id": "20150430214155.10820.14949@example.com",
      "from": "postmaster@example.com",
      "subject": null
    },
    "attachments": [],
    "recipients": [
      "https://example.com/endpoint"
    ],
    "size": 47467
  },
  "recipient": "https://example.com/endpoint",
  "event": "failed"
}

      

(1) In the above example it id

is represented as an event ID which I think is irrelevant, and the message ID is 20150430214155.10820.14949

.

(2) In a typical webhook success scenario, the message sent to the server contains a callback url to receive the message that looks like this:

https://api.mailgun.net/v2/domains/www.example.com/messages/WyI4MzNheDUxMmRjIiwgWyI0ZWFiNWM1Mi05Zjg4LTRkMjctYjdhMS04ZTM3Y2E3ZDJmNTkiXSwgIm1haWxndW4iLCAib2xkY29rZSJd

      

This is a Base64 encoded message of the following type (all UIDs changed):

["833ax512dc", ["4eab5c52-9f88-4d27-b7a1-8e37ca7d2f59"], "mailgun", "oldcoke"]

      

Is there a way to construct a Saved Posts Search URL using post id 20150430214155.10820.14949?

+3


source to share


1 answer


It might be too late for AmitA , but if anyone else wants to know a way to get this search url, my approach was to use the events API:

GET / events? message-id = {your message id}

This returns a response with a list of results under the "items" key. These elements will have this URL under the key "storage" as "url".



So, if there response

is a response from this GET call, the URL for the first response will be found in response['items'][0]['storage']['url']

.

I hope this helps someone!

+3


source







All Articles