Question about imported messages and rules

  • 12 January 2023
  • 6 replies

Badge +2

Currently we have a rule for our team that when triggered sends an auto reply to the sender. We have changed something about our setup where this rule is no longer working properly.  I am hoping to get some assistance

Here is the specific use case:


"A client requests a quote, the php backend sends an email to one of our addresses with the requested quote details. A front rule is triggered to send an auto-reply to the reply to address."


Up until now the server for our website has been using phpmailer to send to one our emails, and it sets the replyTo email to the email we want to respond to.  The rule is triggered, the auto reply is sent, and it includes the body of the original message in the auto reply. I am told this all works fine. 


But we are currently making a change to our system and may have to move away from using phpmailer. I have been testing using the front API to send the initial message. My problem is that I can't seem to get a combination of API endpoints and rule configuration to have the same functionality as above. Here are some of the things I have tried.


First it doesn't seem like there is a reply To functiionality in the API, just setting the sender, which may equate to the same thing.


Second have figured that the import message endpoint is the only endpoint which I have found that allows us to set the sender of email. But when I use this endpoint with the metadata.should_skip_rules property set to false, the rule is triggered - I know because tags are added which are included in the ruleset - but the auto reply is not set. 


So then I thought what If i use the API to send the reply myself, but I can't seem to figure out how to do this. I am able to get the html for our message template that we would reply with, but I cannot find the endpoint to reply to an imported message. The "Reply To Conversation" endpoint requires a convesation_id, but the Import Message endpoint returns a conversation_reference, which is a super long string.


So just to make this more succinct. Here is what I hope you can help me with. 


Either 1) Provide some insight why the rule, although being triggered for imported messages, does not send the auto reply.


or 2) Please help me figure out which set of api endpoints would produce the following scenario:


sending a message to our backend from (e.g.) with body


"A new quote has been requested ....

.... etc.".


then replying to with a message template which includes the body of the above message.



I know this is a lot, but I appreciate any help you can give.


Many thanks!


Best answer by Support Engineering 12 January 2023, 16:57

View original

6 replies

Userlevel 1
Badge +5

For the API part, I can tell you that when you use the import message endpoint, one of the fields in your API response payload will be message_uid.

You can call GET /messages/alt:uid:<the_message_uid> to return the message (including conversation ID); you then issue another request to send the reply to that conversation based on that ID. 


To share a practical example:

POST /inboxes/:inbox_id/imported_messages

==> {

  "status": "accepted",

  "message_uid": "abc123",

  "conversation_refererence": "string..."


GET /messages/alt:uid:abc123

=> {

  "_links": {

    "self": "string",

    "related": {

      "conversation": "",



  "id": "string",

  "type": "email",



POST /conversations/cnv_456/messages

 ==> sends reply



Badge +2

As an update, your method of retrieving the message, then getting the conversation id worked. But I had to parse the conversation id from $return['_links']['related']['conversation']


I'm using php so as a test I used


.but I suppose a better way might be to use regex. Are we sure that link won't change?

Userlevel 1
Badge +5

For the rule part, it's important to note that auto-replies only use channels connected to the conversation. So for example, you can typically expect an email received on to send an auto-reply from When using the import message endpoint, you put the conversation in an inbox without connecting it to a channel, so auto-replies will not work here. 


For extracting the conversation ID, your current method should be sage. We'll be sure to provide plenty of notice in a case where we feel the need to change our API URLs; we know our customers depend on our API structure remaining stable.

That being said, you can also consider using a regex to match "cnv_[alphanumeric string]\[word boundary]" - something like the example in the screenshot below might work for you (disclaimer - I'm not an expert in regular expressions!)



Badge +2

Thanks Jason, who is an expert in regular expressions? I still look them up every time. For replying to conversations do we have any control whether previous messages get included in the reply? is this up to us, or to the end user's email system. I'm very confused about this. 

Userlevel 1
Badge +5



For replies sent via the API, we do not include the previous message history in the conversation.


Considering you will have the previous message body accessible in your API call process, you could send it in a <quote></quote> block like you see below in order to ensure the recipient sees what is being replied to:


quote previous history


Please let me know if you have any further questions



Badge +2

Thanks for clearing all this up. Have a good day!