Send a multichannel campaign using an Infobip MCP server and OpenAI Agents SDK
This tutorial explains how to send a multichannel campaign using Infobip MCP servers and the OpenAI Agents SDK.
As an outcome, you'll build a system that can automatically route requests to the appropriate messaging channel, Viber or SMS, craft message content based on provided criteria, handle multiple recipients simultaneously, and provide feedback on message delivery status.
You can adapt code samples to add more channels or use other channels available through the Infobip MCP.
Products and channels [#products-channels]
Prerequisites [#prerequisites]
-
Python 3.9 or later
-
pip install examplepip install openai-agents
-
OPENAI_API_KEYenvironment variable set with your OpenAI API key. You can find it in your OpenAI account settings.bashexport OPENAI_API_KEY=your_openai_api_keyIf you are using the OpenAI Agents SDK, you can also set the
OPENAI_API_KEYin your code:Python1 import os2 os.environ["OPENAI_API_KEY"] = "your_openai_api_key" -
Infobip account. If you do not have one, sign up for a free account. For more information, see Create an account.
-
Infobip API key with the following scopes:
sms:message:sendviber-bm:message:send
Find out more about API keys and scopes.
-
Sender: If your account is in free trial, use the following test senders:
- SMS:
InfoSMS - Viber:
IBSelfServe
If you want to configure a custom sender, request a new number or an alphanumeric sender through your Infobip account or use the Infobip Numbers API.
- SMS:
-
Destination: A phone number to which the message will be sent.
If your account is in the free trial, you can only send messages to a verified phone number.
Technical specifications [#technical-specifications]
The system consists of the following:
- Specialist AI agents to send SMS and Viber messages
- An orchestrator agent that coordinates the specialist AI agents
- OpenAI Agents SDK to create these AI agents
- The following MCP servers that the specialist AI agents use to send messages:
- An Infobip SMS MCP server for SMS messages
- An Infobip Viber MCP server for Viber messages
- An AI client that calls the orchestrator
Process overview [#process-overview]
-
Create the following MCP server configurations for the specialist AI agents.
- Infobip SMS MCP server configuration
- Infobip Viber MCP server configuration
-
Create the following specialist AI agents:
- For SMS
- For Viber
-
Create an orchestrator AI agent that uses the SMS and Viber AI agents.
-
In your AI client, call the orchestrator to send messages to multiple users through SMS and Viber.
Implementation steps [#implementation-steps]
Complete the steps in each of the following sections sequentially.
Create the Infobip MCP server configurations for your AI agents [#create-mcp-server]
Use the MCP Server Streamable HTTP client to create the following MCP servers that the specialist AI agents can use to send messages:
- An Infobip SMS MCP server for SMS messages
- An Infobip Viber MCP server for Viber messages
Create specialist AI agents for SMS and Viber channels [#create-specialist-agents]
Use the OpenAI Agents SDK to create AI agents that send SMS and Viber messages using the Infobip MCP servers that you created.
Create an orchestrator AI agent that uses the SMS and Viber AI agents [#create-orchestrator]
Use the OpenAI Agents SDK to create an orchestrator agent that decides which specialist AI agent to use. Depending on the end user's request, the orchestrator routes the request to the relevant agent (SMS or Viber).
Use the orchestrator in your AI client to send messages [#use-orchestrator-in-ai-client]
In your AI client, write a prompt to do the following:
- Send an SMS and Viber message campaign.
- Call the orchestrator agent.
Guidelines for the prompt
-
Specify the sender and destinations.
-
Describe your use case so that the AI can create a relevant message.
-
Include the following information so that the AI does not guess or invent missing information.
- Limitations. Example: Only one message, specific delivery window
- Personalized details. Example: Specific URL, image
Create the prompt
Reports [#reports]
After the AI sends the message, it returns a summary of what it did, and retrieves a delivery report when it is available.
The following is an example of the summary for SMS messages:
The following is an example of the summary for Viber messages:
Additional resources [#additional-resources]
- Infobip MCP docs
- SMS API reference
- Viber Business Messages API reference
- Response status and error codes
- OpenAI Agents SDK