Suggestions

close search

Make outbound calls

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.

Prerequisites

  1. Create a project
  2. Buy a virtual number

The workflow to make a Call:

  1. You make an authenticated Call request to the Call API.
  2. Stringee accepts the request and sends response information.
  3. Stringee places a call and awaits an answer.
  4. On answer, Stringee follows the actions in your SCCO (your SCCO in request. If not exist SCCO in your request, Stringee makes a GET request to retrieve an SCCO from your answer_url webhook endpoint).
  5. Stringee sends a POST request to your event_url webhook endpoint when the Call status changes.

Make a Call:

  1. Create a JWT for authentication (see Authentication )

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
    )
  1. Make a call:

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