Making outbound calls from Stringee is easy. In this building block we'll use the Call API to start a call and play a text-to-speech message on answer.
REST API calls must be authenticated using a custom HTTP header: X-STRINGEE-AUTH along with a JSON web token. Create the JWT token with format:
HEADER:
{
"typ": "JWT",
"alg": "HS256",// only support HS256
"cty": "stringee-api;v=1"
}
PAYLOAD:
{
"jti": "SK...-...",//JWT ID
"iss": "SK...",//API key sid
"exp": ...,//expiration time
"rest_api": true
}
VERIFY SIGNATURE:
HMACSHA256(
base64UrlEncode(HEADER) + "." +
base64UrlEncode(PAYLOAD),
apiKeySecret
)
SCCO in your request
curl -X POST https://api.stringee.com/v1/call2/callout \
-H "X-STRINGEE-AUTH: ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "from": {"type": "external", "number": "STRINGEE_NUMBER", "alias": "STRINGEE_NUMBER" }, \
"to": [{ "type": "external", "number": "TO_NUMBER", "alias": "TO_NUMBER" }], \
"actions": [{ "action": "talk", "text": "Chào mừng bạn đã đến với Stringee"}]}' }'
or SCCO from answer_url
curl -X POST https://api.stringee.com/v1/call2/callout \
-H "X-STRINGEE-AUTH: ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "from": {"type": "external", "number": "STRINGEE_NUMBER", "alias": "STRINGEE_NUMBER" }, \
"to": [{ "type": "external", "number": "TO_NUMBER", "alias": "TO_NUMBER" }], \
"answer_url": "https://example.com/answerurl", }'
in which:
Name | Description |
---|---|
STRINGEE_NUMBER | Your Stringee number that the call will be made from. For example 849..... |
TO_NUMBER | The number you would like to call to. For example 849...... |
ACCESS_TOKEN | JWT token |