Testing
Create testing history fixture
Required scope: sandbox:write
POST
/
messaging
/
testing
/
{projectId}
/
history-fixtures
Create testing history fixture
curl --request POST \
--url https://api.polymorfa.com/messaging/testing/{projectId}/history-fixtures \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"id": "<string>",
"senderPhone": "<string>",
"text": "<string>",
"timestamp": 1,
"fromMe": true
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [
{
id: '<string>',
senderPhone: '<string>',
text: '<string>',
timestamp: 1,
fromMe: true
}
]
})
};
fetch('https://api.polymorfa.com/messaging/testing/{projectId}/history-fixtures', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/messaging/testing/{projectId}/history-fixtures"
payload = { "messages": [
{
"id": "<string>",
"senderPhone": "<string>",
"text": "<string>",
"timestamp": 1,
"fromMe": True
}
] }
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/testing/{projectId}/history-fixtures"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"id\": \"<string>\",\n \"senderPhone\": \"<string>\",\n \"text\": \"<string>\",\n \"timestamp\": 1,\n \"fromMe\": true\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{
"fixtureId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_parameter",
"message": "Correct the invalid request field.",
"param": null
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#invalid-parameter"
}{
"error": {
"type": "permission_error",
"code": "permission_denied",
"message": "The credential does not have access to this resource.",
"param": null
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#permission-denied"
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "The resource is unavailable to this caller.",
"param": null
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#resource-not-found"
}{
"error": {
"type": "upstream_error",
"code": "upstream_failure",
"message": "The messaging provider could not complete the request.",
"param": null
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#upstream-failure"
}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
Identifier of the Polymorfa project that owns this resource.
Value constraints
| Constraint | Accepted input |
|---|---|
| Format | uuid |
Body
application/json
Messages associated with this schema.
Value constraints
| Constraint | Accepted input |
|---|---|
| Array size | At most 100 items |
Maximum array length:
100Show child attributes
Show child attributes
Response
Project-scoped history fixture
Identifier for the fixture.
Value constraints
| Constraint | Accepted input |
|---|---|
| Format | uuid |
Was this page helpful?
⌘I
Create testing history fixture
curl --request POST \
--url https://api.polymorfa.com/messaging/testing/{projectId}/history-fixtures \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"id": "<string>",
"senderPhone": "<string>",
"text": "<string>",
"timestamp": 1,
"fromMe": true
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [
{
id: '<string>',
senderPhone: '<string>',
text: '<string>',
timestamp: 1,
fromMe: true
}
]
})
};
fetch('https://api.polymorfa.com/messaging/testing/{projectId}/history-fixtures', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/messaging/testing/{projectId}/history-fixtures"
payload = { "messages": [
{
"id": "<string>",
"senderPhone": "<string>",
"text": "<string>",
"timestamp": 1,
"fromMe": True
}
] }
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/testing/{projectId}/history-fixtures"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"id\": \"<string>\",\n \"senderPhone\": \"<string>\",\n \"text\": \"<string>\",\n \"timestamp\": 1,\n \"fromMe\": true\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{
"fixtureId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_parameter",
"message": "Correct the invalid request field.",
"param": null
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#invalid-parameter"
}{
"error": {
"type": "permission_error",
"code": "permission_denied",
"message": "The credential does not have access to this resource.",
"param": null
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#permission-denied"
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "The resource is unavailable to this caller.",
"param": null
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#resource-not-found"
}{
"error": {
"type": "upstream_error",
"code": "upstream_failure",
"message": "The messaging provider could not complete the request.",
"param": null
},
"data": null,
"docs": "https://docs.polymorfa.com/api/errors#upstream-failure"
}