Create WhatsApp shared line assignment
Create WhatsApp shared line assignment: createWhatsappSharedLineAssignment in the TypeScript, Python, Rust and Go clients.
POST /v1/projects/{id}/platforms/whatsapp/assignments
Maps an end user's phone number onto one of the project's pooled shared WhatsApp lines, consuming a seat from the project's WhatsApp entitlement. The assigned number is allocated by the server. When an email address is supplied the user is sent an invite asynchronously; the response never reports whether that succeeded. Requires the platforms:write permission bound to the project resource in the path.
photon.projects.platforms.createWhatsappSharedLineAssignment(input: CreateWhatsappSharedLineAssignmentInput, options?: RequestOptions): Promise<CreateWhatsappSharedLineAssignmentOutput>photon.projects.platforms.create_whatsapp_shared_line_assignment(input: CreateWhatsappSharedLineAssignmentInput, *, options: RequestOptions | None = None,) -> models.SharedLineAssignmentclient.create_whatsapp_shared_line_assignment(idempotency_key: String, id: String, body: &types::CreateWhatsappSharedLineAssignmentRequest).await -> Result<ResponseValue<types::SharedLineAssignment>, Error<CreateWhatsappSharedLineAssignmentError>>client.Projects.Platforms.CreateWhatsappSharedLineAssignment(ctx context.Context, params *CreateWhatsappSharedLineAssignmentParams, opts ...RequestOption) (*SharedLineAssignment, error)import { Photon } from "@photon-ai/api";
const photon = new Photon({
headers: { Authorization: `Bearer ${process.env.PHOTON_API_TOKEN}` },
});
const result = await photon.projects.platforms.createWhatsappSharedLineAssignment({
path: {
id: "id",
},
headers: {
idempotencyKey: "idempotencyKey",
},
body: {
handle: "handle",
},
});import os
from photon_api import Photon
from photon_api.rpc_generated import CreateWhatsappSharedLineAssignmentInput
photon = Photon(headers={"Authorization": f"Bearer {os.environ['PHOTON_API_TOKEN']}"})
result = photon.projects.platforms.create_whatsapp_shared_line_assignment(
CreateWhatsappSharedLineAssignmentInput.model_validate({
"path": {
"id": "id",
},
"headers": {
"Idempotency-Key": "idempotencyKey",
},
"body": {
"handle": "handle",
},
})
)use photon_ai_api::{Credential, PhotonClientBuilder, SecretString};
let token = std::env::var("PHOTON_API_TOKEN")?;
let client = PhotonClientBuilder::new()
.credential("accountServiceKey", Credential::Bearer(SecretString::from(token)))
.build()?;
let result = client
.create_whatsapp_shared_line_assignment(
"idempotencyKey".to_owned(),
"id".to_owned(),
&serde_json::from_value(serde_json::json!({
"handle": "handle",
}))?,
)
.await
.map_err(|error| format!("{error:?}"))?
.into_inner();import (
"context"
"encoding/json"
"os"
photonapi "github.com/photon-hq/api/packages/go"
)
ctx := context.Background()
client := photonapi.NewClient(photonapi.WithAPIKey(os.Getenv("PHOTON_API_TOKEN")))
var body photonapi.CreateWhatsappSharedLineAssignmentRequest
if err := json.Unmarshal([]byte(`{
"handle": "handle"
}`), &body); err != nil {
return err
}
result, err := client.Projects.Platforms.CreateWhatsappSharedLineAssignment(ctx, &photonapi.CreateWhatsappSharedLineAssignmentParams{
IdempotencyKey: "idempotencyKey",
ID: "id",
Body: body,
})
if err != nil {
return err
}
_ = result{
"assignedPhoneNumber": "string",
"assignmentId": "string",
"createdAt": "2026-01-01T00:00:00.000Z",
"email": "string",
"firstName": "string",
"handle": "string",
"lastName": "string",
"optIn": {
"receivedAt": "2026-01-01T00:00:00.000Z",
"state": "pending"
},
"platform": "imessage",
"projectId": "string",
"releasedAt": "2026-01-01T00:00:00.000Z",
"updatedAt": "2026-01-01T00:00:00.000Z"
}Parameters
Selects the API contract date. Without it, the request is served as 2026-07-01.
Identifies one logical mutation across retries.
Body
Returns
201 The created WhatsApp shared line assignment. SharedLineAssignment
Headers: Photon-Version. The raw response carries these headers; see Raw responses.
Whether the end user has texted the assigned line from their handle since this assignment was created. Until they have, sends to them on this line are refused; once they have, the project can message them while the assignment is unreleased. A released assignment keeps its opt-in, and a re-created assignment starts pending. This records only that Photon allows replies; it is not a consent record for SMS compliance.