Skip to main content

Hi,

 

I'm looking to figure out how to import an outbound message created by our automation into our custom channel for viewing in Front.

 

I currently have this api call:

 

await axios.post(

      'https://api2.frontapp.com/inboxes/inb_xxx/imported_messages',

      {

        body_format: 'markdown',

        body: 'test',

        subject: `Test Chat with ${to.first_name} (${to.type === UserType.Owner ? 'Owner' : 'Renter'})`,

        sender: {

          name: 'Test Operator',

          handle: 'test_operator',

        },

        to: e

          `test_user_id:${to.id}`,

        ],

        metadata: {

          thread_ref: `support_chat_user_id:${to.id}`,

          is_inbound: false,

          should_skip_rules: false,

        },

        external_id: `test_message_id:1234`,

        created_at: Date.now() / 1000,

        type: 'custom',

      },

      {

        headers: {

          Accept: 'application/json',

          'Content-Type': 'application/json',

          Authorization: 'Bearer ' + frontappApiKey,

        }

      }

    );

 

The problem is that the metadata.thread_ref doesn't seem to be respected in Front.

 

The imported thread comes in as one conversation, and the existing conversations remains separate. I would expect this to be threaded in one conversation, since they both have the same metadata.thread_ref.

 

Is there something else I need to specify to get the threading correct here?

The reason these aren't threading has to do with how we process the thread_ref. Custom Channels use different threading than the /imported_messages endpoint in the Core API.

 

You can use the Receive custom messages endpoint, which is specifically for custom channels, and change the sender to your bot. In doing this, it will appear as an inbound message. For it to appear as outbound, you could send automated messages from the custom channel as the bot.

 

We also offer Partner Channels, which may be a good use case for you if you're looking to compose outbound message from Front, and have the replies thread together. In other words, it will truly sync together events occurring externally to display in Front. Partner channels also have access to the Channel API.

 

You can read a bit more about the differences in Custom vs. Partner channels in this overview to decide which method would be best for your workflow.

 

I hope this is helpful! Let me know if you have any other questions and enjoy the rest of your day!

 

--Leslie


Reply