Skip to main content

get_unique_conversation_id

This function is to create get existing unique conversation based on set of user ids and unique key.

REQUIREMENTS

To be able to implement this guide, you need to learn how to insert PHP snippets to your website.

You can find guide here: WP Beginner

Compatibility
This function compatible with Better Messages 2.0.67 or higher

If conversation with unique tag object_123 was already created for users [1,2,3] function will return existing thread_id otherwise it will create new thread_id with provided subject.

For example this will be usefully if you want to create unique conversations between buyers and seller, when they're discussing different products.

<?php
$user_ids = [1, 2];
$unique_key = 'product_123';
// Subject will be used only if conversation not exists yet
$subject = 'Questions about your Product 123';

$thread_id = Better_Messages()->functions->get_unique_conversation_id( $user_ids, $unique_key, $subject );