Skip to main content
This function and all other functions in this graphql sdk are deprecated. Please migrate to the new rest api.
This operation is only available on the server.

Required Permissions

  • chat:message:create

Usage

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

const result = "some string";