Skip to main content
This recipe creates a Contact, starts a Conversation with an internal Bridge User, and creates a Message. Run it on your server.
Use a test Contact you are authorized to message. Creating a Conversation can run the workspace’s onboarding templates before the separate Message request. Review that configuration first; setting the later Message’s broadcast flag to false does not disable Conversation onboarding.

Before you start

  • Get a server-side API Key from Authentication.
  • Obtain your workspace ID, an active WhatsApp line’s providerChannelId, and an internal Bridge User’s email. See Identifiers and concepts.
  • Use a new test phone number in international format. If the Contact already exists, use contact lookup instead of creating it again.
  • Check any required custom attributes and the workspace’s onboarding sequence. This minimal example does not supply custom attributes or override templates.
  • Choose enableExternalBroadcast explicitly: true requests external delivery when conversation and recipient rules permit it; false still creates the Message but skips external broadcast. Neither value confirms provider delivery. This flag does not override visibility or permissions.

The sequence

The Contact’s id becomes the external participant’s identifier with identifierType: "ID". The Conversation’s id becomes the Message’s conversationId.

Run the example

Use Node.js with built-in fetch. Save this as first-conversation.mjs. Supply these environment variables through your server’s secret and configuration settings: The names and message below are examples. Replace them with your intended test content before running.

Understand the result

  • A 201 Contact response gives you the Contact’s identity and workspace. Read type to see its actual NORMAL or PARTIAL classification.
  • A 201 Conversation response gives you the ID to use next. When no line is free, Bridge can recover a released Conversation with exactly the requested participants. That keeps its ID and history; the requested name and status are not applied in that recovery case.
  • A 201 Message response supplies messageId. It does not by itself prove that WhatsApp delivered the message to the Contact.
This recipe explicitly assigns an internal Bridge User. For a team assignment, use the documented teamId option instead of participants.internals; they are mutually exclusive.

If a step fails

The example stops at the failed request and never retries a write automatically. A network failure can leave the outcome uncertain. Check the relevant resource before repeating a create or send operation. See Responses and errors for response shapes and recovery decisions.

Next steps