This operation is only available on the server.
Required Permissions
chat:message:create
Usage
Copy
Ask AI
import { whopSdk } from "@/lib/whop-sdk";
const result = await whopSdk.messages.sendDirectMessageToUser({
toUserIdOrUsername: "xxxxxxxxxxx" /* Required! */,
message: "some string" /* Required! */,
attachments: [
{
// This ID should be used the first time you upload an attachment. It is the ID
// of the direct upload that was created when uploading the file to S3 via the
// mediaDirectUpload mutation.
directUploadId: "xxxxxxxxxxx",
// The ID of an existing attachment object. Use this when updating a resource and
// keeping a subset of the attachments. Don't use this unless you know what you're doing.
id: "xxxxxxxxxxx",
},
],
});
Example output
Copy
Ask AI
const result = "some string";