← Stack Exchange + Twilio integrations

Make a Phone Call with Twilio API on New Answers for Specific Questions from Stack Exchange API

Pipedream makes it easy to connect APIs for Twilio, Stack Exchange and 1200+ other apps remarkably fast.

Trigger workflow on
New Answers for Specific Questions from the Stack Exchange API
Next, do this
Make a Phone Call with the Twilio API
No credit card required
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜

Trusted by 500,000+ developers from startups to Fortune 500 companies

Adyen logo
Brex logo
Carta logo
Checkr logo
Chameleon logo
DevRev logo
LinkedIn logo
Netflix logo
New Relic logo
OnDeck logo
Replicated logo
Scale AI logo
Teamwork logo
Warner Bros. logo
Xendit logo

Developers Pipedream

Getting Started

This integration creates a workflow with a Stack Exchange trigger and Twilio action. When you configure and deploy the workflow, it will run on Pipedream's servers 24x7 for free.

  1. Select this integration
  2. Configure the New Answers for Specific Questions trigger
    1. Connect your Stack Exchange account
    2. Select a Site
    3. Select one or more Questions
    4. Configure timer
  3. Configure the Make a Phone Call action
    1. Connect your Twilio account
    2. Select a From
    3. Configure To
    4. Configure Text
  4. Deploy the workflow
  5. Send a test event to validate your setup
  6. Turn on the trigger

Details

This integration uses pre-built, source-available components from Pipedream's GitHub repo. These components are developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.

Trigger

Description:Emits an event when a new answer is posted in one of the specified questions
Version:0.0.3
Key:stack_exchange-new-answers-for-questions

Stack Exchange Overview

The Stack Exchange API offers an extensive range of tools for developers who
want to access content from the Stack Exchange network. With the API,
developers can build a variety of applications and services to leverage the
full power of the Stack Exchange platform. Here are some examples of
applications you can create using the Stack Exchange API:

  • Real-time monitoring and analytics for your Stack Exchange account or for
    content posted by other users.
  • A tool to search Stack Exchange questions and retrieve answers.
  • A system that allows you to monitor Stack Exchange content in different
    languages.
  • Automated moderation tools to help you manage and review content on Stack
    Exchange.
  • A service that allows users to collaborate on Stack Exchange projects.
  • An application that displays enhanced Stack Exchange content, such as rich
    media and live updating feeds.
  • Tools to help developers create custom applications and services that
    facilitate data exchange within the Stack Exchange network.
  • A service that allows you to integrate Stack Exchange content into other
    applications and services.

Trigger Code

const stack_exchange = require("../../stack_exchange.app");
const { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } = require("@pipedream/platform");

module.exports = {
  key: "stack_exchange-new-answers-for-questions",
  name: "New Answers for Specific Questions",
  description: "Emits an event when a new answer is posted in one of the specified questions",
  version: "0.0.3",
  dedupe: "unique",
  type: "source",
  props: {
    stack_exchange,
    db: "$.service.db",
    siteId: {
      propDefinition: [
        stack_exchange,
        "siteId",
      ],
    },
    questionIds: {
      propDefinition: [
        stack_exchange,
        "questionIds",
        (c) => ({
          siteId: c.siteId,
        }),
      ],
    },
    timer: {
      type: "$.interface.timer",
      default: {
        intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
      },
    },
  },
  hooks: {
    async activate() {
      const fromDate = this._getCurrentEpoch();
      this.db.set("fromDate", fromDate);
    },
  },
  methods: {
    _getCurrentEpoch() {
      // The StackExchange API works with Unix epochs in seconds.
      return Math.floor(Date.now() / 1000);
    },
    generateMeta(data) {
      const {
        answer_id: id,
        question_id: questionId,
        creation_date: ts,
      } = data;
      const summary = `New answer for question ID ${questionId}`;
      return {
        id,
        summary,
        ts,
      };
    },
  },
  async run() {
    const fromDate = this.db.get("fromDate");
    const toDate = this._getCurrentEpoch();
    const filter = "!SWKA(ozr4ec2cHE9JK"; // See https://api.stackexchange.com/docs/filters
    const searchParams = {
      fromDate,
      toDate,
      filter,
      sort: "creation",
      order: "asc",
      site: this.siteId,
    };

    const items = this.stack_exchange.answersForQuestions(this.questionIds, searchParams);
    for await (const item of items) {
      const meta = this.generateMeta(item);
      this.$emit(item, meta);
    }

    this.db.set("fromDate", toDate);
  },
};

