### Single Opt-Out Webhook Example
Source: https://docs.telgorithm.com/features/opt-outs
This webhook is sent when a user opts out from a specific sender phone number. The ScopeType is SenderPhoneNumber.
```json
{
...
"ScopeType": "SenderPhoneNumber",
"Scope": "+11234567890",
...
}
```
--------------------------------
### Static Call Forwarding
Source: https://docs.telgorithm.com/features/voice-services
Configure a fixed forwarding destination for each phone number using the GET /v1/Phones/{phone}/voice API endpoint. The callsForwardedTo parameter accepts either an E.164 phone number or a SIP URI.
```APIDOC
## GET /v1/Phones/{phone}/voice
### Description
Retrieves the static call forwarding configuration for a given phone number.
### Method
GET
### Endpoint
/v1/Phones/{phone}/voice
### Parameters
#### Path Parameters
- **phone** (string) - Required - The phone number for which to retrieve forwarding settings.
#### Query Parameters
None
### Response
#### Success Response (200)
- **callsForwardedTo** (string) - The configured forwarding destination (E.164 phone number or SIP URI).
#### Response Example
{
"callsForwardedTo": "+15551234567"
}
```
--------------------------------
### Double Opt-Out Webhook - TCR Campaign Scope Example
Source: https://docs.telgorithm.com/features/opt-outs
The second webhook for a double opt-out event, indicating the user has opted out from the associated TCR campaign. The ScopeType is TcrCampaign.
```json
{
...
"ScopeType": "TcrCampaign",
"Scope": "C123456",
...
}
```
--------------------------------
### Emulate Payments with Test Credit Cards
Source: https://docs.telgorithm.com/features/staging-environment
In the staging environment, you can use a list of provided test credit card numbers to simulate successful payment flows without actual charges.
```APIDOC
## Emulate Payments
### Description
Simulate successful payment flows using test credit cards in the staging environment. These cards can be added via the **Staging Portal** under **Organization → Billing → Payment Info**.
### Supported Test Card Numbers
| Card Type | Test Number | CVV |
|----------------|----------------|------|
| Visa | 4012000098765439 | 999 |
| Mastercard | 5146315000000055 | 998 |
| Mastercard (BIN 2) | 2223000048400011 | 998 |
| Discover | 6011000993026909 | 996 |
| American Express | 374101000000608 | 9997 |
| American Express | 371449635392376 | 9997 |
| Diner’s Club | 36256000000725 | 123 |
| JCB | 3566000000000000 | 123 |
**Note:** Use these cards only in the Staging environment. No actual charges will be made.
```
--------------------------------
### Initiate Campaign Migration via TCR API
Source: https://docs.telgorithm.com/features
Use this API endpoint to migrate an active campaign to Telgorithm. Replace {campaignId} with your campaign ID and use SQTIJSW as the upstream CNP ID.
```bash
https://csp-api.campaignregistry.com/v2/campaign/{campaignId}/migrateCnp/SQTIJSW
```
--------------------------------
### Emulate Inbound Message - JSON
Source: https://docs.telgorithm.com/features/staging-environment
Use this JSON body to simulate an incoming message to Telgorithm via the testkit. Specify sender, recipient, text, and optional media URLs.
```json
{
"from": "+19876543210",
"to": [
"+11234567890",
"+11234567891"
],
"text": "Text of the message",
"mediaUrls": [
"http://some.site/image.png"
]
}
```
--------------------------------
### Emulate Inbound Messages
Source: https://docs.telgorithm.com/features/staging-environment
Simulates an incoming message to Telgorithm. This endpoint allows you to test message handling by specifying sender, receiver, text, and media URLs.
```APIDOC
## POST https://api.staging.telgorithm.com/testkit/v1/Emulate/inbound-message
### Description
Emulates an inbound message to Telgorithm.
### Method
POST
### Endpoint
https://api.staging.telgorithm.com/testkit/v1/Emulate/inbound-message
### Parameters
#### Request Body
- **from** (string) - Required - The origination phone number of the message.
- **to** (array of strings) - Required - The destination phone numbers of the message, which should contain at least one company number.
- **text** (string) - Optional - The text of the message.
- **mediaUrls** (array of strings) - Optional - The URLs for the media, to emulate an MMS message.
### Request Example
```json
{
"from": "+19876543210",
"to": [
"+11234567890",
"+11234567891"
],
"text": "Text of the message",
"mediaUrls": [
"http://some.site/image.png"
]
}
```
### Response
#### Success Response (200)
- **message** (string) - Confirmation message of the emulation.
```
--------------------------------
### Forward Call to SIP URI
Source: https://docs.telgorithm.com/features/voice-services
Use this script to forward an incoming call to a specified SIP URI. Ensure the SIP URI is correctly formatted.
```xml
sip:username@server.com
```
--------------------------------
### Emulate Inbound Call - JSON
Source: https://docs.telgorithm.com/features/staging-environment
Simulate an inbound call by specifying the originating number, destination company number, and desired call duration in minutes. A duration of 0 hangs up immediately.
```json
{
"from": "+19876543210",
"to": "+11234567890",
"durationInMinutes": 1
}
```
--------------------------------
### Initiating Outbound Calls
Source: https://docs.telgorithm.com/features/voice-services
Initiate outbound calls programmatically using the POST /v1/voice/calls API endpoint. The 'from' and 'to' parameters support both E.164 phone numbers and SIP URIs.
```APIDOC
## POST /v1/voice/calls
### Description
Initiates an outbound call.
### Method
POST
### Endpoint
/v1/voice/calls
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **from** (string) - Required - The caller ID for the outbound call (E.164 phone number or SIP URI).
- **to** (string) - Required - The destination number for the outbound call (E.164 phone number or SIP URI).
### Request Example
{
"from": "+15550001111",
"to": "+15552223333"
}
### Response
#### Success Response (200)
- **callId** (string) - The unique identifier for the initiated call.
- **status** (string) - The status of the call initiation.
#### Response Example
{
"callId": "abc123xyz789",
"status": "initiated"
}
```
--------------------------------
### Enable Call Recording for Outbound Calls
Source: https://docs.telgorithm.com/features/voice-services
Enable recording for outbound calls by including the `record: true` flag in the request.
```APIDOC
## POST /v1/Voice/Calls
### Description
Initiates an outbound call. Include the `record` flag to enable call recording.
### Method
POST
### Endpoint
/v1/Voice/Calls
### Parameters
#### Request Body
- **record** (boolean) - Optional - Set to `true` to record this outbound call. If omitted or set to `false`, the call will not be recorded.
```
--------------------------------
### Emulate Port-In Phone Numbers
Source: https://docs.telgorithm.com/features/staging-environment
This endpoint allows you to simulate the process of porting phone numbers into the staging environment. It accepts a multipart/form-data request containing JSON details and optional attachments.
```APIDOC
## Emulate Port-In Phone Numbers
### Description
Simulates number port-in to the staging environment.
### Method
POST
### Endpoint
https://api.staging.telgorithm.com/messaging/v1/Phones/port-in
### Parameters
#### Request Body
This endpoint accepts a `multipart/form-data` request with two parts:
- `data` - JSON object describing the port-in details.
- `files` - One or more attachments (LOA documents).
### Request Example
#### `data` part (JSON):
```json
{
"phones": [
{
"phone": "+12145678900",
"name": "My Ported Phone",
"messagingConfigSid": "MCf4f1e0ccde19431ebde74a9f2996afa0",
"authorization": {
"accountNumber": "012345",
"accountPhoneNumber": "+12145678900",
"authorizerName": "John Smith",
"authorizationDate": "2023-01-01",
"accountPin": "123"
},
"endUser": {
"name": "John Smith",
"streetNumber": "123",
"streetDirectionPrefix": "N",
"streetName": "Highland",
"streetType": "St",
"streetDirectionPostfix": "N",
"locationType1": "Bld",
"locationValue1": "2B",
"locationType2": "string",
"locationValue2": "string",
"locationType3": "string",
"locationValue3": "string",
"city": "Los Angeles",
"state": "CA",
"postalCode": "12345",
"serviceType": "Business"
}
}
],
"features": "Messaging"
}
```
### Response
#### Success Response (200)
PendingPortIn numbers are automatically transitioned to Active within 5 minutes in the staging environment.
```
--------------------------------
### Forward Call and Override Recording
Source: https://docs.telgorithm.com/features/voice-services
Use this script to forward an incoming call to a specified E.164 phone number and override the default recording behavior. Set 'Record' to 'true' to enable recording.
```xml
+1234567890
```
--------------------------------
### Enable/Disable Call Recording for Inbound Calls
Source: https://docs.telgorithm.com/features/voice-services
Control the default recording behavior for inbound calls by setting the `recordInboundCalls` parameter. This can be overridden for calls using dynamic call forwarding.
```APIDOC
## PUT /v1/Phones/{phone}/voice
### Description
Updates the voice settings for a specific phone number, including the default recording behavior for inbound calls.
### Method
PUT
### Endpoint
/v1/Phones/{phone}/voice
### Parameters
#### Path Parameters
- **phone** (string) - Required - The phone number to update.
#### Request Body
- **recordInboundCalls** (boolean) - Required - Set to `true` to enable recording for all inbound calls to this number by default, or `false` to disable.
```
--------------------------------
### Emulate Outbound Delivery Status - JSON
Source: https://docs.telgorithm.com/features/staging-environment
Provide the SID of an outbound message and a boolean to indicate success or failure for delivery status emulation. This triggers webhooks if configured.
```json
{
"sid": "OM08d9704f044a2fa13d3faa216fcf4574b64b19be32626243",
"deliveredSuccessfully": true
}
```
--------------------------------
### Play Message and Hang Up
Source: https://docs.telgorithm.com/features/voice-services
Use this script to play a Text-to-Speech message to the caller and then hang up. The message content is provided within the Hangup tag.
```xml
The number you have dialed is currently out of service.
```
--------------------------------
### Emulate Port-In Phone Numbers Data
Source: https://docs.telgorithm.com/features/staging-environment
Use this JSON payload with a multipart/form-data request to POST to the staging API endpoint for emulating number port-ins. Ensure all required fields for phone, authorization, and end-user details are accurately provided.
```json
{
"phones": [
{
"phone": "+12145678900",
"name": "My Ported Phone",
"messagingConfigSid": "MCf4f1e0ccde19431ebde74a9f2996afa0",
"authorization": {
"accountNumber": "012345",
"accountPhoneNumber": "+12145678900",
"authorizerName": "John Smith",
"authorizationDate": "2023-01-01",
"accountPin": "123"
},
"endUser": {
"name": "John Smith",
"streetNumber": "123",
"streetDirectionPrefix": "N",
"streetName": "Highland",
"streetType": "St",
"streetDirectionPostfix": "N",
"locationType1": "Bld",
"locationValue1": "2B",
"locationType2": "string",
"locationValue2": "string",
"locationType3": "string",
"locationValue3": "string",
"city": "Los Angeles",
"state": "CA",
"postalCode": "12345",
"serviceType": "Business"
}
}
],
"features": "Messaging"
}
```
--------------------------------
### Emulate Inbound Call
Source: https://docs.telgorithm.com/features/staging-environment
Creates an emulated inbound call to your number. This endpoint helps test call forwarding rules and call handling logic.
```APIDOC
## POST https://api.staging.telgorithm.com/testkit/v1/Emulate/inbound-call
### Description
Emulates an inbound call to a company number.
### Method
POST
### Endpoint
https://api.staging.telgorithm.com/testkit/v1/Emulate/inbound-call
### Parameters
#### Request Body
- **from** (string) - Required - The origination phone number of the call.
- **to** (string) - Required - The destination phone number of the call, which should be a company number.
- **durationInMinutes** (integer) - Required - The desired duration in minutes for the emulated call. Value must be between 0 and 5.
### Request Example
```json
{
"from": "+19876543210",
"to": "+11234567890",
"durationInMinutes": 1
}
```
### Response
#### Success Response (200)
- **message** (string) - Confirmation message of the emulation.
```
--------------------------------
### Forward Call with E.164 Number
Source: https://docs.telgorithm.com/features/voice-services
Use this script to forward an incoming call to a specified E.164 phone number. Ensure the number is correctly formatted.
```xml
+1234567890
```
--------------------------------
### Control Recording Mid-Call
Source: https://docs.telgorithm.com/features/voice-services
Pause or resume call recording during an active call. Each resume action creates a new recording segment.
```APIDOC
## POST /v1/Voice/Calls/{sid}/recording-control
### Description
Manages the recording state of an active call, allowing it to be paused or resumed.
### Method
POST
### Endpoint
/v1/Voice/Calls/{sid}/recording-control
### Parameters
#### Path Parameters
- **sid** (string) - Required - The unique identifier of the call.
#### Request Body
- **action** (string) - Required - The action to perform. Supported values: `pause`, `resume`.
```
--------------------------------
### Directly Hang Up Call
Source: https://docs.telgorithm.com/features/voice-services
Use this script to immediately hang up an incoming call without any further action. This is a simple and direct way to terminate the call.
```xml
```
--------------------------------
### Retrieve Call Recording Metadata
Source: https://docs.telgorithm.com/features/voice-services
Check if a call was recorded and retrieve its metadata using the call's unique identifier.
```APIDOC
## GET /v1/Voice/Calls/{sid}
### Description
Retrieves details about a specific call, including metadata for any associated recordings.
### Method
GET
### Endpoint
/v1/Voice/Calls/{sid}
### Parameters
#### Path Parameters
- **sid** (string) - Required - The unique identifier of the call.
### Response
#### Success Response (200)
- **recordings** (array) - Optional - An array of recording objects. This field is present only if recordings were requested for the call. Each object may contain details such as recording URL, format, and status.
```
--------------------------------
### Emulate Outbound Delivery Status
Source: https://docs.telgorithm.com/features/staging-environment
Sets the delivery status for an outbound message. This is useful for testing how your system handles message delivery confirmations or failures.
```APIDOC
## POST https://api.staging.telgorithm.com/testkit/v1/Emulate/outbound-message-status
### Description
Emulates the delivery status of an outbound message.
### Method
POST
### Endpoint
https://api.staging.telgorithm.com/testkit/v1/Emulate/outbound-message-status
### Parameters
#### Request Body
- **sid** (string) - Required - The SID of the outbound message.
- **deliveredSuccessfully** (boolean) - Required - A flag indicating whether the delivery should be marked as successful or failed.
### Request Example
```json
{
"sid": "OM08d9704f044a2fa13d3faa216fcf4574b64b19be32626243",
"deliveredSuccessfully": true
}
```
### Response
#### Success Response (200)
- **message** (string) - Confirmation message of the emulation.
```
--------------------------------
### Request Inbound Messages with Conversation Metadata
Source: https://docs.telgorithm.com/features/conversation-metadata
To retrieve conversation metadata for Inbound Messages via the API, set the `IncludeConversationMetadata` query parameter to `true` in your request.
```http
GET https://api.telgorithm.com/messaging/v1/InboundMessages?IncludeConversationMetadata=true
```
--------------------------------
### Retrieving Conversation Metadata via API
Source: https://docs.telgorithm.com/features/conversation-metadata
You can retrieve conversation metadata for messages by setting the `IncludeConversationMetadata` query parameter to `true` when requesting Inbound or Outbound Messages. This will include the `conversationMetadata` field in the response for each message.
```APIDOC
## Getting Metadata via API
Any endpoint that returns Inbound or Outbound Messages supports the `IncludeConversationMetadata` query parameter. Setting this parameter to `true` will provide conversation metadata in the response.
Example Request:
```
GET https://api.telgorithm.com/messaging/v1/InboundMessages?IncludeConversationMetadata=true
```
Example Response (some properties are omitted for brevity):
```json
{
"items": [
{
"sid": "IM08dbe4d588a100001d5155ca739071da5cdbe8aa81e9ad82",
"from": "+19876543210",
"to": "+10123456789",
...
"conversationMetadata": "clientId=123"
}
],
"searchId": null
}
```
```
--------------------------------
### Setting Conversation Metadata
Source: https://docs.telgorithm.com/features/conversation-metadata
You can set conversation metadata when sending an outbound message by including the `conversationMetadata` property in the request payload. This metadata will be associated with the message and all subsequent messages in the same conversation.
```APIDOC
## Setting Metadata
To specify Conversation Metadata, use the `conversationMetadata` property in the Send Outbound Message request:
```json
{
"from": "+10123456789",
"to": "+19876543210",
"text": "Glad to see you!",
"conversationMetadata": "clientId=123"
}
```
This metadata will be assigned to this message and future messages within this conversation.
```
--------------------------------
### Retrieving Conversation Metadata via Webhooks
Source: https://docs.telgorithm.com/features/conversation-metadata
Conversation metadata is automatically included in inbound and outbound message webhooks. The `ConversationMetadata` field in the webhook payload contains the metadata associated with the message.
```APIDOC
## Getting Metadata via Webhooks
Conversation metadata is automatically provided in Inbound or Outbound Message webhooks.
Outbound Message webhook example (some properties are omitted for brevity):
```json
{
"Sid": "OM08d9704f044a2fa13d3faa216fcf4574b64b19be32626243",
"From": "+10123456789",
"To": "+19876543210",
...
"ConversationMetadata": "clientId=123"
}
```
```
--------------------------------
### Retrieve Conversation Metadata from Inbound Message API Response
Source: https://docs.telgorithm.com/features/conversation-metadata
When `IncludeConversationMetadata` is set to `true`, the `conversationMetadata` field in the Inbound Message API response will contain the metadata associated with the message.
```json
{
"items": [
{
"sid": "IM08dbe4d588a100001d5155ca739071da5cdbe8aa81e9ad82",
"from": "+19876543210",
"to": "+19876543210",
...
"conversationMetadata": "clientId=123", // metadata for this message
}
],
"searchId": null
}
```
--------------------------------
### Set Conversation Metadata in Outbound Message Request
Source: https://docs.telgorithm.com/features/conversation-metadata
Use the `conversationMetadata` property in the Send Outbound Message request to set custom data for a conversation. This metadata will be applied to the current message and all future messages within the same conversation.
```json
{
"from": "+10123456789",
"to": "+19876543210",
"text": "Glad to see you!",
"conversationMetadata": "clientId=123" // sets conversation metadata
}
```
--------------------------------
### Retrieve Conversation Metadata from Outbound Message Webhook
Source: https://docs.telgorithm.com/features/conversation-metadata
Conversation metadata is automatically included in Outbound Message webhooks. The `ConversationMetadata` field contains the metadata associated with the message.
```json
{
"Sid": "OM08d9704f044a2fa13d3faa216fcf4574b64b19be32626243",
"From": "+10123456789",
"To": "+19876543210",
...
"ConversationMetadata": "clientId=123" // metadata for this message
}
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.