Voice Engagement using the API
Make Bulk Calls
Prerequisites
- Validate a caller id under “Account”, “Telephony”, “Caller IDs”
- Retrieve the UUID from the URL to be used when creating the engagement activity. See “caller-id” relationship below example.
- Create and retrieve API Token under “Developer”, “API Tokens”
- Use as basic authorization header, example below
- Construct string separated by a colon “user:pass” and then base64 encode. See: https://tools.ietf.org/html/rfc7617
- Retrieve account key from “Account”, “Settings”, “General” (e.g., “firstbank”)
- Use as `X-Account-Key` header
API Documentation
Creating a voice engagement requires the following:
- Create a voice template: https://omnigage.docs.apiary.io/#reference/call-resources/voice-template
- Note: Retrieve the voice template ID to be used when creating the trigger.
- Create an engagement: https://omnigage.docs.apiary.io/#reference/engagement-resources/engagement-collection/create-engagement
- Note: Retrieve the engagement ID to be used when creating the activity, triggers, and envelopes.
- Create an activity: https://omnigage.docs.apiary.io/#reference/engagement-resources/activity-collection/create-activity
- Note: Requires the engagement ID and caller ID.
- Create a trigger: https://omnigage.docs.apiary.io/#reference/engagement-resources/trigger-collection/create-trigger
- Note: Requires activity ID and voice template ID
- Create envelopes: https://omnigage.docs.apiary.io/#reference/engagement-resources/envelope-collection/create-envelope
- Note: See the example below for creating bulk requests using headers `Content-Type` and `Accept` of `application/vnd.api+json; ext=bulk`
Example Requests
1. Create a Voice Template
POST /api/v1/voice-templates Host: api.omnigage.io X-Account-Key: firstbank Authorization: Basic SDcyTFk0clFIU1hUYUIzR2Z { "data": { "type": "voice-templates", "attributes": { "subject": "Weekly Specials", "kind": "text", "body": "Hello {{first-name}}, voice template support variables.", "voice": "Polly-Brian" } } }
2. Create Engagement
POST /api/v1/engagements Host: api.omnigage.io X-Account-Key: firstbank Authorization: Basic SDcyTFk0clFIU1hUYUIzR2Z { "data": { "type": "engagements", "attributes": { "name": "Voice Blast", "direction": "outbound" } } }
3. Create an Activity
POST /api/v1/activities Host: api.omnigage.io X-Account-Key: firstbank Authorization: Basic SDcyTFk0clFIU1hUYUIzR2Z { "data": { "type": "activities", "attributes": { "name": "Voice Blast", "kind": "voice" }, "relationships": { "engagement": { "data": {"type": "engagements", "id": "cu8Eo9RyrUsV4MXEiDZpLM"} }, "caller-id": { "data": {"type": "caller-ids", "id": "Lv8UgucPVGWcwZd9Hre9dn"} } } } }
4. Create a Trigger for Machine
POST /api/v1/triggers Host: api.omnigage.io X-Account-Key: firstbank Authorization: Basic SDcyTFk0clFIU1hUYUIzR2Z { "data": { "type": "triggers", "attributes": { "kind": "say", "on-event": "voice-machine" }, "relationships": { "activity": { "data": {"type": "activities", "id": "cu8Eo9RyrUsV4MXEiDZpLM"} }, "voice-template": { "data": {"type": "voice-templates", "id": "RyrUsV4MXEicu8Eo9DZpLM"} } } } }
5. Create a Trigger for Human
POST /api/v1/triggers Host: api.omnigage.io X-Account-Key: firstbank Authorization: Basic SDcyTFk0clFIU1hUYUIzR2Z { "data": { "type": "triggers", "attributes": { "kind": "say", "on-event": "voice-human" }, "relationships": { "activity": { "data": {"type": "activities", "id": "cu8Eo9RyrUsV4MXEiDZpLM"} }, "voice-template": { "data": {"type": "voice-templates", "id": "RyrUsV4MXEicu8Eo9DZpLM"} } } } }
6. Create Envelopes
POST /api/v1/envelopes Host: api.omnigage.io X-Account-Key: firstbank Authorization: Basic SDcyTFk0clFIU1hUYUIzR2Z Content-Type: application/vnd.api+json; ext=bulk Accept: application/vnd.api+json; ext=bulk { "data": [{ "type": "envelopes", "attributes": { "phone-number": "+15197566220", "meta": { "first-name": "Alexander", "last-name": "Bell" } }, "relationships": { "engagement": { "data": {"type": "engagements", "id": "yrbCdxqV2ZMdQBCszhA7TZ"} } } }, { "type": "envelopes", "attributes": { "phone-number": "+19734390088", "meta": { "first-name": "Michael", "last-name": "Morgan" } }, "relationships": { "engagement": { "data": {"type": "engagements", "id": "yrbCdxqV2ZMdQBCszhA7TZ"} } } }] }
7. Submit Engagement for Processing
PATCH /api/v1/engagements/yrbCdxqV2ZMdQBCszhA7TZ Host: api.omnigage.io X-Account-Key: firstbank Authorization: Basic SDcyTFk0clFIU1hUYUIzR2Z { "data":{ "id": "yrbCdxqV2ZMdQBCszhA7TZ", "type": "engagements", "attributes": { "status": "scheduled", "delivery-type": "immediately" } } }