Trigger Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
LabelPropTypeDescription
Stack Exchangestack_exchangeappThis component uses the Stack Exchange app.
N/Adb$.service.dbThis component uses $.service.db to maintain state between executions.
SitesiteIdstringSelect a value from the drop down menu.
QuestionsquestionIdsstring[]Select a value from the drop down menu.
timer$.interface.timer

Trigger Authentication

Stack Exchange uses OAuth authentication. When you connect your Stack Exchange account, Pipedream will open a popup window where you can sign into Stack Exchange and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Stack Exchange API.

Pipedream requests the following authorization scopes when you connect your account:

read_inboxno_expirywrite_accessprivate_info

About Stack Exchange

Community-powered Q&A sites

Action

Description:Make a phone call, passing text that Twilio will speak to the recipient of the call. [See the docs](https://www.twilio.com/docs/voice/api/call-resource#create-a-call-resource) for more information
Version:0.1.3
Key:twilio-make-phone-call

Twilio Overview

With the Twilio API, you can build telephone applications that make and receive
phone calls, as well astext messaging applications that send and receive text
messages.

Some examples of applications you could build include:

  • A phone call application that allows you to make and receive phone calls over
    the internet
  • A text messaging application that allows you to send and receive text
    messages over the internet
  • A voicemail application that allows you to leave and receive voicemails over
    the internet

Action Code

import { phone } from "phone";
import twilio from "../../twilio.app.mjs";
import { callToString } from "../../common/utils.mjs";

export default {
  key: "twilio-make-phone-call",
  name: "Make a Phone Call",
  description: "Make a phone call, passing text that Twilio will speak to the recipient of the call. [See the docs](https://www.twilio.com/docs/voice/api/call-resource#create-a-call-resource) for more information",
  version: "0.1.3",
  type: "action",
  props: {
    twilio,
    from: {
      propDefinition: [
        twilio,
        "from",
      ],
    },
    to: {
      propDefinition: [
        twilio,
        "to",
      ],
    },
    text: {
      label: "Text",
      type: "string",
      description: "The text you'd like Twilio to speak to the user when they pick up the phone.",
    },
  },
  async run({ $ }) {
    // Parse the given number into its E.164 equivalent
    // The E.164 phone number will be included in the first element
    // of the array, but the array will be empty if parsing fails.
    // See https://www.npmjs.com/package/phone
    const toParsed = phone(this.to);
    console.log(toParsed);
    if (!toParsed || !toParsed.phoneNumber) {
      throw new Error(`Phone number ${this.to} could not be parsed as a valid number.`);
    }

    const fromParsed = phone(this.from);
    if (!fromParsed || !fromParsed.phoneNumber) {
      throw new Error(`Phone number ${this.from} could not be parsed as a valid number.`);
    }

    const data = {
      to: toParsed.phoneNumber,
      from: fromParsed.phoneNumber,
      twiml: `<Response><Say>${this.text}</Say></Response>`,
    };

    const resp = await this.twilio.getClient().calls.create(data);
    $.export("$summary", `Successfully made a new phone call, "${callToString(resp)}"`);
    return resp;
  },
};

Action Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI.

LabelPropTypeDescription
TwiliotwilioappThis component uses the Twilio app.
FromfromstringSelect a value from the drop down menu.
Totostring

The destination phone number in E.164 format. Format with a + and country code (e.g., +16175551212).

Texttextstring

The text you'd like Twilio to speak to the user when they pick up the phone.

Action Authentication

Twilio uses API keys for authentication. When you connect your Twilio account, Pipedream securely stores the keys so you can easily authenticate to Twilio APIs in both code and no-code steps.

To connect your Twilio account to Pipedream,

First, create an API key in Twilio.

  • There are two types of keys: Master and Standard. You'll need a Master key to interact with certain API endpoints, like /Accounts.
  • If you don't need to interact with those endpoints, you can use a Standard key.

After creating your key, you'll see fields for Sid and Secret. Enter those in the fields below.

About Twilio

Cloud communications platform for building SMS, Voice & Messaging applications on an API built for global scale

More Ways to Connect Twilio + Stack Exchange

Send MMS with Twilio API on New Answers for Specific Questions from Stack Exchange API
Stack Exchange + Twilio
 
Try it
Send SMS with Twilio API on New Answers for Specific Questions from Stack Exchange API
Stack Exchange + Twilio
 
Try it
Make a Phone Call with Twilio API on New Answers from Specific Users from Stack Exchange API
Stack Exchange + Twilio
 
Try it
Send MMS with Twilio API on New Answers from Specific Users from Stack Exchange API
Stack Exchange + Twilio
 
Try it
Send SMS with Twilio API on New Answers from Specific Users from Stack Exchange API
Stack Exchange + Twilio
 
Try it
New Answers for Specific Questions from the Stack Exchange API

Emits an event when a new answer is posted in one of the specified questions

 
Try it
New Answers from Specific Users from the Stack Exchange API

Emits an event when a new answer is posted by one of the specified users

 
Try it
New Question for Specific Keywords from the Stack Exchange API

Emits an event when a new question is posted and related to a set of specific keywords

 
Try it
New Question for Specific Keywords from the Stack Exchange API

Emits an event when a new question is posted and related to a set of specific keywords

 
Try it
New Incoming SMS (Instant) from the Twilio API

Emit new event every time an SMS is sent to the phone number set. Configures a webhook in Twilio, tied to an incoming phone number.

 
Try it
Send SMS with the Twilio API

Send a simple text-only SMS. See the docs for more information

 
Try it
Make a Phone Call with the Twilio API

Make a phone call, passing text that Twilio will speak to the recipient of the call. See the docs for more information

 
Try it
Send MMS with the Twilio API

Send an SMS with text and media files. See the docs for more information

 
Try it
Check Verification Token with the Twilio API

Check if user-provided token is correct. See the documentation for more information

 
Try it
Delete Call with the Twilio API

Remove a call record from your account. See the docs for more information

 
Try it

Explore Other Apps

1
-
12
of
1200+
apps by most popular

HTTP / Webhook
HTTP / Webhook
Get a unique URL where you can send HTTP or webhook requests
Node
Node
Anything you can do with Node.js, you can do in a Pipedream workflow. This includes using most of npm's 400,000+ packages.
Beta
Python
Python
Anything you can do in Python can be done in a Pipedream Workflow. This includes using any of the 350,000+ PyPi packages available in your Python powered workflows.
Schedule
Schedule
Trigger workflows on an interval or cron schedule.
Beta
Data Stores
Data Stores
Use Pipedream Data Stores to manage state throughout your workflows.
Telegram Bot
Telegram Bot
Telegram is a cloud-based instant messaging and voice over IP service
OpenAI (ChatGPT)
OpenAI (ChatGPT)
OpenAI is an AI research and deployment company with the mission to ensure that artificial general intelligence benefits all of humanity. They are the makers of popular apps like ChatGPT and DALL·E 2.
Google Sheets
Google Sheets
With Google Sheets, you can create, edit, and collaborate wherever you are
Discord
Discord
Use this app to create a Discord source that emits messages from your guild to a Pipedream workflow.
GitHub
GitHub
Where the world builds software. Millions of developers and companies build, ship, and maintain their software on GitHub—the largest and most advanced development platform in the world.
Formatting
Formatting
Pre-built actions to make formatting and manipulating data within your workflows easier.
Slack
Slack
Slack is a channel-based messaging platform. With Slack, people can work together more effectively, connect all their software tools and services, and find the information they need to do their best work — all within a secure, enterprise-grade environment.