Create project campaign reply flow
Required scope: campaigns:manage
Creates an immutable reply flow revision: the steps a campaign runs when a recipient replies. Each step can send a text, reply buttons, a list, or a Flow form, and branches on the button or list row chosen, an exact keyword, or a Flow form submission. Beta.
curl --request POST \
--url https://api.polymorfa.com/messaging/projects/{projectSlug}/campaign-reply-flows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"definition": {
"entryNodeId": "<string>",
"nodes": [
{
"id": "<string>",
"edges": [
{
"match": {
"kind": "choice",
"id": "<string>"
},
"to": "<string>"
}
],
"send": {
"kind": "text",
"text": "<string>"
}
}
]
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
definition: {
entryNodeId: '<string>',
nodes: [
{
id: '<string>',
edges: [{match: {kind: 'choice', id: '<string>'}, to: '<string>'}],
send: {kind: 'text', text: '<string>'}
}
]
}
})
};
fetch('https://api.polymorfa.com/messaging/projects/{projectSlug}/campaign-reply-flows', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/messaging/projects/{projectSlug}/campaign-reply-flows"
payload = {
"name": "<string>",
"definition": {
"entryNodeId": "<string>",
"nodes": [
{
"id": "<string>",
"edges": [
{
"match": {
"kind": "choice",
"id": "<string>"
},
"to": "<string>"
}
],
"send": {
"kind": "text",
"text": "<string>"
}
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/messaging/projects/{projectSlug}/campaign-reply-flows"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"definition\": {\n \"entryNodeId\": \"<string>\",\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"edges\": [\n {\n \"match\": {\n \"kind\": \"choice\",\n \"id\": \"<string>\"\n },\n \"to\": \"<string>\"\n }\n ],\n \"send\": {\n \"kind\": \"text\",\n \"text\": \"<string>\"\n }\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}false{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"flowKey": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"revision": 123,
"name": "<string>",
"definition": {
"entryNodeId": "<string>",
"nodes": [
{
"id": "<string>",
"edges": [
{
"match": {
"kind": "choice",
"replyKind": "button",
"id": "<string>"
},
"to": "<string>"
}
],
"send": {
"kind": "text",
"text": "<string>"
}
}
]
},
"createdAt": 123
}
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_parameter",
"message": "Correct the invalid request field.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#invalid-parameter"
}{
"error": {
"type": "authentication_error",
"code": "invalid_credential",
"message": "Supply a valid credential.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#invalid-credential"
}{
"error": {
"type": "permission_error",
"code": "missing_scope",
"message": "The credential lacks a required API scope.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#missing-scope"
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "The resource is unavailable to this caller.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#resource-not-found"
}{
"error": {
"type": "conflict_error",
"code": "state_conflict",
"message": "The request conflicts with the resource state.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#state-conflict"
}{
"error": {
"type": "api_error",
"code": "internal_error",
"message": "An unexpected service failure occurred. Keep the request ID for support.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#internal-error"
}Authorizations
Polymorfa organization key (pmfa_ prefix), project token (pmfa_pt_ prefix) where supported, or short-lived client token (pmfa_ct_ prefix). Organization and project keys may be personal or service-account owned and enforce selected action scopes. Organization keys cover the team and its projects; project tokens stay inside one project. Client tokens stay inside their live project and session and enforce their client rules.
Path Parameters
Specifies project slug for this path parameter.
Body
Human-readable name for this resource.
Value constraints
| Constraint | Accepted input |
|---|---|
| String length | 1 through 128 characters |
1 - 128Structured definition for this resource.
Show child attributes
Show child attributes
Existing flow key to add a revision to. Omit to start a new reply flow.
Value constraints
| Constraint | Accepted input |
|---|---|
| Format | uuid |
Revision number. Defaults to 1; each key and revision can be created once.
Value constraints
| Constraint | Accepted input |
|---|---|
| Numeric value | 1 through 1000000 (inclusive) |
1 <= x <= 1000000Was this page helpful?
curl --request POST \
--url https://api.polymorfa.com/messaging/projects/{projectSlug}/campaign-reply-flows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"definition": {
"entryNodeId": "<string>",
"nodes": [
{
"id": "<string>",
"edges": [
{
"match": {
"kind": "choice",
"id": "<string>"
},
"to": "<string>"
}
],
"send": {
"kind": "text",
"text": "<string>"
}
}
]
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
definition: {
entryNodeId: '<string>',
nodes: [
{
id: '<string>',
edges: [{match: {kind: 'choice', id: '<string>'}, to: '<string>'}],
send: {kind: 'text', text: '<string>'}
}
]
}
})
};
fetch('https://api.polymorfa.com/messaging/projects/{projectSlug}/campaign-reply-flows', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/messaging/projects/{projectSlug}/campaign-reply-flows"
payload = {
"name": "<string>",
"definition": {
"entryNodeId": "<string>",
"nodes": [
{
"id": "<string>",
"edges": [
{
"match": {
"kind": "choice",
"id": "<string>"
},
"to": "<string>"
}
],
"send": {
"kind": "text",
"text": "<string>"
}
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/messaging/projects/{projectSlug}/campaign-reply-flows"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"definition\": {\n \"entryNodeId\": \"<string>\",\n \"nodes\": [\n {\n \"id\": \"<string>\",\n \"edges\": [\n {\n \"match\": {\n \"kind\": \"choice\",\n \"id\": \"<string>\"\n },\n \"to\": \"<string>\"\n }\n ],\n \"send\": {\n \"kind\": \"text\",\n \"text\": \"<string>\"\n }\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}false{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"flowKey": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"revision": 123,
"name": "<string>",
"definition": {
"entryNodeId": "<string>",
"nodes": [
{
"id": "<string>",
"edges": [
{
"match": {
"kind": "choice",
"replyKind": "button",
"id": "<string>"
},
"to": "<string>"
}
],
"send": {
"kind": "text",
"text": "<string>"
}
}
]
},
"createdAt": 123
}
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_parameter",
"message": "Correct the invalid request field.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#invalid-parameter"
}{
"error": {
"type": "authentication_error",
"code": "invalid_credential",
"message": "Supply a valid credential.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#invalid-credential"
}{
"error": {
"type": "permission_error",
"code": "missing_scope",
"message": "The credential lacks a required API scope.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#missing-scope"
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "The resource is unavailable to this caller.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#resource-not-found"
}{
"error": {
"type": "conflict_error",
"code": "state_conflict",
"message": "The request conflicts with the resource state.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#state-conflict"
}{
"error": {
"type": "api_error",
"code": "internal_error",
"message": "An unexpected service failure occurred. Keep the request ID for support.",
"param": null,
"request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#internal-error"
}