Skip to main content

create_new_conversation

This function is to create new empty conversation programmatically and get new conversation id

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.55 or higher
<?php
// User Ids to create conversations with
$user_ids = [
1,
2,
3
];

// Subject for new conversation
$subject = 'Conversation Subject';

// Returns conversation ID (int) if created succefully or false (boolean) if creation was not succesfull.
$thread_id = Better_Messages()->functions->create_new_conversation( $user_ids, $subject );