Making Your First Call

Let's walk through the complete process of making an automated call with Gomobile. By the end of this guide, you'll have created a contact, built an audience, set up a simple flow, and launched a program that actually places a call.

Before you start

Make sure you have:

  • An authenticated session (see Authentication)

  • Your access token ready

  • A phone number you can call for testing

We'll use curl commands throughout, but you can adapt these to any HTTP client.

Step 1: Create a contact

First, add the person you want to call:

# Create a new contact in your Gomobile account
curl -X POST https://api.gomobile.ma/api/contact \
  -H "Authorization: Bearer YOUR_API_KEY" \    # Your API key for authentication
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "Test",                        # Contact's first name
    "lastName": "User",                         # Contact's last name
    "primaryPhone": "+212612345678"             # Phone number to call (with country code)
  }'

Save the id from the response—you'll need it in the next step.

Step 2: Create an audience

Audiences are groups of contacts. Even for a single contact, you need an audience:

Save the audience id from the response.

Step 3: Add the contact to the audience

Link your contact to the audience:

Step 4: Create a flow

Flows define what happens during a call. Here's a simple flow that dials the contact, plays a greeting message, and hangs up:

Save the flow id.

Note: Replace AUDIO_ID with the ID of your pre-recorded audio file. You can upload audio files via the Audio Management API. See the Designing Call Flows guide for more advanced examples with menus and user input handling.

Step 5: Create a program

Programs tie everything together. They specify which audience to call, which flow to use, and when to execute:

The didPool contains the phone numbers that will show up as the caller ID. Make sure you're using numbers assigned to your account.

Step 6: Launch the program

Programs start in draft status. To execute them, launch an execution:

Response:

Step 7: Monitor the execution

Check how your execution is progressing:

You'll see the status and progress counters:

Alternative: Ad-hoc calls

If you don't need the full program infrastructure, you can make one-off calls directly:

This is useful for testing flows or making individual calls outside of a campaign.

What's next?

You've made your first call! Here's where to go from here:

Last updated