VayaFlow
SMS

Send an SMS message

Sends an SMS message to a contact. Only the contact ID and message are required — the recipient phone, sender phone, and SMS provider are automatically resolved from the contact and playbook configuration. The recipient defaults to the contact phone on file. The sender is resolved from the playbook assigned phone number, then the SMS agent phone, then the first SMS-capable number. The provider follows the playbook-level override, then the tenant default, then Vonage. If an interactionId is provided, the message is appended to an existing conversation. Otherwise, the system finds or creates a conversation automatically.

POST
/api/v1/sms/send

Authorization

ApiKeyAuth
X-API-Key<token>

API key generated from your Vayaflow dashboard Settings page

In: header

Request Body

application/json

contactId*string

The contact to send the SMS to

message*string

The SMS message body (1–1600 characters).

Length1 <= length <= 1600
to?string

Override the recipient phone number (E.164 format). If omitted, uses the contact's phone on file.

from?string

Override the sender phone number. If omitted, auto-resolves from the playbook's assigned phone number.

playbookId?string

The playbook this text is for. The contact must be active in it, and it must be live. If omitted, uses the contact's current playbook; a contact in no playbook is refused (NOT_IN_PLAYBOOK) unless they are texting with you in an open conversation.

interactionId?string

Append to an existing SMS conversation. If omitted, a new conversation is created or an existing one is found automatically.

Response Body

application/json

application/json

application/json

application/json

package mainimport (  "fmt"  "net/http"  "io/ioutil"  "strings")func main() {  url := "https://api.vayaflow.com/api/v1/sms/send"  body := strings.NewReader(`{    "contactId": "contact_abc123",    "message": "Hi John, just following up on your inquiry."  }`)  req, _ := http.NewRequest("POST", url, body)  req.Header.Add("Content-Type", "application/json")  res, _ := http.DefaultClient.Do(req)  defer res.Body.Close()  body, _ := ioutil.ReadAll(res.Body)  fmt.Println(res)  fmt.Println(string(body))}
{
  "success": true,
  "data": {
    "messageId": "msg_abc123",
    "status": "sent",
    "interactionId": "int_abc123"
  }
}
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid input data",
    "details": [
      "string"
    ]
  }
}
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Authentication required"
  }
}
{
  "success": false,
  "error": {
    "code": "NOT_FOUND",
    "message": "Resource not found"
  }
}