Message

Send message

POST/api/v1/messages/send

This endpoint allows you to send an outgoing message to a specific contact via the Klink platform.

Sending files from your own URL (externalMedia)

  • Only url is required. fileName, fileType and fileSize are filled in automatically when omitted: the name from the URL, the type from the file extension, and the size from your server's Content-Length.
  • The customer receives your original URL. Klink does not re-host the file, so keep it publicly reachable.
  • LINE only accepts HTTPS URLs for images and videos.
  • To upload a file to Klink instead, use Upload File (multipart) in Media Manager and send its ID as mediaFileId.

Sending a WhatsApp template (whatsappTemplate)

Send an approved WhatsApp template, for example to message a customer outside WhatsApp's 24-hour window.

  • Works only when the contact's latest conversation is on an official WhatsApp channel (360dialog / Meta). QR-linked WhatsApp numbers have no templates.
  • name is the template name. language is only needed when the same name exists in more than one language.
  • variables fills the body placeholders: "1" for {{1}}, or the name for a named placeholder such as {{first_name}}. Every placeholder needs a value.
  • messageType can be omitted; templates are always sent as text. message is optional: by default the Klink inbox shows the template text with your variables filled in.
  • Only APPROVED templates can be sent. Use List WhatsApp templates to see a channel's templates and the variables each one needs.
  • Can't be combined with mediaFileId, externalMedia or platformUserId.
  • Returns 400 with the reason if the contact has no conversation, the channel isn't official WhatsApp, the template isn't found or approved, or a variable is missing.

Request

Authorization

Bearer Token

Provide your API token in the Authorization header. See Authentication to issue one.

Example:Authorization: Bearer ********************

Body Paramsapplication/json
  • contactIdstringrequired
  • messageTypestringrequired

    text, image, video, audio or file.

  • messagestringrequired
  • mediaFileIdstringoptional

    Only use one, externalMedia or mediaFileId when sending video, image, file

  • externalMediaobjectoptional

    Send a file hosted on your own server. Use either externalMedia or mediaFileId, not both. The file is delivered from your URL as-is (Klink does not copy it), so it must stay publicly reachable. LINE requires HTTPS for images and videos.

    Child attributes
    • urlstringrequired

      Public URL of the file (https recommended).

      Example:https://example.com/files/report.pdf

    • fileTypestringoptional

      MIME type (application/pdf) or file extension (pdf). Optional: inferred from the file name or the server's Content-Type.

      Example:application/pdf

    • fileNamestringoptional

      Name shown to the customer. Defaults to the last segment of the URL (e.g. report.pdf).

      Example:report.pdf

    • fileSizeintegeroptional

      Size in bytes. Optional: read from the server's Content-Length when omitted.

      Example:1005148

    • widthintegeroptional

      Image/video width in pixels (optional).

    • heightintegeroptional

      Image/video height in pixels (optional).

  • createdAtstringrequired
  • whatsappTemplateobjectoptional

    Send an approved WhatsApp template instead of free text

    Child attributes
    • namestringrequired

      Template name, e.g. welcomemessage

    • languagestringoptional

      Language code, e.g. en; only needed when the name exists in several languages

    • variablesobjectoptional

      Values keyed by placeholder: "1" for {{1}}, or first_name for {{first_name}}

Responses

200

OK

  • statusintegerrequired
  • messagestringrequired
  • dataobjectrequired
    Child attributes
    • idstringrequired
    • createdAtstringrequired
    • updatedAtstringrequired
    • deletedAtnullrequired
    • clientRequestIdstringrequired
    • partition_keystringrequired
    • messagestringrequired
    • directionstringrequired
    • typestringrequired
    • readAtnullrequired
    • metadataobjectrequired
    • platformIdstringrequired
    • platformMessageIdstringrequired
    • replyPlatformMessageIdnullrequired
    • replyReactionnullrequired
    • linkMessageIdnullrequired
    • linkMessagePartitionKeynullrequired
    • templatenullrequired
    • localestringrequired
    • urlstringrequired
    • previewUrlstringrequired
    • imageSetIdstringrequired
    • roomIdstringrequired
    • roomobjectrequired
    • actorIdnullrequired
    • actorTypestringrequired
    • actornullrequired
    • uploadIdstringrequired
    • uploadobjectrequired
      Child attributes
      • createdAtstringrequired
      • updatedAtstringrequired
      • deletedAtnullrequired
      • fileNamestringrequired
      • fileSizeintegerrequired
      • originalUrlstringrequired
      • fileUrlstringrequired
    • senderIdnullrequired
    • workflowRulenullrequired
    • assigneeIdnullrequired
    • assigneenullrequired
    • repliedMessagenullrequired
    • editedMessageIdnullrequired
    • editedMessagePartitionKeynullrequired
    • editedMessagenullrequired
    • isEditedbooleanrequired
    • editedAtnullrequired
    • labelstringrequired
    • contactIdnullrequired
    • receiverMetadatanullrequired
    • attachmentsnullrequired
400

Bad Request

  • messagearray[string]required
  • errorstringrequired
  • statusCodeintegerrequired